Page 1 of 1

I get to play the newbie today...

Posted: Sat Jun 05, 2004 6:21 pm
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!

Posted: Sat Jun 05, 2004 6:46 pm
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)

Posted: Sat Jun 05, 2004 7:00 pm
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.

Posted: Sat Jun 05, 2004 8:09 pm
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 ^_^

Posted: Sat Jun 05, 2004 8:10 pm
by John Cartwright
http://www.php.net for all your php needs.