Archive for the 'Programming' Category

Quick Tip For PHP Loops

When you’re writing lengthy code it’s really easy to get confused and lose track of your control loops.

When I was making the transition from PHP newbie to being able to write my own code, I often had trouble keeping track of all the if/then loops, foreach loops, and all the other various control procedures. Invariably I’d type some code, upload it to the server, hit it with my browser only to get no output and no error code… the worst possible result.

That horrible blank screen that means a trip back to Notepad to hunt through lines and lines of code to figure out if it’s a missing } or one too many } or some other silly typo.

Many years later, and many many projects the wiser, I’ve got a coding method that all but eliminates these kind of time wasting coding problems.
Read the rest of this entry »

Posted by Administrator on June 12th, 2005 .
Filed under: Programming | 2 Comments »

Adding Functionality to Templates

I recently saw a post in the forums for WordPress where someone was trying to add someone else’s php code to their themes. The code started off by setting a cookie. It was correctly commented in the source code to

…put this before any html

The reason being that to set a cookie, there must be no information sent to the browser yet. This is also true of other header(); php commands.

So, how can we put the script where we want, without having a whole bunch of errors thrown on the page?
Read the rest of this entry »

Posted by Administrator on June 5th, 2005 .
Filed under: Programming, WordPress | 2 Comments »

Permalinks for Pages in WordPress Made Simple

When I first fired up WordPress 1.5.1.2 I almost gave up on it prematurely because the new ‘Pages’ feature seemed to require two unacceptable options if I was to use permalinks (for more user-friendly urls):

  • chmod .htaccess to world writable
  • update .htaccess every time I wanted to add a new ‘page’

After some thorough searching through the forums, I came across some tips that solved the issue and made it possible to add pages without changing .htacess one bit.
Read the rest of this entry »

Posted by Administrator on June 5th, 2005 .
Filed under: Programming, WordPress | 3 Comments »

Word Press Plugin for Static Pages

Am I the only one that thinks it’s a bit silly to create one template for your blog, one for your CMS, one for your discussion board, and yet another for static pages you upload?

Because very rarely are you going to create ALL of your content within the confines of even the very best blog or CMS apps.
Read the rest of this entry »

Posted by Administrator on June 3rd, 2005 .
Filed under: Programming, WordPress | 8 Comments »