DJ Judas Posted March 30, 2006 Share Posted March 30, 2006 Hi there,I currently run a site which uses frames (I know I know, bad Idea.....didn't know at the time).[a href=\"http://www.sfsworks.com\" target=\"_blank\"]http://www.sfsworks.com[/a]I have been trying for some time, with an almost non-existant knowledge of PHP to convert the main frame in my site into a table so that I can use those pretty 'index.php?location=' markings and generally move away from the use of frames.I cannot get it to work though and am completely out of ideas about what might be going wrong (probably most of the code I'm trying to use).here is the code I currently use for my frame:[code]<tr> <td colspan="12" rowspan="9" bgcolor="EBEBEB"> <!-- Content --> <iframe src="home_info.php" name="content" frameborder="0" width="100%" height="100%" allowtransparency="true"></iframe></td> <td> <img src="images/spacer.gif" width="1" height="166" alt=""></td> </tr>[/code]And this is the code I'm trying to replace it with:[code]<?PHP$location=$_GET['location'];if (empty($location)) {$location='index.php';}changelocation($location);function changelocation($location) {echo '<table colspan="12" rowspan="9" bgcolor="EBEBEB>';echo '<tr>'; <!-- Content -->echo '<td width="224" bgcolor="EBEBEB" border="0" width="100%" height="100%">';switch ($location) { case '': include ('home_info.php'); break; case 'mixes': include ('mixes_info.php'); break;}echo '</td>';echo '</td></tr></table>';?>[/code]Any help would be much appreciated.Thanks. Quote Link to comment Share on other sites More sharing options...
kayess2004 Posted March 30, 2006 Share Posted March 30, 2006 Hi DJ,I think you are probably going down the wrong track with tables too.You should probably look at using CSS.Anyway here is what I usually do...[b]this is my index.php page[/b][code]<!-- all the html header stuff goes here --><div id="content"><?php if(isset($_GET['page'])) include('includes/' . $_GET['page'] .'.inc.php'); else include('includes/main.inc.php');?></div>[/code]Just create a CSS tag called #content to place the content where youwant it, and whenever the $_GET['page'] is passed to the browser itwill be included. (ie index.php?page=about, would include "includes/about.inc.php").Hope this helps a bitSteve Quote Link to comment Share on other sites More sharing options...
DJ Judas Posted March 30, 2006 Author Share Posted March 30, 2006 Thanks for the reply, I shall use that method if I cannot get the table to work correctly soon I think.I have been told to do it this way by making the table like this:[code]<tr> <?PHPecho '<td colspan="12" rowspan="9" bgcolor="EBEBEB" valign="top">'; echo '<table border="0" width="100%" height="100%" valign="top">';switch ($page) {case "mixes":include('mixes_info.php');break;case "links":include('links_info.php');break;case "graphics":include('graphics_info.php');break;default:include('home_info.php');}echo '</table></td>';?>[/code]This works and now displays the pages correctly when uploaded, but I have another problem now which is baffeling me: The link colours on my pages have changed now I am loading the pages through php.My hyperlinks have changed from being the colour set in each seperate .php file. They all change to the same colour as the table background, and nothing I do can stop it.I've no doubt it's just a simple problem that someone will say 'oh you just have to do this...' and it will be fixed. Quote Link to comment Share on other sites More sharing options...
kayess2004 Posted March 30, 2006 Share Posted March 30, 2006 [!--quoteo(post=360168:date=Mar 31 2006, 07:47 AM:name=DJ Judas)--][div class=\'quotetop\']QUOTE(DJ Judas @ Mar 31 2006, 07:47 AM) [snapback]360168[/snapback][/div][div class=\'quotemain\'][!--quotec--]I've no doubt it's just a simple problem that someone will say 'oh you just have to do this...' and it will be fixed.[/quote]Hi again,Oh you just have to do this :-)If you have a different style sheets for your include pages the main (index.php) style sheet will overridethem. You might want to look at that.HTH Quote Link to comment Share on other sites More sharing options...
DJ Judas Posted March 31, 2006 Author Share Posted March 31, 2006 Thanks a lot kayess.I got the tables working and the link colours sorted thanks to your help, but ofcourse there's another problem now lol.I'm using cutenews, and whenever the add comment page is brought up ofcourse the comment form uses tables, and my table doesn't like having other tables inside it, and breaks / expands, causing havok to the layout of the page.I was under the impression that you could have a table inside another table as long as it was smaller than the outer table. 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.