Re: similar page replication

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux