Beginners Guide to PHP Includes
A lot of beginners to websites do the mistake to include all page elements on all the pages, making is hard to edit and very time consuming. Usually though, it’s because you don’t know what to do else. I remember the same when I first started out. So I’m going to go through how to divide a coded site into good sections using PHP includes, to ease everything for you later!
First lets describe the basic principle of PHP Includes, a principle that is pretty easy. Basically you put some content into one “reference” page (say we call it “sidebar.php”) and then using a simple code snippet, reference that page into another page; basically include the contents of that sidebar.php into your other file. When you need to update something in the sidebar, all you need to do is update that one PHP file, and the sidebar will update throughout the site.
Now, before we go into the code, I shall mention the only requirements here, and that’s that you have a server that will run PHP 4 or PHP 5 on it, otherwise this method is not going to work.
First off, we need to create a sample reference page. Let’s say that we want to include a sidebar into our index page. So we would need to create a page that I suggest you call “sidebar.php” and put in a folder called “includes”. That way you keep track on everything you include. In this page, you’ll use normal HTML formatting to outline your sidebar as you’d want it to look. Then on the page where you wish to include your sidebar, just type in the following code:
<?php include(“includes/sidebar.php”); ?>
If we break it down, it’s first opening the PHP tags, then opening an include function. After that we are telling it to find the file “sidebar.php” that is in the directory called “includes”.
NOTE: You could have any file ending really on the included page including regular .html extensions.
Remember to now save this page where we typed in the include as pagename.php. It’s very important that you use the .php extension or else the file will not parse the php include code on the page.
Taking it a step further: As I’m sure you’ve realized, this is not only good for sidebars, but headers, footers and every site element that will always be repeated on a page without changes that are page specific.
This include system is useful for certain elements. If you have on the other hand a lot of pages there is another system that could be more useful, that will prevent the need to include these elements on all pages. We’ll take a look at that in another tutorial. Basically, use this system to include any repeating objects that aren’t page specific, like sidebars, footers and headers. If you have a lot of content, use the other system!
Ways of getting a good “quick-website”!

If I were to keep track of the questions about websites I get all the time, this would almost certainly be one of the top ones. What’s really noteworthy is that everybody wants a website these days. However they are not willing to spend countless of hours learning how to do it, or making it happen. Does this sound like you? Then read on!
jQuery Part 4: AJAX Effects

You can do a lot of AJAX things within jQuery as well. There is a long list of AJAX plugins (77 at the moment of writing) that ranges in useability. This means that anytime you need to have any AJAX effect on your site, you can just use a jQuery plugin and save yourself a bunch of code, making your page a lot lighter and faster to render. Below are some effects that I think is both pretty useful and pretty cool.
AJAX Content
This plugin lets you quickly create an AJAX based page with page functionality. You have the option of displaying a loading message and more and of course what you want to load and where you want to load it. You can also customize the error message visible. Read More »
jTemplates
This jQuery plugin create a 100% javascript based template system. It gives you the normal template features of variables in a nice javascript, lightweight way. Read More »
Currency Conversion
Get a real time currency converter added onto your site with this simple but very useful plugin, allowing you through AJAX to convert the currency to a more convenient one. Read More »
- There are of course a ton more plugins available for jQuery that utilizes AJAX and there are just a teaser sample.
Friday News Quickies
Here are the news of today:
- Apple has released software update 2.1 for the iPhone. It fixed a lot of bugs and is a bug and performance release, not adding new features. I downloaded it earlier today and I really must say it’s a lot speedier and faster in both app launches and backups. Download it through the Download Update button while syncing the phone with iTunes 8.
- If you are developing themes for WordPress it can be great to get some posts set up to be able to make sure you have all possible formatting styles included. WP-Candy has made a great post xml that you can import and use as a sample post to demo your styles and see that you have every bit in there.
- A big shoutout congratulations to great guy R.C and his wife Jenn who at Thursday morning had a adorable baby – Sabine Annabel Concepcion. Talk about being born to some community eh
All kidding aside, all well wishes and congrats to RC and Jenn!
jQuery Part 3: Introduction Screencasts

So, you’ve taken a liking to jQuery by now and are looking to dive in and do some coding of your own. Well, here are two good Intro videos to how to write jQuery code from Chris Coyier from CSS-Tricks. It touches base on how to do the base coding that you’ll need to understand and master before moving onto more advanced code. So all I’m going to do today in the jQuery series is send you to watch those videos and learn a little bit about jQuery coding before we more through with some more plugins!
jQuery Part 2: Why use it?

I got quite a few questions about why you want to use jQuery after the article I ran yesterday about the editease plugin for jQuery. I thought I should address those here in part two and explain why you’d want to use it.
Recapping, what is jQuery?
jQuery is a javascript framework that allows you to develop plugins with, essentially cool and useful effects. Naturally you can just download any of the vast amount of plugins that are available and use on your site, which brings us to another advantage. A lot of the code don’t need to be rewritten again and again in the scripts, because that’s in the framwork. So in essence, it’s a great way to style up your site using javascript effects.
Why should I use it then?
Well as I’ve said, it does allow you to add creative effects through javascript but not only creative and good looking effects. You can also add useful boxes, form validations, site editing (like I talked about yesterday), really simply through the plugins of a framework. If you’re a developer you can of course write your own functions much simpler than it would be if you were to write everything from dead scratch. This is something every user benefits from in the case that you don’t need to load a ton of scripts onto a website that are writing the same base code all over, which brings us onto another important thing. The whole framework itself is really lightweight.You are not really adding a lot of page weight with the framework.
Another big pro of using a popular framework is the wide range of plugins available. jQuery is a very big framework and has a super plugin repositry, where you can find a whole whole lot. If you are looking for AJAX effects, you’ll find it. If you happen to be looking at basic content management, you’ll find that too.
Now, there are other javascript frameworks out there such as Prototype and Mootools. It’s a lot of a personal thing. I’m a jQuery guy and I like how it’s built and therefore I use it.
jQuery Part 1: Content management

jQuery is a very good and stabile javascript framework that has loads of plugins available which will do everything between heaven and earth. I’ve decided to be running an article series about it for just that reason. When checking the repositry for plugins out a bit yesterday I found some really cool jQuery scripts and one was a clever one to do with content management.
Granted though it isn’t a dabatase solution and neither is it meant for very large scale sites but for smaller sites that just need to update the content online, this script will work wonders. It’s called EditEase and is a free download. Being built on the jQuery javascript framework, that and Thickbox is really all you need to have included for this to work. There is also a multiple file uploader available in the script with the need for SWFupload script.
What EaseEdit will let you do is define areas of certain pages of your site that are editable using the script online. The editing interface is really slick and all is really stylish and easy to use. It’s even got the FCKEditor embedded in the full edit screen!
Go and check out the demo of the script and play around with it and I think you’ll find that you’re going to like it quite a bit.





