TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,245
  • Total Topics: 21,354
  • Online today: 565
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 165
  • Total: 166
  • @rjen

TP Articles using iframe Questions/Help

Started by GreenX, April 01, 2009, 05:29:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GreenX

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!


G6Cad

If you do a bit of search you will find several topics about the same question.

GreenX

#2
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?

Ken.

#3
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
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

ZarPrime

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 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

GreenX

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>

Renegd98

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.

GreenX

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?

JPDeni


GreenX

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.

This website is proudly hosted on Crocweb Cloud Website Hosting.