/    Sign up×
Community /Pin to ProfileBookmark

Page content based on parameter

Does any one know of a small script that chooses a section from a parameter.

For example

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

<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

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@JayMMay 13.2007 — <div id="section">
[code=php]

$content = $_GET['content'];

if ($content == "section1")
{
echo $section1;
}
[/code]

</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.
Copy linkTweet thisAlerts:
@danpoultonauthorMay 13.2007 — Thaks for you're very quick reply but i'm very new to PHP could any one supply me with a full code please.
×

Success!

Help @danpoulton spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...