GhettoT
03-01-2007, 07:25 PM
OK, so some may say this is a waste of time to implement, but I have found it to be EXTREMELY useful in debugging code, quickly adding content menus, etc... So here it is.
An easy way to keep all of you content under control is to us some simple PHP. The first aspect I will address is, how to keep all of your menus the same.
Firstly you must have a menu. Now, make a file called menu.php and put that in a directory /php_goddies/ in menu.php you would put all of your HTML that would make up all of your menus.
menu.php
HTML MENU CODE HERE
Now in your index.php and any other page that you want your menu to apear add this code in the place you want your menu to apear.
index.php
<body>
<!-- MENU BEGIN -->
<?php
include 'http://www.EXAMPLE.com/php_goodies/menu.php' ;
?>
<!-- MENU END -->
For this example I put it right at the beginning of my <body>. Now youu don't have to bother opening every single page and editing links into/out of your menu.
Now I will show you another simple way to give your pages names very simply.
So every page has a name that is defined within the <title></title> tags. But if you have another place in your page where you have the page name displayed it can get kind of tiresome to have to go find that part and edit the name. So at the beginning of every page add something like this (variable names may be changed)
<?php
$title = 'Home' ; //Page Name <title></title>
$name = 'Welcome' ; //name on the page
?>
This code will define each page's name. Now in every page in the <title></title> tag add code similar to this.
<title>Website Name -<?php echo $header; ?>-</title>
And then if you have a section where it will say "Welcome" or "About Us" or something you could have code like so,
<b>.::<?php echo $title; ?>::.</b>
These are both very simple things to add to your site, and people will probably wonder why I even posted this. But I thought some people within the community would enjoy reading these quick & dirty tips for a more controlled site...
An easy way to keep all of you content under control is to us some simple PHP. The first aspect I will address is, how to keep all of your menus the same.
Firstly you must have a menu. Now, make a file called menu.php and put that in a directory /php_goddies/ in menu.php you would put all of your HTML that would make up all of your menus.
menu.php
HTML MENU CODE HERE
Now in your index.php and any other page that you want your menu to apear add this code in the place you want your menu to apear.
index.php
<body>
<!-- MENU BEGIN -->
<?php
include 'http://www.EXAMPLE.com/php_goodies/menu.php' ;
?>
<!-- MENU END -->
For this example I put it right at the beginning of my <body>. Now youu don't have to bother opening every single page and editing links into/out of your menu.
Now I will show you another simple way to give your pages names very simply.
So every page has a name that is defined within the <title></title> tags. But if you have another place in your page where you have the page name displayed it can get kind of tiresome to have to go find that part and edit the name. So at the beginning of every page add something like this (variable names may be changed)
<?php
$title = 'Home' ; //Page Name <title></title>
$name = 'Welcome' ; //name on the page
?>
This code will define each page's name. Now in every page in the <title></title> tag add code similar to this.
<title>Website Name -<?php echo $header; ?>-</title>
And then if you have a section where it will say "Welcome" or "About Us" or something you could have code like so,
<b>.::<?php echo $title; ?>::.</b>
These are both very simple things to add to your site, and people will probably wonder why I even posted this. But I thought some people within the community would enjoy reading these quick & dirty tips for a more controlled site...