Forum Moderators: coopster

Message Too Old, No Replies

Show external webpages on the same page

Show external webpages on the same page

         

mvaz

2:14 pm on Dec 8, 2008 (gmt 0)

10+ Year Member



Hello

I have a 3 column php page. The left and right columns have a list of web links to various external websites. The centre column is the content column.

The links on the left and right columns are a result of a mysql database query; the database being made of 3 columns; id, link_url and link_description.

Currently, the links when clicked open the external website on the same window, resulting the current page to be replaced by the newly opened webpage.

What I want to achieve is that when a visitor to this page clicks on any of the links on the left or right, I want the resulting external page to be displayed in the content column.

I know this can be achieved via the use of iframes; but unfortunately, I haven’t got a clue as to how to proceed with this; especially with the links having come from the database query.

Any help and guidance on this matter is highly appreciated.

May thanks - Melwyn

eelixduppy

1:41 am on Dec 9, 2008 (gmt 0)



You have to create a template page. You have the links on the left and right as you said, and then in the middle you fetch the data from the external site and place it there, using, for example, file_get_contents(). The way you'll be able to tell which page to load in the center content section is from URL variables: e.g. http://www.example.com?page=example

You check to make sure that the page is a legit one, and then you grab the contents. Try to implement this yourself and if you get stuck report back here. :)

ag_47

2:24 am on Dec 9, 2008 (gmt 0)

10+ Year Member



Or, when you "echo", or print, your list of links on the left/right columns, include a target tag. (I assume you are using frames?).

So if the center frame/column name is eg. 'main_col', then in your left/right columns you can use:

<a href="http:// ..." target="main_col">abc</a>

to load the page in the center column (ie main_col).

Read more about frames if this sounds like what you need..