php

php

Let’s countdown together

Let’s countdown together

This post will display bad in RSS readers and planet. Click here to read it on my site. Update: Better degradation for no-JS-users using a PHP script added. See below. So, the latest and greatest (and badly named ;-) ) Ubuntu is approaching and you want to help the community spreading out the word and build [...]

How to create Private (and moderated) Forums BuddyPress and BBPress

If you develop on BuddyPress, you’re likely to get stuck while trying to get per-forum permissions. Indeed, it seems there’s not yet a way to make BBPress read the BuddyPress groups and hide the froums belonging to private  groups I had to develop a way myself. Furthermore, I needed to give forum moderation rights to [...]

5 tips to make your PHP code beautiful (3)

Avoid unnecessary control structures. Brackets everywhere. Try to get rid of those as much as you can. Unnecessary brackets add visual complexity and make your code much longer. In real world situation, when you need to quickly browse through your code, they just add clutter //prints out the structure of a table function describe( $table [...]

5 tips to make your PHP code beautiful (2)

Thoughtful minimalism Think about the most concise, clear and readable way to write the code your writing. Assume you were writing a function to get a file extension (.gif, .doc, etc.). You could be tempted to use string manipulation functions. $filename = ‘file.doc’; $dot_position = strpos( $filename, ‘.’ ); if ( $dot_position !== false ) [...]

5 tips to make your PHP code beautiful (1)

Get your brackets right ..and indent your code properly, always. Always give to each of your curly brackets their very own line. I am taking a snippet from Kohana to demonstrate this. (bad) What do you think of this code ? if ( ! is_array($data)){ if (strpos($data, ‘[') !== FALSE) {$data = preg_replace('/\[.*\]/’, ”, $data); [...]

How to build an absolute url in php

Today, I was looking for a way to make an url absolute. Ok, it’s easy. Guess I should think some good excuse for not being to able to do it in 5 minutes. The sad reality is I ended digging on google (again). I am posting what I found, for …

A piece of story

What I found. Oh! Look, look ! As old-schoolers know Deja News, an historical Usenet repository was lately acquired by Google some year ago for Google Groups service, still conserves intact pieces of story of …

Xdump: a little piece of my story as developer

I am slowly beginning to pull online docs and samples for Xdump. Xdump was one debugging tool I had to develop for the reason that in some situations var_dump() simply is not enough. Here’s the overview of xdump. Of course one could …

Need for Cache

After going through PhpThumb hell, I decided to develop one serious decent caching library for caching dynamically generated images. Download   Download zipped source from Google Code Or browse svn repository Download source from svn using: svn checkout

Xdump

When working with large arrays/objects,with complex references beetween variables or (again) php’s built-in var_dump() e debug_backtrace() shows their limits. Have you ever tried to var_dump $GLOBALS ? Even if when I started this lib there were already some classes which provided nice html formatted …

Bills

Don’t forget to Subscribe