The Most Satisfaction?

While I enjoy most aspects of creating a website, the one part I enjoy the most is creating the initial design. I love tinkering about in Photoshop trying different colours, fonts, filters, and the likes.

I always feel good after I’ve completed a new design. I can’t say the same about coding. After I’m done coding a site/page I feel more relief than anything – relief that it’s done. But when I’m designing I’m always enthusiastic or excited. It’s a really nice feeling knowing you’ve created something new… fresh… never seen before.

What part of creating or running a website gives you the most satisfaction (not including the monetary aspect)? Is it creating the design or coding the HTML/CSS afterwards? What about search engine marketing or writing the content?

A HTML-Kit feature I never knew about!

While working on a site in HTML-Kit today I accidentally came across a feature that I really wish I knew about a long time ago.

I was happily coding away (oddly enough) in PHP and had highlighted a few lines of code that I wanted to move. Before I had the chance to move them I accidentally hit the tab button on the keyboard only to see all the highlighted lines get tabbed at once :eek:.

When I code in PHP I always indent the code like so:

if (isset($_POST['submit']))
	// do something
	// do something else

I find it makes the code easier to read and easier to spot if I’m missing any closing brackets, etc.

Sometimes after I have written some code, I decide that I want to enclose it inside another statement or another loop. So I write the new statement or loop and then manually tab each line inside it so the code is formatted the way I like it. I’ve had to manually tab anywhere up to fifthy lines of code before. Not any more :D.

If only I had known about this feature a long time ago. It would have saved me a lot of time and frustration.

Seperating code from content?

Many people have talked about seperating style from content (2, 3, 4), but for those of us who also code, what about seperating code from content? At present I’m in the process of coding a backend for a new site, but because I’m only at the intermediate stage of my PHP learning curve I’m still finding it difficult to learn how to best implement this.

Should I employ some sort of templating engine or maybe get creative with php classes?

If you know of any blog entries or articles or if you have any advice, please do post a comment. Thanks :)

Automated Style Switcher

With the Christmas period upon us, I got to thinking… wouldn’t it be cool to be able to change the style of your site automatically depending on the time of the year?

Well with PHP it’s easy!

$today = date(′d/m′);
echo "<style type="text/css">";
echo "/*<![CDATA[*/";
if  ($today == ′25/12′)  {
echo "@import url(css/xmas_style.css);";
}  elseif ($today == ′01/01′)  {
echo "@import url(css/newyears_style.css);";
} else {
echo "@import url(css/style.css);";
echo "/*]]>*/";
echo "</style>";

First you assign a value to the $today variable using the date() function.

Then you echo out the beginning of the style tag. Then using a simple if…elseif…else statement you check if the value of the $today variable is equal to a certain date. If so, import the appropriate stylesheet. Finally you need to echo out the end of the style tag.

The code above needs to be placed inside the <head></head> tags in order to work. Also, this will only work properly on sites that have separated presentation from content.

Of course the code above only works on a day-to-day basis. If, for example, you wanted to have an xmas stylesheet be used for the entire month of December you would need to edit the code to check if the day falls between 01/12 – 31/12, but I’ll leave that up to you to figure out :)

The Joys of AMP on WinXP SP2

So what’s AMP?

Apache, MySQL & PHP.

Why so joyous? Because it’s soooooo easy to upgrade them that even a kid could do it!
I’ll leave the decision of whether or not their is a hint of sarcasm in that statement up to you ;)

Honestly…. I don’t care what anyone says… it’s not all gravy. I spent the best part of ten hours upgrading today. I won’t go into the details because you probably won’t bother reading it anyway. But, if you are a web developer and are having problems installing Apache, MySQL & PHP on Windows XP SP2 feel free to give me a shout. I’ll try my best to help you out.

At least now I can get back to coding :D

Oh by the way, the versions I upgraded to are Apache 2.0.52, MySQL 4.0.22 and PHP5.0.2