Click to See Complete Forum and Search --> : Page content based on parameter


danpoulton
05-13-2007, 10:54 AM
Does any one know of a small script that chooses a section from a parameter.

For example

http://whatever.com/page.html?content=section1

<div id="section1"></div>

I know of CMSs that do this but i only need this for a few pages of my site so a small code is all thats required

Thanks

JayM
05-13-2007, 01:10 PM
<div id="section">


$content = $_GET['content'];

if ($content == "section1")
{
echo $section1;
}

</div>

It would work something like the above. Somewhere on your page you would have defined what each section is. Perhaps you are retrieving these sections from a database, or perhaps you have defined them in an include file. When a section is requested in the query string, you output it.

danpoulton
05-13-2007, 02:16 PM
Thaks for you're very quick reply but i'm very new to PHP could any one supply me with a full code please.