TinyPortal

Development => Support => Topic started by: GreenX on April 01, 2009, 05:29:17 AM

Title: TP Articles using iframe Questions/Help
Post by: GreenX on April 01, 2009, 05:29:17 AM
Hello,

This may sound super basic but I need help using iframes and TP.

I have a clean install of SMF 1.1.8 with Tinyportal 1.070b3

I have no extra scripts such as .js files or modified my index.template.php file.

I login as Admin and goto to the TP section and create a category.
I create a new article using HTML as base.
I turn off most of all the decorations options.
I use "example" as query title.
in the Editor I use this code


<iframe src="http://www.myownsite.com/example.php" height="1000" width="100%" Scrolling="yes" ></iframe>


I click preview and it works fine, I then go directly to the link using Firefox 3.0.8

http://www.myownsite.com/smf/index.php?page=example

Loads up fine and looks good BUT the issue is when I click a link in the iframe of the example.php that I am being shown it opens up a new window basically making me leave SMF and am at the example site now :(

I want all the links inside the iframe to stay inside the iframe like a mini browser. I read about needing to use <target="_self"> but I dunno.

Is there a simple script I need to create or some HTML code I can wrap around the <iframe> call to make the links not open away from my site but stay inside?

Thanks!

Title: Re: TP Articles using iframe Questions/Help
Post by: G6Cad on April 01, 2009, 07:02:02 AM
If you do a bit of search you will find several topics about the same question.
Title: Re: TP Articles using iframe Questions/Help
Post by: GreenX on April 01, 2009, 07:58:12 AM
I did search and read all the posts for "iframes" but nothing makes sense.

After some more bashing my head I decided to try a different website address:

so I used


<iframe src="http://www.GOOGLE.com/" height="1000" width="100%" Scrolling="yes" ></iframe>


and all the links works perfectly they are staying inside the iframe!

When I got back and use my files from my own site it doesn't work, each link opens outside iframe.

I am thinking it doesn't work for my internal website pages, no idea why.

I moved my file into the \SMF dir and tried the following in a php code block and nothing happens:

Quote
How Do I Embed A Internal/External Webpage?
You can embed a page in a combination of ways using a HTML/javascript or php in blocks or articles.

Basically you have 3 standard types. The php include, the dynamic iframe, or the simple iframe.

The first and best way is to use the php "include" function in a php article or block. It doesn't have scrollbars, and applies the same theme unless otherwise directed in the file. The drawback is that it has to exist in your same SMF directory. This is done by using the following script:

Code:

include('LOCATION.FILENAME');


Replace "LOCATION" and "FILENAME" with the proper information.

Examples:

    * include('/pages/comics.php');
    * include('/pages/biography.html');
    * include('http://tinyportal.co.uk/ssi_examples.html);

Can anyone help me?
Title: Re: TP Articles using iframe Questions/Help
Post by: Ken. on April 01, 2009, 09:39:14 AM
Hi GreenX, welcome to TinyPortal.

You are basically at the mercy of the page your iFrame is pulling it to the frame.

Your iFrame only pulls in the page you've linked to, but it doesn't control the page content... so if a link within the page is set to open in the same frame then you'll stay in the iFrame, but if the link is set to open in a new window then that's what it will do.


If you follow the posting guidelines it will make it easier to help. :)
Please read the Posting Guidelines.html (http://www.tinyportal.net/index.php/topic,581)
Title: Re: TP Articles using iframe Questions/Help
Post by: ZarPrime on April 01, 2009, 02:52:25 PM
GreenX,

the iframe tag does not use the target attribute.  The target attribute is used by the anchor tag.  As Ken said, you are at the mercy of the page you are calling in the iframe as to how it opens links in it's own window.

For instance, let's say that you have an article in your TP that you are showing in an iframe or even without an iframe.  If that article has links in it using the anchor tag then each of those links can use the target attribute so that you can direct how that link is opened (whether it opens in the same window or a new window or a new frame if you are using regular frames).  In other words, this is not something you can control with the iframe tag itself.

If you will Please Read and Reply to the Posting Guidelines (http://www.tinyportal.net/index.php/topic,581) and perhaps even post the html you are using in your example page, we can probably show you how to do what you want to do.  However, here's an example of ways to use the target attribute ...
<a href="javascript:history.back()"><b>Back</b></a>
<br>
<br>
<b>All of these links will open these sites in the same window using no target attribute.<br>
Click the back button on your browser to return to this page ...<br>
<u><a href="http://www.w3schools.com">Visit W3Schools.com!</a><br></u>
<u><a href="http://www.w3schools.com/TAGS/tag_a.asp">Anchor Tag</a><br></u>
<u><a href="http://www.w3schools.com/tags/att_a_target.asp">Anchor Target Attribute</a><br><br></u>
All of these use the target attribute to direct the link where to open ...<br>
<u><a href="http://www.dynamicdrive.com/" target="_blank">Open Dynamic Drive in a New Window using target=blank</a><br></u>
<u><a href="http://www.dynamicdrive.com/" target="_self">Open Dynamic Drive in this Window using target=self</a><br></u>
<u><a href="http://www.dynamicdrive.com/" target="_top">Open Dynamic Drive in this Window using target=top</a></u>


Put this code in an html article and go to that page.  It has different links you can click on and they will open in the same window or a new window depending on which link you click.

The important thing to remember that you can only control where links in a parent article open.  You can not control how links in the child article are opened unless you have setup target attributes yourself in the child articles.

ZarPrime
Title: Re: TP Articles using iframe Questions/Help
Post by: GreenX on April 03, 2009, 05:39:17 PM
Issue still unresolved and I am at a dead end here.

using google.com it works fine, i stay inside the iframe as I navigate ANY link.

<iframe src="http://www.GOOGLE.com" height="1000" width="100%" Scrolling="yes" ></iframe>


using /filemenu/ it loads the menu page fine then when I click ANY link it opens a new window outside of the iframe. This is not what I need it to do.

<iframe src="/filemenu/" height="1000" width="100%" Scrolling="yes" ></iframe>
Title: Re: TP Articles using iframe Questions/Help
Post by: Renegd98 on April 03, 2009, 06:01:10 PM
GreenX, have you read thru the post above this one from other members of TP?  You can NOT control what the page inside your iframe does when IT is calling links from within it's own page. You are at the mercy of the page code that is within the iframe, unless you are the one who has written the code/links within the child page.
Title: Re: TP Articles using iframe Questions/Help
Post by: GreenX on April 03, 2009, 06:20:00 PM
There are my own files on my own web server in a directory called /filemenu/

How do I modify my own files to act like google.com then?
Title: Re: TP Articles using iframe Questions/Help
Post by: JPDeni on April 03, 2009, 06:50:56 PM
What does "filemenu" look like?
Title: Re: TP Articles using iframe Questions/Help
Post by: GreenX on April 03, 2009, 06:54:43 PM
filemenu is structured as:

sofware: eqdkp
/dkp/index.php   loads a menu and tables full of links like a small database.
/dkp/has a bunch of .php files the menu calls on (links) (menu, list members,, view, admin panel, etc)

Attached is the file if needed to understand.
Title: Re: TP Articles using iframe Questions/Help
Post by: JPDeni on April 03, 2009, 06:59:51 PM
Can I see the page -- either index.php or your TP article with the iframe -- in action?

I need to see the links themselves in order to know what's going on. Trying to debug your problem without being able to see what you're talking about is sort of like trying to fix a wristwatch in a completely dark room. It might be possible, but it would be a whole lot easier if we could actually see it. :)
Title: Re: TP Articles using iframe Questions/Help
Post by: maldave on June 24, 2009, 07:22:18 AM
Since you are using EQDKP this is your solution;

http://www.tinyportal.net/index.php/topic,30011.0.html