NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP navigation

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 03-18-2004, 08:40 AM THREAD STARTER               #1 (permalink)
New Member
Join Date: Mar 2004
Location: Stockholm, Sweden
Posts: 4
Neone is an unknown quantity at this point
 



Question PHP navigation


Hi everyone
I'm the site owner of UvPucko.com.
????: NamePros.com http://www.namepros.com/programming/23949-php-navigation.html
We had problems with design because me and I friend had it from the beginning, but now I'm all alone, and I've made a kickass design in Photoshop.
But there's a problem.
I don't want to use frames, it looks less professional.
I want them to view the first page, and when they click on the, i.e links link on the menu the links page will show up. *duuh*

BUT, since I don't want to use frames and I don't want to create a new HTML page for each menu item, I thought I could use PHP.
I've seen a few pages using this feature. Check them out to get a clue of what I'm talking about.

Google
Mandarin.nu

I think the Mandarin page shows it best.
How do I do, or where can I find a tutorial that shows me how to make the navigation like that?
__________________
Limite were made to be broken - No Fear

-=[Facilitate the rave n' trance culture]=-
http://www.UvPucko.com
Neone is offline  
Old 03-18-2004, 12:13 PM   #2 (permalink)
Senior Member
Join Date: May 2003
Posts: 2,187
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
 


Breast Cancer
place your menu into a html file say menu.html

then where you want the nav on the page place this

<? include("menu.html"); ?>
it will then include the nav

or have i misunder stood you and you to use one file with the website in it? if so i have a solution
adam_uk is offline  
Old 03-18-2004, 09:31 PM   #3 (permalink)
NamePros Member
 
Killswitch's Avatar
Join Date: Mar 2004
Posts: 111
Killswitch is an unknown quantity at this point
 



or better yet, heres what i do...

make up your site how you want it, and where you want the content to show up put this...

<?
if (file_exists("$id.php"))
{
include("$id.php");
}
else
{
print("404 $id.php could not be located!");
}
?>

then if say, you want to display music.php in the content area, then you would goto index.php?id=music
Killswitch is offline  
Old 03-19-2004, 04:29 PM   #4 (permalink)
New Member
 
Scozia's Avatar
Join Date: Mar 2004
Location: Edinburgh
Posts: 13
Scozia is an unknown quantity at this point
 



Quote:
Originally posted by Jaysin
or better yet, heres what i do...

make up your site how you want it, and where you want the content to show up put this...

<?
if (file_exists("$id.php"))
{
include("$id.php");
}
else
{
print("404 $id.php could not be located!");
}
?>

then if say, you want to display music.php in the content area, then you would goto index.php?id=music
I was looking to do the same thing but after trying the above all i get is 404 .php not found.

i know the file it's looking for is on the server same directory as index.php but still no joy.

any help appreciated (sp)

Got it working at last

Had to put - $dim = ($_REQUEST['id']); before the IF statement before it would work.
????: NamePros.com http://www.namepros.com/showthread.php?t=23949

-=Scozia=-
Last edited by Scozia; 03-19-2004 at 07:56 PM.
Scozia is offline  
Old 03-20-2004, 04:55 AM   #5 (permalink)
Senior Member
Join Date: May 2003
Posts: 2,187
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
 


Breast Cancer
theres a smoother way to do that using a switch statment

PHP Code:
switch ($_GET['action'])
????: NamePros.com http://www.namepros.com/showthread.php?t=23949
{
    case 
'privacy'// privacy form (index.php?action=privacy
        // Inserts the contents of privacy.html in the current directory
        
include('privacy.html');
        break;
    case 
'contact'// e-mail form (index.php?action=contact
        
include('contact.html');
        break;
    default: 
// default page (index.php with no "?action=")
        
include('index.html');

So then go to index.php?action=contact to load contact etc
adam_uk is offline  
Old 03-22-2004, 09:10 AM   #6 (permalink)
Senior Member
 
viciouscircle's Avatar
Join Date: Mar 2004
Location: Denton, Texas
Posts: 1,781
viciouscircle has much to be proud ofviciouscircle has much to be proud ofviciouscircle has much to be proud ofviciouscircle has much to be proud ofviciouscircle has much to be proud ofviciouscircle has much to be proud ofviciouscircle has much to be proud ofviciouscircle has much to be proud of
 



try this...

PHP Code:
<?php
????: NamePros.com http://www.namepros.com/showthread.php?t=23949
$id 
$HTTP_GET_VARS['id'];
$extension "html";
if ( !
$id || $id == "" )
{ include 
"main.php"; }
else if ( 
file_exists"$id.$extension) )
{ include 
"$id.$extension"; }
else
{ include 
"404.$extension"; }
?>
this way, you dont have to update the code to reflect any pages

links would be index.php?id=file1 to load file1.html, index.php?id=main to load main.html, etc
viciouscircle is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:16 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger