
Since BlaZe has pointed out his concern I decided to write this as I have gotten a few questions about including files with php or using the language to make a template/site.
Nothing dynamic, just nice and simple. You'll be surprised how easy but its the best way to start:
1) break down your layout into 3 sections:
- HEADER: header.php // contains your title and menu links
- MAIN: main.php // this is the file that contains all your content
- FOOTER: footer.php // contains your copyright and bottom links
2) Since main.php is the actual file that contains your content, simply add the following to it:
- Top of the file add this: <?php include 'header.php'; ?>
- Bottom of the file add this: <?php include 'footer.php'; ?>
3) You should have your main.php file wrapped around and contains a header and footer now. Remember, this will only work if you have a host with PHP enabled. On your website the main.php file will need to be displayed as the page name of your site. This file can be changed depending on the other sections you have such as:
tutorials.php
hosting.php
games.php
etc... just dont forget to include the header and footer (step 2) on each file on your site.
Hope this was helpful! Ask any questions and if you're stuck!
It will be even more useful if you'll give some simple example...
header.php
Sitename.com
footer.php
main.php
<?php include 'header.php'; ?>
Site content goes here, including text and everything else...
<?php include 'footer.php'; ?>
Give it a try and you will have a greater understanding of whats happening. Then you can work on making the layout more stable and become better at interlinking layout files.
And what benefits from doing this?
I've done this (it was quit easy) so what to do next? :)
Btw the main question I wan't to ask is how to set sequrity properties on php files while uploading them on the server? I had problems trying applying perl guestbook... Do I need such things using php?
No PHP is easier to work with than Perl in terms of applying security and permissions!
And regarding the benefits of doing what I showed you above, is the fact that you can just change the header.php and footer.php and it will automatically update all the main site files. So technically, you can change your entire site layout within a few clicks.
It is important to state that applying permissions on PHP files can be done using CHMOD, but I doubt you will need this at this early stage. You only need to set permissions if you're writing to the website and writing on your webserver. E.g. creating images or files/folders on your website from a script.