Octal Modes

This is just a list of octal modes for Linux file permissions. If you know what I’m talking about you may find this useful. If not then never mind ;)

0 None
1 –x Execute
2 -w- Write
3 -wx Write/Execute
4 r– Read
5 r-x Read/Execute
6 rw- Read/Write
7 rwx Read/Write/Execute

HTML Tidy is my daddy!

I will admit I tend to be a little picky when it comes to how my code looks, HTML included. I hate having to go through all my PHP to try and make sure all my included files are outputting in the same structure as everything else so that when I view the source of the final product it is all nice and readable. Most people probably don’t care. There are others that don’t want any formatting at all believing that it saves load time not having all those extra tabs and spaces. Which is true by the way…remove all formatting from your html and you won’t believe how much it lowers your file sizes, especially with large web sites. But when it comes to maintaining the site (if you aren’t using some wysiwyg) you will curse the day you removed all that nice structure.

Earlier today I was working on this new WordPress theme and getting frustrated at how many of the WordPress functions don’t have any concept of structure. Before I decided to track down and modify their functions myself or even worse, scrap the project altogether, I thought why not give Tidy a shot. I have never really used it before and now that I see how awesome it is I’m kicking myself for not trying it sooner!

Imagine if you will, having the ability to structure the HTML in your PHP files however you like and the output HTML being either perfectly structured HTML or void of any structure at all without having to do a damn thing! Sounds nice doesn’t it? Well my friend, that time has come. That is of course assuming your hosting provider has lib-tidy installed and enabled on your server. If I am hosting your site it is already enabled and you may proceed with fortitude. Otherwise read up on what you need to do at php.net.

To get started, do something like this above your html code:

<?php ob_start(); ?>
<html>

And then below your html:

</html>
<?php
$html = ob_get_clean();
$config = array(
  'indent' => true,
  'output-xhtml' => true,
  'wrap' => 0,
  'indent-spaces' => 4,
  'add-xml-decl' => true,
  'doctype' => 'strict'
);
$tidy = new tidy();
$tidy->parseString($html, $config, 'utf8');
$tidy->cleanRepair();
echo $tidy;
?>

And that’s it! If tidy is set up correctly you should be able to view the source of your site and be amazed at the majesty of it all. To remove the formatting just change indent in the config array to false. If you want to play around with the options a bit more than that check out the quick reference. And if you ever run in to Dave Raggett give him a big hug for the both of us!

Ugly Website

Okay, as bad as I wanted to design my own WordPress theme for this site I gave up. I just can not design for myself. After searching for a while online I finally found a theme that didn’t make my skin crawl. I plan on modifying it a bit more though so please forgive any quirks you may find in the mean time.

New Wordpress Site

Anyone that knows me probably knows that I have never really finished a site for myself. A very sad fact since I have been building websites for almost 8 years now. I have installed WordPress on several occasions only to abandon it thinking I will eventually sit down and spend the time developing my own content management system. ha! So here I am, setting up WordPress once again and telling myself I will actually run with it this time like it is a New Years resolution. We’ll see how it goes. So if you are interested in seeing how bad I am at procrastinating check back often.