note 36762 added to function.include

From: Date: Tue, 21 Oct 2003 17:19:26 +0000
Subject: note 36762 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-59048@lists.php.net to get a copy of this message
A simple way to make a easy to manage website would be to do the following: <? if (empty($_GET["page"])) { $page_name = 'pages/default.php'; } else { $page_name = 'pages/' . $_GET["page"] . '.php'; } ?> <html> <head> <title>Dynamic Include Example</title> </head> <body> <!-- Title --> <p>Dynamic Page Example</p> <p><a href="?page=1">1</a> <a hred="?page=2">2</a></p> <hr /> <!-- Dynamic Include --> <? include($page_name);?> <hr /> </body> </html> Now create the directory 'pages' and 3 documents in side it labeled, '1.php', '2.php', and 'default.php'. Finally make shure they do not have any <html><head> and <body> tags in it, just the content. ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36762 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36762&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36762&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59048) next »