Posts Tagged ‘PHP’

A quick way to handle both strings and arrays in PHP

Something that happens occasionally is that I need to create a function that will specifically output chunks of HTML. A good method is to allow for functions to handle both single strings and arrays. The problem? I don’t like duplicating code. The solution? A quick convention to an array! function arrayish($a) { if (!is_array($a)) $a [...]

Read the rest of this entry »

Taking care of HTML comments in PHP

A little problem came up with some user submitted content on a platform I’m working with. A form allows users to submit content with tinyMCE. If the content is pasted from MS Word, the source is then littered with HTML conditional comments that can have a detrimental effect on the the page that returns it. [...]

Read the rest of this entry »

Life and Blogging is Hard

Plus.net have moved to the new CGI platform after some sort of disaster. As this was coming for almost a year, I’m shocked that the platform still seems in such a shoddy state. This has meant that the site has been misbehaving for a few weeks. Most notably causing random Apache errors. I think that [...]

Read the rest of this entry »

CodeIgniter’s Form Helper doesn’t respect POST arrays

I’ve been working on my first ‘proper’ CodeIgniter project this week. It’s been quite gruelling, as there are some moments where I have definitely sped up my production. But it’s constantly getting hampered by the learning curve. It may be slight, but is frustrating when I hit a wall. One issue that just cam up [...]

Read the rest of this entry »

PHP Toggle Variable

A neat trick I use in PHP is a toggle variable, usually when I’m creating tables and want to alternate the styles. To use a toggle variable: <code>#Create the variable $toggle=true; #Switch it $toggle=(!$toggle);</code> Simple!

Read the rest of this entry »

Automated Documentation in PHP

John begins a quest for an automatic web-based documentation program that will allow him to make some poorly formatted work look consistent on the web.

Read the rest of this entry »