pouncer Posted November 7, 2006 Share Posted November 7, 2006 I'm using dreamweaver to design my site.I came across this site http://www.evo7ution.com/dentaltrust/whatever link we click on, the link is like http://www.evo7ution.com/dentaltrust/index.php?page=11all the pages are part of the index.php how has this been done? i think this is more effecient than having loads of different pagesanyone got any ideas? Quote Link to comment Share on other sites More sharing options...
jwk811 Posted November 7, 2006 Share Posted November 7, 2006 you can add that to the url and use it to do different actions depending on what it is.. you can use a variable there too.. you get the info from the url using the $_GET variable Quote Link to comment Share on other sites More sharing options...
pouncer Posted November 7, 2006 Author Share Posted November 7, 2006 i know thatby doing $_GET['page']but he has like 12 pages within his index.phpim just curious how can i do this in dreamweaver, how do i split the pages upotherwise my index.php will be a massive piece of code Quote Link to comment Share on other sites More sharing options...
littlejones Posted November 7, 2006 Share Posted November 7, 2006 Yes it's done using $_GETEach navigation link would have a particular url in such as <a href="index.php?page=aboutUs" />Then in the code you would put[code]$page = $_GET['page'];if($page == "aboutUs") { //echo the html for the aboutUs page here }elseif($page == "contactUs") { //echo the html for the contactUs page here }[/code]Does that make sense?If you wanted to split it up then you could just do each page as an included file, so put all of the html for the aboutUs page in a aboutUs.inc.php and contact us in contactUs.inc.php and then do the following[code]$page = $_GET['page'];if($page == "aboutUs") { includes("aboutUs.inc.php"); }elseif($page == "contactUs") { includes("contacUs.inc.php"); }[/code]In which case you may have well just have made each page separately anyway. :P Quote Link to comment Share on other sites More sharing options...
jsladek Posted November 8, 2006 Share Posted November 8, 2006 Here is an example of how I am doing it.[code]if ($pg != "doctor_visits" && $pg != "insulin_pump" && $pg != "messages" && $pg != "rest" && $pg != "rest_food" && $pg != "tbl_events" && $pg != "user_data" && $pg != "user_data_options" && $pg != "user_passwords" && $pg != "user_table"){$pg = "main";} if ($pg == ""){ $pg = "main"; } $page=$pg.".php"; include($page) ;[/code]Now that I look at it I can probably dump the if ($pg == ""){$pg = "main";}, it was there before I added the string of $pg !='s due to someone here being nice enough to show me how easy it is to insert their own code.-John Quote Link to comment Share on other sites More sharing options...
pouncer Posted November 8, 2006 Author Share Posted November 8, 2006 yeah mate, that makes more sense to me. thanks alot for clearing that up.but in your first example:[code]$page = $_GET['page'];if($page == "aboutUs") { //echo the html for the aboutUs page here }elseif($page == "contactUs") { //echo the html for the contactUs page here }[/code]you say 'echo the html for the whatever page heredoesn't that mean i still need to have seperate pages on the webserver anyway? Quote Link to comment Share on other sites More sharing options...
me1000 Posted November 8, 2006 Share Posted November 8, 2006 There are tons of ways he could be doing it...Ive ogt something like that where all the pages are stored in a mysql database,but it could also be including a external page Quote Link to comment Share on other sites More sharing options...
jsladek Posted November 8, 2006 Share Posted November 8, 2006 Here is my whole index.php page for you to look @[code]<html><head><title>IOBE - PHP - MySQL </title><link rel='stylesheet' href='styles/style.css' type='text/css' media='all' /></head><table style='width:100%; background-color:#E4E0E0' cellspacing='3' class='topborder'><tr><td style='text-align:left; vertical-align:bottom'></td> <td style='text-align:right'> </td></tr></table><table style='width:100%;' cellspacing='3' id='header'><tr><td style='text-align:left; vertical-align: middle;'><h2><div align="center"><img src='images/logo.png' alt='' /></div></td> <td style='text-align:left; vertical-align: middle;'><h2 align="left"> IOBE</h2></td> <td style='text-align:right'><h2>PHP/MySql code writer </h2></td></tr></table><table style='width:100%' cellspacing='3'><td style='width:20%;'></td> <td style='width:60%;'><img src='images/blank.gif' width='1' height='1' alt='' /></td> <td style='width:20%;'></td></tr><tr><td height="379" style='width:20%; vertical-align: top;'><div class='spacer'><table cellpadding='0' cellspacing='0'><tr><td class='captiontopleft'><img src='images/blank.gif' width='24' height='3' alt='' style='display: block;' /></td><td class='captiontopmiddle'><img src='images/blank.gif' width='1' height='3' alt='' style='display: block;' /></td><td class='captiontopright'><img src='images/blank.gif' width='11' height='3' alt='' style='display: block;' /></td></tr></table><table cellpadding='0' cellspacing='0'><tr><td class='captionleft'><img src='images/blank.gif' width='24' height='18' alt='' style='display: block;' /></td><td class='captionbar' style='white-space:nowrap'>Main Menu</td><td class='captionend'><img src='images/blank.gif' width='12' height='18' alt='' style='display: block;' /></td><td class='captionmain'><img src='images/blank.gif' width='1' height='18' alt='' style='display: block;' /></td><td class='captionright'><img src='images/blank.gif' width='11' height='18' alt='' style='display: block;' /></td></tr></table><table cellpadding='0' cellspacing='0'><tr><td class='bodyleft'><img src='images/blank.gif' width='3' height='1' alt='' style='display: block;' /></td><td class='bodymain'> <span><img src='images/bullet2.gif' alt='bullet' /><a href='index.php?pg=main'>Welcome</a></span><br/><span><img src='images/bullet2.gif' alt='bullet' /><a href='index.php?pg=faq'>FAQ</a></span><br/><!--span><img src='images/bullet2.gif' alt='bullet' /><a href='index.php?pg=messageboard'>Guest Book </a></span><br/--><span><img src='images/bullet2.gif' alt='bullet' /><a href='index.php?pg=downloads'>Downloads</a></span><br/><span><img src='images/bullet2.gif' alt='bullet' /><a href='index.php?pg=install'>Installation</a></span><br/><span><img src='images/bullet2.gif' alt='bullet' /><a href='index.php?pg=sample'>Sample Written Code</a></span><br/><span><img src='images/bullet2.gif' alt='bullet' /><a href='index.php?pg=plans'>Plans for IOBE</a></span><br/><span><img src='images/bullet2.gif' alt='bullet' /><a href='index.php?pg=gpl'>GNU General Public License </a></span><br/><span><img src='images/bullet2.gif' alt='bullet' /><a href='mailto:jsladek@iobe.net?subject=IOBE Application/Script Builder'>Contact Me</a></span><br/><span><img src='images/bullet2.gif' alt='bullet' /><a href='index.php?pg=donate'>Donate</a></span><br/></td><td class='bodyright'><img src='images/blank.gif' width='3' height='1' alt='' style='display: block;' /></td></tr></table><table cellpadding='0' cellspacing='0'><tr><td class='bottomleft'><img src='images/blank.gif' width='10' height='9' alt='' style='display: block;' /></td><td class='bottommain'><img src='images/blank.gif' width='1' height='9' alt='' style='display: block;' /></td><td class='bottomright'><img src='images/blank.gif' width='10' height='9' alt='' style='display: block;' /></td></tr></table></div><div class='spacer'></div></td><td style='width:20%; vertical-align:top'><? if ($pg != "main" && $pg != "faq" && $pg != "messageboard" && $pg != "downloads" && $pg != "install" && $pg != "sample" && $pg != "plans" && $pg != "gpl" && $pg != "donate"){$pg = "main";}if ($pg == ""){ $pg = "main"; } $page=$pg.".php"; include($page) ; ?></td> </tr><tr> <td colspan='3' style='text-align:center' class='smalltext'>This site was created with IOBE.<br /></td></tr></table> <div style='text-align:center'><table style='width:100%'><tr><td style='width:30%; vertical-align:top'> </td><td style='width:40%; vertical-align:top'></td><td style='width:30%; vertical-align:top'> </td></tr></table></div></body></html> [/code]you can see it here live http://www.iobe.net/proj/index.phphere is an example of a page that I include into the index.php by itself http://www.iobe.net/proj/gpl.phpand here it is included http://www.iobe.net/proj/index.php?pg=gplI'm not sure if this is the best way but it seems to work for me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.