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!
I get to play the newbie today...
Moderator: General Moderators
-
TaronWarrior
- Forum Newbie
- Posts: 2
- Joined: Sat Jun 05, 2004 6:21 pm
-
litebearer
- Forum Contributor
- Posts: 194
- Joined: Sat Mar 27, 2004 5:54 am
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...
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)
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');
?>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)
- evilmonkey
- Forum Regular
- Posts: 823
- Joined: Sun Oct 06, 2002 1:24 pm
- Location: Toronto, Canada
-
TaronWarrior
- Forum Newbie
- Posts: 2
- Joined: Sat Jun 05, 2004 6:21 pm
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
http://www.php.net for all your php needs.