Jump to content

Convert frames to tables


DJ Judas

Recommended Posts

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.
Link to comment
Share on other sites

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 you
want it, and whenever the $_GET['page'] is passed to the browser it
will be included. (ie index.php?page=about, would include "includes/about.inc.php").

Hope this helps a bit
Steve
Link to comment
Share on other sites

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>
        <?PHP
echo '<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.
Link to comment
Share on other sites

[!--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 override
them. You might want to look at that.

HTH
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.