-
3
pages
-
English
-
Documents
Description
PHP Tutorials Written By Peter Kelly Navigation http://www.peter-kelly.me/ In this tutorial we will look in detail into how to use PHP to include content into the main homepage. This can be used to as an alternative to an iFrame and can be used to help save disk space and allow easier updating of common areas by only having to edit one page. I will also touch on a simple So let’s start first we must create an array which will hold all the page locations and page names. The format will be “page_reference” => “page_location”, Which in turn would make the url show as index.php?page=page_reference $pages = array("homepage" => "main.php", "about" => "about.php", "contact" => "contact_us.php", "404" => "error.php"); So following that format you are able to add as many pages as you want. There is also another advantage of using this method as just referencing the pages directly as if there were no checks to see whether the page is allowed to be public this way then this can be exploited to include other files not authorized so this is vital to help maintain security and lower risks. Next we will set some variables; $default_choice This is used when ?page= in the url is not set. This is the page reference as it will still check the page against the array we created earlier. $current_choice Using the $_GET array we will retrieve from the url the ?page= variable and using strip_tags command we will remove any coding tags which could be used to ...
-
Publié par
-
Langue
English