Re: similar page replication
| From: | Shawn McKenzie | Date: | Thu, 26 Mar 2009 20:05:33 +0000 |
| Subject: | Re: similar page replication | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290713@lists.php.net to get a copy of this message | ||
PJ wrote:
> I have a series of pages to display that are all exactly the same,
> except for a couple of small changes like 1 number that needs to be
> changed for a mysql_query, the title of the page, and the page_name.php.
> I am wondering how these changes could be implemented when clicking on
> an href link? Is there some way to redirect the link to another page
> which would then $_GET['the_link'] and then pass the related info as
> $strings to another page (a sort-of master page) that would then display
> the results? I can visualize the solution, but is it possible? This
> would avoid repeating the same page some 30+ times.
>
Just use one page if you don't already have the 30 pages. Something
like this maybe (needs lots of work, just an example):
index.php
<?php
switch ($_GET['page']) {
case 'page1':
$sql_num = 1;
$page_title = 'Page 1';
break;
case 'page2':
$sql_num = 2;
$page_title = 'Page 2';
break;
}
echo $page_title;
//do some sql query using $sql_num
?>
Then the links on your page would be index.php?page=page1 etc...
If you have multiple pages, then in the switch set a $filename and then
after the switch include($filename).
--
Thanks!
-Shawn
http://www.spidean.com