Jump to content


Photo

Convert frames to tables


  • Please log in to reply
4 replies to this topic

#1 DJ Judas

DJ Judas
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 30 March 2006 - 07:37 PM

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:
<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>

And this is the code I'm trying to replace it with:
<?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>';
?>

Any help would be much appreciated.

Thanks.

#2 kayess2004

kayess2004
  • Members
  • PipPip
  • Member
  • 18 posts
  • LocationAustralia

Posted 30 March 2006 - 09:37 PM

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...

this is my index.php page
<!-- 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>

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
Chuck Norris doesn't know love. Chuck Norris only knows not kill.

#3 DJ Judas

DJ Judas
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 30 March 2006 - 09:47 PM

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:
<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>';
?>

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.

#4 kayess2004

kayess2004
  • Members
  • PipPip
  • Member
  • 18 posts
  • LocationAustralia

Posted 30 March 2006 - 10:15 PM

[!--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) View Post[/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

Chuck Norris doesn't know love. Chuck Norris only knows not kill.

#5 DJ Judas

DJ Judas
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 31 March 2006 - 03:07 AM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users