HOME       >>       Programming

Php Question Re Adding A Link inside a top frame


ginginca

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

vujsa

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.

vujsa

TavoxPeru

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,


VIEW DESKTOP VERSION REGISTERGET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.