/    Sign up×
Community /Pin to ProfileBookmark

How is this done?

Hi there.
I’ve seen on various sites navigation like [url]http://www.url.com/?mod=about[/url]

How is that achieved?

My old “page.php” which would load i.e. page.php?p=about worked — but how is it achieved with just a ?mod=about

Thanks.

The page.php code:

[code=php]
<?php
if (isset($_GET[‘p’])) {
$p = (strstr($_GET[‘p’], “.php”)) ? $_GET[‘p’] : $_GET[‘p’].”.php”;
if (file_exists($p)) {
include $p;
}
else {
include “index.php”;
}
}
else {
include “index.php”;
}
?>
[/code]

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@PunkSktBrdr01Nov 28.2003 — It works the same way, but the code is in the index page.

"http://www.url.com/?mod=about" is the same as "http://www.url.com/index.php?mod=about".
Copy linkTweet thisAlerts:
@DanUKauthorNov 28.2003 — I presume i'd need to change that code though???

Thanks.
Copy linkTweet thisAlerts:
@JonaNov 29.2003 — [i]Originally posted by skydan [/i]

[B]I presume i'd need to change that code though???[/B][/QUOTE]


[font=arial]Only if you are going to change it from "p" to "mod."[/font]

[b][J]ona[/b]
×

Success!

Help @DanUK 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 4.29,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...