Monthly Archives: December 2009

The PHP Object Expands in PHP5

Starting with PHP 5, the object model was rewritten to allow for better performance and more features. This was a major change from PHP 4. PHP 5 has a full object model. Among the features in PHP 5 are the inclusions of visibility, abstract and final classes and methods, additional magic methods, interfaces, cloning and typehinting. PHP treats objects in the same way as references or handles, meaning that each variable contains an object reference rather than a copy of the entire object. See Objects and References from php manual

Posted in Tech Tips, Web Development | Tagged , | Leave a comment

Good Practices in PHP

Here are a few tips for those of you who’d like to write good code in PHP: Set up a Development Server Set up a development server or sandbox. Don’t write, test, or develop code on a production server. If you are a *nix user, you probably already have a LAMP environment on your own computer. If you are a Windows user, try XAMPP or WAMPSERVER (personal favorite). If you are on mac, try MAMP. As you develop your PHP, you will need to be learning about the environment which it runs in, and the settings that will affect your code and/or application. This is a journey, so don’t expect to master it all at once. You will get into things like virtual hosts, .htaccess files, rewrite rules, and file permissions. Turn on Error Reporting At least, on your development server. On your production site, turn off displaying errors, but have them sent to a file. Check this file periodically as it will show you what unexpected things are happening in your code. Do’s and Don’t’s Don’t use short codes. They take longer to type, but PHP will be moving away from them in future versions. Also, the <? syntax can be mistaken for XML. Examples of short codes include <? instead of <?php, and also the syntax <?= $var ?> which is the easy way of writing <?php echo $var; ?> Do use comments and document your code. Don’t use a closing ?> at the end of your PHP files. … Continue reading

Posted in Tech Opinion, Tech Tips, Web Development | Tagged , | Leave a comment

WPtouch iPhone Theme

“With a single click, WPtouch transforms your WordPress blog into an iPhone application-style theme, complete with ajax loading articles and effects, when viewed from an iPhone, iPod touch, Android or BlackBerry touch mobile device.” Basically, this plugin will take your WordPress 2.7+ blog and check the HTTP headers to find out if the user’s browser is a mobile phone or iPhone, etc. Then, instead of serving up your normal theme, s/he is given a cool iPhone style interface to navigate your blog. It’s really quite cool and it takes care of some issues regarding small screen size browsing. It didn’t disable some of my plugins, however, which use javascript, (for example, the snow falling script) which seem to give the iPhone’s processor  a little bit of trouble (lots of math for that script). Over, I like it.

Posted in Design, Tech Opinion, Web Development | Tagged , , | Leave a comment

google donates $20 million to charity

google donates $20 million to charity for Christmas / Holiday 2009 season Quote: “Because charities are experiencing their toughest year in decades, we have committed $20 million to helping those who help us all. Our gift to you is a gift to them. Happy Holidays” – From Google View their page Google will be donating to these organizations: Feeding America Boys and Girls Clubs Smile Train CARE, Mothers Matter World Wildlife Fund, Natural Capital Project Mobile Creches Prajwala HEAL Africa African Institute for Mathematical Sciences The Mango Tree National Center for Missing and Exploited Children Harlem Children’s Zone Save the Children, Latin America focus Reporters Without Borders Witness Loud Against Nazis Global Voices Ushahidi Save the Children, Middle East and Eurasia focus Grupo Cultural Afro Reaggae Ashesi University College, Ghana Pratham Australian Indigenous Mentoring Experience Shin Shin Educational Foundation Tzu Chi Foundation

Posted in Marketing, Tech Opinion | Tagged , , | Leave a comment

More Fields for WordPress 2.9+

Update (3/22/10) I just added a link so you can download the version I am currently using with WP 2.9. It may not be perfect but it seems to be getting the job done well enough :) MoreFields for WordPress History Are you a long time user of More Fields who is upset that it broke with WordPress 2.8 and hasn’t been fixed yet? Me too. I needed this for several projects so I hacked my own working version together with help from these folks. MoreFields for WordPress 2.9+ download Download my version (2010-03-22) here Download my version (2009-12-20) here Support, Requests, Etc Feel free to comment on this page and send along your feedback. However, I’m not getting paid to keep this plugin up to date, I just need it for some projects, so don’t get mad at me if I’m behind the times with it. If you can help make improvements, send them to me and I’ll implement them. More Fields for WordPress Description If you are not familiar with More Fields, here is the description of More Fields for WordPress from the original plugin page. More Fields is a WordPress plugin that adds boxes to the Write/Edit page. These boxes contains input fields, so that additional (more) fields can be added to a post. For example, if you write about books, you can add a box where you can enter title and author, etc. The boxes can be placed either to the right or to the left … Continue reading

Posted in Web Development | Tagged , | 2 Comments

WordPress Query Object Properties

This is an example dump of the $wp_query object Here is the code snippet I used to create this. I unset all the post data with the two unset commands. global $wp_query; $forReturn .= $wp_query->found_posts; $temp = clone $wp_query; unset($temp->post); unset($temp->posts); $forReturn .= print_r($temp, true); Some of the items you’ll notice you can get to include WordPress’ Found Posts: $wp_query->found_posts $wp_query->post_count $wp_query->query WP_Query Object ( [query_vars] => Array ( [cat] => 5 [showposts] => [count] => [post_status] => publish,private,future [error] => [m] => 0 [p] => 0 [post_parent] => [subpost] => [subpost_id] => [attachment] => [attachment_id] => 0 [name] => [hour] => [static] => [pagename] => [page_id] => 0 [second] => [minute] => [day] => 0 [monthnum] => 0 [year] => 0 [w] => 0 [category_name] => [tag] => [tag_id] => 0 [author_name] => [feed] => [tb] => [paged] => 0 [comments_popup] => [meta_key] => [meta_value] => [preview] => [category__in] => Array ( [0] => 5 ) [category__not_in] => Array ( ) [category__and] => Array ( ) [post__in] => Array ( ) [post__not_in] => Array ( ) [tag__in] => Array ( ) [tag__not_in] => Array ( ) [tag__and] => Array ( ) [tag_slug__in] => Array ( ) [tag_slug__and] => Array ( ) [caller_get_posts] => [suppress_filters] => [post_type] => post [posts_per_page] => 10 [nopaging] => [comments_per_page] => 50 [order] => DESC [orderby] => wp_posts.post_date DESC ) [request] => SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) WHERE 1=1 AND wp_term_taxonomy.taxonomy … Continue reading

Posted in Web Development | 3 Comments

Daily Show Widget

Get the Code <object width="300" height="534" codebase="" id="4ac5fb13fb058b354af8b74d7311d339" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="" name="movie"/><param value="high" name="quality"/><param value="4af8b74d7311d339" name="placementid"/><param value="#869ca7" name="bgcolor"/><param value="always" name="allowScriptAccess"/><embed width="300" height="534" align="middle" pluginspage="" placementid="4af8b74d7311d339" type="application/x-shockwave-flash" allowscriptaccess="always" quality="high" loop="false" play="true" name="CCWidget" bgcolor="#869ca7" src=""/></object>

Posted in Random | Tagged , , | 1 Comment