Jump to content

Recommended Posts

Hi all,

I am new at this forum and first off all sorry for my bad english, i am dutch.
My name is Anthony and learning php which goes well (besides now).

My question might be simple to some of the guru's here but i cant find the answer to it.

How can i create a navigation that calls the index + the page. Like index.php?page=start

Can someone tell me?

Thank you.

Anthony
(droopy)
Link to comment
https://forums.phpfreaks.com/topic/7469-php-navigation/
Share on other sites

[!--quoteo(post=365031:date=Apr 15 2006, 10:03 AM:name=droopy)--][div class=\'quotetop\']QUOTE(droopy @ Apr 15 2006, 10:03 AM) [snapback]365031[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hi all,

I am new at this forum and first off all sorry for my bad english, i am dutch.
My name is Anthony and learning php which goes well (besides now).

My question might be simple to some of the guru's here but i cant find the answer to it.

How can i create a navigation that calls the index + the page. Like index.php?page=start

Can someone tell me?

Thank you.

Anthony
(droopy)
[/quote]

lookup GET

[!--quoteo(post=365033:date=Apr 15 2006, 10:07 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Apr 15 2006, 10:07 AM) [snapback]365033[/snapback][/div][div class=\'quotemain\'][!--quotec--]
lookup GET
[/quote]

[code]

<?php$prefix = '/path/to/file/myPrefix.';$postfix = '.inc.php';$defaultPage = 'home';$errorPage = '404';$incFile = $prefix . $_GET['page'] . $postfix;$default = $prefix . $defaultPage . $postfix;$error = $prefix . $errorPage . $postfix;if(file_exists($incFile)){switch($_GET['page']){case 'home':case 'about':case 'contact':include_once $incFile;break;case '':@include_once $default;break;default:@include_once $error;break;}}else{echo '<h1>Page Not Found: 404</h1>';}?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/7469-php-navigation/#findComment-27206
Share on other sites

[!--quoteo(post=365033:date=Apr 15 2006, 10:13 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Apr 15 2006, 10:13 AM) [snapback]365033[/snapback][/div][div class=\'quotemain\'][!--quotec--]
lookup GET
[code]

<?php$prefix = '/path/to/file/myPrefix.';$postfix = '.inc.php';$defaultPage = 'home';$errorPage = '404';$incFile = $prefix . $_GET['page'] . $postfix;$default = $prefix . $defaultPage . $postfix;$error = $prefix . $errorPage . $postfix;if(file_exists($incFile)){switch($_GET['page']){case 'home':case 'about':case 'contact':include_once $incFile;break;case '':@include_once $default;break;default:@include_once $error;break;}}else{echo '<h1>Page Not Found: 404</h1>';}?>
[/code]
[/quote]

[code]
When the menu contains a link like:

main.php?main=navigation

The code in main.php might look like this:

<?

$dir = "pages/";

if (isset($_GET['main'])) {
$filename = $dir.$_GET['main'].'php';
if (file_exists($filename)) {
include $filename;
exit;
}
}

include "{$dir}default.php";

?>
[/code]

[a href=\"http://www.webmonkey.com//99/25/index2a.html\" target=\"_blank\"]http://www.webmonkey.com//99/25/index2a.html[/a]


this will teach you it all good luck
Link to comment
https://forums.phpfreaks.com/topic/7469-php-navigation/#findComment-27208
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.