Noobie Menu Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wulfgen
Forum Newbie
Posts: 1
Joined: Thu Feb 12, 2009 7:26 pm

Noobie Menu Question

Post by wulfgen »

:?: I just spent about 20min searching for something related but I cant find anything close.....

I have a layout/design called index.php - on that page I have an include for the menu (include menu.php) on the left

There is a column where I have another include (home.php) with just the home text/images etc on that page -

What I'm stumped at is: where the menu calls another page EG:about.php (all it has on it is the info and the company image) can it load into the index page, where the current (home) include is, do I need to put it in a named div? Or something like that so the menu calls to the other page to replace the current content....

That way all I have to do is just generate the page without the need to constantly regenerate all the layout and graphics....

Is there an easy way to do that?

This is some of my first attempts at php - normally I do JS or html calls...

I tried adding this to the index -

Code: Select all

<?php
if (! file_exists("$index.php"))
{
include("home.php");
}
else
{
include("$index.php");
}
?>
and on the menu I used this;

Code: Select all

<a href="index.php?page=test;"><span>Test Item</span></a>
the test file is called test.php

It does'nt seem to work - is this code way off base?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Noobie Menu Question

Post by josh »

Where is $index coming from and you should also filter user input before you include on it. What if a hacker went to ?file=../../something/secret.password
Post Reply