PHP navigation

NamecheapNamecheap
Watch

Neone

New Member
Impact
0
Hi everyone :)
I'm the site owner of UvPucko.com.
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?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
 
0
•••
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
 
0
•••
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) :red:

Got it working at last :)

Had to put - $dim = ($_REQUEST['id']); before the IF statement before it would work.

-=Scozia=-
 
Last edited:
0
•••
theres a smoother way to do that using a switch statment

PHP:
switch ($_GET['action'])
{
    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
 
0
•••
try this...

PHP:
<?php
$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
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back