Replacing Frames

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
blacksaibot
Forum Newbie
Posts: 3
Joined: Tue Apr 12, 2011 12:16 pm

Replacing Frames

Post by blacksaibot »

I've been trying to code my way around frames. I loved frames when they were the thing to use.
So yeah, creating "fake" frames is what I've resorted to and via PHP.

Here is my code:

Code: Select all

   <div id="menubar">
    <?php
     if (!$_GET["menu"]) {
      //in the case that no site was specified, include index.html
      include "menu_mk1_story.html";
     } 
     else {
      include $_GET["menu"].".html";
     }
    ?>
   </div>


   <div id="mainpage">
    <?php
     if (!$_GET["site"]) {
      //in the case that no site was specified, include index.html
      include "main.html";
     } 
     else {
      include $_GET["site"].".html";
     }
    ?>
   </div>
The INDEX.HTML contains that code.
My CSS files determines the height/width and other properties of the two DIV tags.
In firefox, it works perfectly. But, AS USUAL, internet explorer is the one screwing this up for me. IE is merging my two DIV tags into one single DIV.

Now, I am also having problems doing the whole "one hyperlink opens two pages"
I've attempted this method:

Code: Select all

<a class="headlinks" href="/index.php?menu=menu_mk1_arenas" onclick="location.href='/index.php?site=arcade/mk1/mk1_kombatants';return false;">Arenas</a>
It works fine in FireFox, and I think I'll have to stick with it for now.

But if anyone can please help me out I would appreciate it. Is there a better alternative to frames and to what I'm attempting here? I'm new to PHP, so please try to talk laymen's terms with me thanks

I've done a little bit of research and found this method:

Code: Select all

<table cellpading="0" cellspacing="0" border="0" width="865">

    <tr>
     <td align="left">
      <?php
      include ('header.php');
      ?>
     </td>
    </tr>


    <tr>
     <td align="left">
      <?php
      include ('main.html');
      ?>
     </td>
    </tr>

    <tr>
     <td align="left">
      <?php
      include ('footer.php');
      ?>
     </td>
    </tr>

   </table>
My next question is how can I make links open in certain "frames" (or certain includes) - not sure of the correct terminology.
danwguy
Forum Contributor
Posts: 256
Joined: Wed Nov 17, 2010 1:09 pm
Location: San Diego, CA

Re: Replacing Frames

Post by danwguy »

You can try to use an if statement in the header of your index.php file to say that if IE then use a different css file and inthat css file give margin-top to your lower div so that they are seperated. as far as opening two pages with one link, try using "_blank" for target on one of them, because it looks they are both trying to open up in the same window causing problems.
blacksaibot
Forum Newbie
Posts: 3
Joined: Tue Apr 12, 2011 12:16 pm

Re: Replacing Frames

Post by blacksaibot »

danwguy wrote:You can try to use an if statement in the header of your index.php file to say that if IE then use a different css file and inthat css file give margin-top to your lower div so that they are seperated. as far as opening two pages with one link, try using "_blank" for target on one of them, because it looks they are both trying to open up in the same window causing problems.
I'm aware of _blank, and that does not solve the issue at hand.

I'm basically making a index.php that will never change (because it contains drop down menus that EVERY single page in my website will use)

The second part of the index.php will include another menu that changes depending on where you are in the website. So consider that a submenu.

The third part of the index.php will contain all the content, which is what I call main.

If I click a link in the main section, it will not only change the contents of main but also the contents of the submenu - all while not changing the drop-down menues within index.php
danwguy
Forum Contributor
Posts: 256
Joined: Wed Nov 17, 2010 1:09 pm
Location: San Diego, CA

Re: Replacing Frames

Post by danwguy »

ok I see now, on your link use

Code: Select all

<a class="headlinks" href="/index.php?menu=menu_mk1_arenas&site=arcade/mk1/mk1_kombatants">Arenas</a>
That should fix your problem with the two links on the same page as $_GET will be able to get both of those values and change everything (both site and menu) based on that url. You can use multiple values in one url just seperate them with & ie, index.html?value1=1&value2=1&value3=1 then in index.html you can use $_GET['value1'], $_GET['value2'], $_GET['value3'] and it will retrieve all those values.
Hope I'm understanding right
blacksaibot
Forum Newbie
Posts: 3
Joined: Tue Apr 12, 2011 12:16 pm

Re: Replacing Frames

Post by blacksaibot »

You are a SAVIOR. This is exactly what I needed!!! THANK YOU
Post Reply