Can PHP load a page containing specific content into an iframe? - php

I have an internal page on my site that contains an iframe. The content inside the iframe consists of 3 pages, a.htm, b.htm, and c.htm. By default, a.htm loads when I visit the page containing the iframe.
On the homepage of my site, there are 2 links...one links to content on b.htm, the other to content on c.htm. So when one of these links are clicked, I need to load the page on my site that contains the iframe, with either b.htm or c.html showing inside it, depending on which link was clicked.
I know basic PHP, but I'm struggling to find a way to pass the iframe content into the frame from an external page. Or would jQuery be better suited for this? I've looked through a lot of submissions about this, but haven't found an answer that works for me yet. Any help would be greatly appreciated.

Related

One single Link that will open a seperate page and specific iframe

I got a situation here. I have a main page and a subpage. The subpage does have an iframe container and there are two pages test1.htm and test2.htm that are loaded into that iframe when your current page is "subpage.htm".
However, what I want to to, is to be able to click on a link on my main page and it opens up the subpage and automatically loads a predefined page, lets say test1.htm into the iframe.
I got the function to load a page into an iframe and I though by using JavaScript and some code this was possible. Unfortunately, I couldn't figure out a way to do this.
function link {
url = '../subpage.htm';
document.target = url;
loadintoiframe(myiframe,test1.htm);
}
I got the function loadintoiframe, it needs the name of the iframe and the page to load.
When I call the function link() as a href link on the main page, it does load the subpage, but it does not load the iframe correctly.
Maybe someone can help me out?
Why not just put
Link
And avoid the JavaScript at all?
So this does not work.
I tried to go for a JavaScript Method that just does a href basically and then calls the method that loads my special page into that iframe on the href site.
That did not work, so anyone else got a clue how I can href a different .htm site and simultaniously tell that site to load a certain page into the iframe?
Best regards,
Alex

Can I load a domain in my iFrame and when you click a link, it opens in the parent window, not the iframe?

Similar to Stumbleupon, if you load random domains (ones that I do not own) and want to have the links within that page not just change within the iframe, but change on the parent url.
If that's hard to understand here's more layman terms:
URL: mywebsite.com/reddit.com
opens iframe on my website showing: reddit.com
click link within the iframe (showing reddit.com).
rather than it loading the new page in the iframe, can it load in the parent window at mywebsite.com/reddit.com/newlink
which would then open the iframe in my website, but would allow me to track what URL is being view and thus allowing me to perform my site-specific functionality.
Thanks!
in short, it cant happen. external sites are made to open links relative to their sites. there is no way to accomplish this.
you can set the link target to _top. <a href='www.someothersite.com' target='_top'>Link</a>
edit: Sorry, mis-read something. You can not edit the page on the other site through the iframe to change the target of the links. This is why on places like google images or stumbleupon they have an "X" in the corner that takes you to the page in the iframe.
If you could modify external pages, that would be a major phishing security risk as anyone could then make a page that is just an iframe to your bank but collects whatever you type into the username/password boxes.
In the old days if you made a page with frames you could specify what section your links took you to. Modifying links that aren't under your control is possible but rather a task and a half.
To use frames you could specify your target= within your tag. Each frame is named on creation to make it easy.
That's an old approach. Hope it helps

Using lightbox within iframe

I am getting some issue. I have a page, which is being called through a iframe on the parent page, and that page contains lightbox. When the lightbox is being called, that is being opened within the iframe.
Is there any process, that the lightbox can appear using the entire screen, rather than covering the iframe?
I am using php, jquery.Hope I could make you understand my problem.
Thanks in advance.

is there a way to have a iframe not reload the page?

I have a page that opens in a modal on a joomla site. On that page, there is a hyperlink that links to a file on the server. That file opens up a joomla article. What normally happens when I have an a hyperlink on one article that links to another article is that only the content of the article displays in the modal, not the framework. But since I have the hyperlink forwarding to the file with the iframe, when it shows that article in the modal, it show the framework. Is there away to have the article show only the content, and not the framework while still having the iframe? I hope this question makes sense. You can see what i am talking about on this link, click on game template:
http://zaazoo.thewebbusters.com/index.php?option=com_content&view=category&id=1&Itemid=2
if you go to this link, and click on round 1, and then hit continue, you would see how the articles display only the content and not the frame work.
http://zaazoo.thewebbusters.com/index.php?option=com_content&view=category&id=8&Itemid=4
any help would be much appreciated.
Thank you,
Dave
If you want to show just the article you can add &tmpl=component to the URL you are trying to display.
this might not be the best solution but i would recommend using a PhP include like :
<?php include("your-post.html"); ?>
Since joomla is php based this should work, and unlike iframes includes will take the theme of the site or modal.
Hope this Helps :)

target a specific page in iframe

I'm running the CMS indexhibit, indexhibit uses an iframe to load it's content.
http://www.therussianfrostfarmers.com/
My homepage has WordPress loaded into this iframe, which works ok, i've got some scrollbar issues, but that another problem.
Currently, when ppl find a WP post through there search engine, the user is redirected to the homepage, i need to do this otherwise the user would only be able to view the WP content and not the rest of the site aswell.
e.g ;
http://www.therussianfrostfarmers.com/oldspeak/?p=480
What i need to do is to split the querystring, and send an 'id' into the iframe, which inturn would load the appropriate WP page inside the iframe.
I'm not sure where to start, Would i use PHP to split the querystring? and Javascript to target some iframe properties?
....any help would be much appreciated
thanks Cam
You might not have to split the query string. You could just use PHP to get the value of that GET variable, for instance:
$_GET["p"]
would equal 480 for the request http://www.therussianfrostfarmers.com/oldspeak/?p=480
then, you could just use the properties of the iFrame to change what it requests. I believe that the URL that the iFrame seeks is set in an HTML attribute. So you could just set the iframe URL to
http://www.yourwordpresssite.com/?p=<?php echo $_GET["p"]; ?>
Or a similar method.

Categories