Site Changes

Okay.. you may have or may not have noticed that I have made some coding changes to the site, I now have the menu, header, footer and image in seperate files and using PHP Include I have “embedded” them in to the page.

You will notice now that on the main site the photo is chosen at random (out of 4 or 5 photos I think), I like this because it means i can add more photos or change it at a later date.. this is also in a document i am using for PHP include, so if i wanted to add more photos I wouldn’t have to edit every page to do it.

I know, i havent yet changed the theme on my blog and it is “default” i will be getting round to this but at the moment i have more important things to do.. I have had to find time to even write this blog post….

Just to be geeky.. hehe, here are the pages that are used in PHP Include (If you have time to take a look)

Header
Image
Menu
Footer

This means i can change say the “menu.php” document and it will change the Menu on every page…

Also on image.php you will see that it shows a random picture, like it does above the Links bar..  here is the coding that makes that work (It is quite complicated but oh well)

Function ShowRandomPic()
{
/* show a random pic */
$pics = Array();

/* define pics here, start from 0, no gaps between numbers allowed */
$pics[0]["src"] = "cool.jpg";
$pics[0]["txt"] = "Me =)";

$pics[1]["src"] = "fueholiday2007.jpg";
$pics[1]["txt"] = "Fuerteventura 2007";

$pics[2]["src"] = "beer.jpg";
$pics[2]["txt"] = "Enjoying Glass of Beer =)";

$pics[3]["src"] = "bass.jpg";
$pics[3]["txt"] = "Playing bass in Eric's studio";

$pics[4]["src"] = "blue.jpg";
$pics[4]["txt"] = "Niall's blue hair";

/* end of pics */

/* make random number generator more random */
srand((double) microtime() * 1000000);

/* choose a random number */
$i = rand(0, (count($pics)-1));
$img = $pics[$i]["src"];
$txt = $pics[$i]["txt"];

/* output the tag */
echo ""$txt"";

return;
}?>

Its i suppose quite hard to understand for a beginner, for people who understand PHP, they will know what that means.

So yh.. some major changes (mainly PHP Include) and also the “updating picture thing”

Thanks for reading,
Niall =)

Leave a Reply

Your email address will not be published. Required fields are marked *