Jump to content
xisto Community
ginginca

Php Question Re Adding A Link inside a top frame

Recommended Posts

I have a directory site that someone else programmed for me a couple of years ago. I have been making my own modifications to the script, and generally not running into many issues, since the changes are usually pretty basic.

When a visitor clicks on a category, it takes them to a category page which lists all the sub categories, and under each category is a list of the links in it.

When you click on one of the links, it takes you to a frame page. I have a tiny frame across the top which allows them to stay within the site.

(Q) I would like to add a tiny link in my top frame that says "remove this frame" and it would dynamically link to their site, hence removing the frame.

<HTML><HEAD>  <TITLE><?echo $link_info[1];?> - London Ontario Canada Southwestern Ontario Business Directory</TITLE></HEAD><FRAMESET frameborder="0" ROWS="8%,92%">  <FRAME SCROLLING="No" NORESIZE SRC="header.php?cat=<? echo $cat;?>">  <FRAME SRC="<? echo $page; ?>"></FRAMESET><NOFRAMES><BODY><P></BODY></NOFRAMES></HTML>

Here's an example of the page: http://forums.xisto.com/no_longer_exists/

I hope I have given you enough information to answer my question. Thanks in advance.

Gin
Edited by ginginca (see edit history)

Share this post


Link to post
Share on other sites

Well, you'll need to go ahead and pass that URL to header.php as well as the link.php

It is difficult to say for sure what you need to do without being able to see all of your code. But here is what I image needs to be done:
First in the code you pasted, you'll need to modify one of your urls. Find this:

<FRAME SCROLLING="No" NORESIZE SRC="header.php?cat=<? echo $cat;?>">

and change to:
<FRAME SCROLLING="No" NORESIZE SRC="header.php?cat=<? echo $cat;?>&page=<? echo $page; ?>">

Then in your header.php file, somewhere after the link back to the directory, you'll need to add the link data.

Here is what I'm not sure of since I don't have your code to basically match the style of programming used.

This is the most direct way to do it but you can modify it as you need!
In your header.php file add this after your link back to the index but keep it far enough up to not be hidden.
<a href="<?php echo $_GET['page']; ?>  target='_top'>Break Frames</a>"

In your header.php code, you may have a line that reads something like this:
$cat = $_GET['cat'];

If that is the case, you can do the same with $page if you like.
Just below the line for $cat, add this:
$page = $_GET['page'];

Then your link code would ALSO change to this:
<a href="<?php echo $page; ?>  target='_top'>Break Frames</a>"

I only bring this up because it is most likely the method that was originally used when the script was written.

If this doesn't work, you'll need to post the source code for link.php and header.php so it can be correctly evaluated. Since most of the code you actually posted is HTML, it makes it difficult to answer your PHP question confidently.

Hope This Helps. :D

vujsa

Share this post


Link to post
Share on other sites

The solution that vujsa offers is very simple and powerful, another way to do it i think is by using the location object of javascript, something like this:

<a href="#" onclick="top.location.href='<?php echo $_GET['page']; ?>'">Remove this Frame</a>
Best regards,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.