Jump to content


This topic is now archived and is closed to further replies.


[Need help, please] PHP for beginner

Recommended Posts

[Mods, if this is not the right forum, plese move it and sorry in advance]

I was wondering if any of you could give me some guides on how to use one "main" template to update all pages on my site (instead of updating each page). Can I set up, more than one "main" templates?

For example, if I need to make some changes on left/right/top/bottom side, I only need to make the change on the "main" template and all of the pages will automatically changed.

I heard it could be done using php and modifying .htaccess. Tried to read some guides on the internet and did not really get what I am looking at and I don't really understand it. Could you please give me some guides?

Thank you in advance. I'd really appreciate it

Share this post

Link to post
Share on other sites
Guest WarpNacelle
I'm not sure about any technique modifying .htaccess but an easy method with php is to use the include() function.

For example, what I do,  is have the code for my header, footer and menu in a seperate file.

Then, each content page has the following:

[code]include ('header.php');

include ('footer.php');[/code]

You just put the include() line where you want the code to go and PHP inserts that code right there.  So if you wanted to change your site-wide header, you just edit the "header.php" file.

(On a side note, they don't have to be .php extensions.  It can be .html or even .inc - for include)

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.