I get to play the newbie today...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TaronWarrior
Forum Newbie
Posts: 2
Joined: Sat Jun 05, 2004 6:21 pm

I get to play the newbie today...

Post by TaronWarrior »

Before I begin, I already want to apologize, as this will probably make me look stupid/<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> off people. So, here I go.

I'm looking at learning PHP, but I'm not sure if it's the right kind of code. All I know now is JavaScript and HTML, but I heard PHP was easy. All I really need though is the ability to change things on my site on all the pages at the same time. For instance, the menu up top may say home, x, y, and z. I want to change x to a, but I have like, 50 pages, and in order to change it, I would have to go through each page individually and change it. Is there any code that can help me change it on all the pages at once instead of one at a time?

Thanks, cuz I know this might seem like a really stupid question to some, but I want to know if what I want is even possible before I learn a new language. Thanks!
litebearer
Forum Contributor
Posts: 194
Joined: Sat Mar 27, 2004 5:54 am

Post by litebearer »

PHP allows you to use 'includes' that should accomplish your objective.

ie

file1.php is the file that contains your html for displaying logo etc
file2.php is the file that contains your html navigation code
file3.php is the file that contains your html footer information

sooooo.

in each of your 50+ pagess your do this...

Code: Select all

<?PHP

include('file1.php');

include('file2.php');

// all the rest of your html & javascript etc

include('file3.php');

?>
that makes it so if you change your title/log you only edit the file named file1.php.

the 'file1.php' can contain none, some or just html. javascript, etc depending upon what you want the file contents to do.

Also, you will need to change the extensions of your 50+ files to .php from .htm(l)
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

For something like this, why not just use SSI? (server side include) Should do exactly what you want. However, if you wish to further your knowledge of webdesign and web programming, I strongly suggest learning PHP.

Best of luck.
TaronWarrior
Forum Newbie
Posts: 2
Joined: Sat Jun 05, 2004 6:21 pm

Post by TaronWarrior »

Thanks, both of ya ^_^ I plan on learning PHP now, I just wanted to know if it was the right language I needed. Thanks for both of your help, I gotta get to learning that stuff now ^_^
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

http://www.php.net for all your php needs.
Post Reply