...

View Full Version : New to CSS, have a general question



700lbGorilla
08-18-2005, 03:05 AM
Okay, been trying things out in CSS to form a layout. I have my main content div, all the things that will be displayed in this div is php. My question is, when users click navigation links in my page, can a div load html or php pages in to the main div, or do I have to break the page into a header.inc/footer.inc and on the other pages tpe my code and include those files accordingly? Hope this makes sense...trying to basically see if you can load pages into the div or do you basically have to use a template system.

dweed-Ly
08-18-2005, 03:45 AM
You could do that by put this code in your main <div> and modify if you need.

<div id="main">
<?php

if (!isset($_GET['page'])) $page="welcome" ; else $page=$_GET['page'];
switch ($page){
case 'welcome' : include ('welcome.php'); break;
case 'link' : include ('link.php'); break;
case 'contact' : include ('contact.php'); break;
}
?>
</div>

1- You must have these files first : welcome.php, link.php, contact.php
2- when your user open your web site, welcome.php is automaticaly include in the main <div>
3- if your user click on the link in the navigation bar, the link.php page is include in the main <div>, so replace the welcome.php
4- the url of the link in you navigation is : <a href="index.php?page=link"></a>
5- the url of the contact in you navigation is : <a href="index.php?page=contact"></a>
6- index.php is the main file of your web site.

Hope this could help you,

700lbGorilla
08-18-2005, 05:46 AM
That worked exactly, pretty easy solution too!

One more question, if the content that gets loaded has a link. Do I just add more cases or would it get more complicated than that?

Say I load a page that displays thumbnails in the main area. If you click a thumbnail I'd want it to go to that persons profile, in the main area. Not good at grasping those type of concepts yet. Seems to me I'd have way to many if statements.

dweed-Ly
08-18-2005, 06:36 AM
One more question, if the content that gets loaded has a link. Do I just add more cases or would it get more complicated than that?

Yes, in the index.php just add more cases as you would like and the link in the loaded page is :
<a href="index.php?page=thumbnail">Thumbnail</a>

Good luck

700lbGorilla
08-18-2005, 07:41 PM
Will it start getting more complicated as more links are created, some are dynamically created from php, like usernames and etc... Think template would be better?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum