Help with multipage layout

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
gurn
Forum Newbie
Posts: 4
Joined: Sat Aug 18, 2007 10:52 am

Help with multipage layout

Post by gurn »

Hello, I'm a bit of a nooble at php and am desperatly looking for some help.

Okay what i am basically trying to do is have 2 div's (or tables) 1 for a sub menu and the other for the content. In the content i want to be able to load 2 different tpl(or php) files for example we'll call them page1 & page2.

Page1 would be the default page shown upon visiting the site, but i would like this page to be dumped and page 2 shown in it's place in the event of a user selecting page 2 in the menu (and of course the menu to be able to call page1 back).

Here's what i came up with, but the menu calls the page for the whole browser not just in the "content div"

Code: Select all

$page = $_GET['p']; 
if (($page == "1") or ($page =="")) { include('../templates/1.tpl'); 
} else if($page == "2") { include('../templates/2.tpl');
}
Thank you for reading my post, i hope you can possibly help me.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Help with multipage layout

Post by superdezign »

You can't actually change just one part of the site without doing it as you are. Maybe you want frames or something.
gurn
Forum Newbie
Posts: 4
Joined: Sat Aug 18, 2007 10:52 am

Post by gurn »

Ah thank you for confirming that for me.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

gurn wrote:Ah thank you for confirming that for me.
Be forewarned... Frames are annoying and becoming deprecated. I'd redesign before I used frames.
gurn
Forum Newbie
Posts: 4
Joined: Sat Aug 18, 2007 10:52 am

Post by gurn »

Ah no worries i had no intention of using frames, i hate frames too. i only wanted to add pages loading in the same main page because i diden't want to add a sub menu each page, see it's a lyrics page and there are 35 pages to make (just being lazy :oops: ).

Thanks once again.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Just submenus? Have you considered JavaScript, then?
gurn
Forum Newbie
Posts: 4
Joined: Sat Aug 18, 2007 10:52 am

Post by gurn »

Isn't java abit slow?
Post Reply