Jump to content

[Need help, please] PHP for beginner


kelly8

Recommended Posts

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

Hello,
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
Kelly
Link to comment
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)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.