Jump to content

php navigation


droopy

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.