PHP – Chmod-ed to Windows hell and back

Today has not been a good day. With various things going wrong, I was please that I had got the file upload code done for a site i’m working on. All I needed to do was make sure that the file had the right permissions and then edit it via GD (via an image editor […]

php: processing raw Post / Get Values

I just added a jquery plugin to call head requests, but because you are not doing a get or post request php won’t convert the values that are sent back to their form. To get around this we have to use the php://input stream ( is that the right word?) which is handy for a […]

php: smarty assign content plugin

I needed to assign a block of content to a variable instead of just a value.. so i set about creating this plugin function smarty_block_assign_content($params, $content, &$smarty) { $smarty = clone($smarty); //Copy the original class, so there's no garbage variables after we finish if(!isset($content)) return; if (!isset($params['var'])) { $smarty->trigger_error("assign_content: missing 'var' parameter", E_USER_WARNING); return; } […]

php: Menu Classes

Recently I’ve been working on my own framework (we’ve all done it i’m sure) and part of this was a menu handling system. The basis really is simple, we have a menu item which really is just link and text. That menu item could have children, could be active and/or be selected. In this case […]

php: Insert element at specific Index of Array.

In a recent project I’ve been undertaking I’ve made a menu class set and sometimes i just wanted to say to add this to an array, but in a certain position. PHP does this easily via $array[position] = "newdata"; But unfortunately this is not so good if you only wanted to insert the newdata into […]