Hi,
Here’s an interesting one, that I can;t figure out at the moment,
If I have an index template (Homepage) that changes it’s content using iframes, how do I get the {segment_1} of the parent of the iFrame?
UKFreelancer.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
April 18, 2012 3:47pm
Subscribe [3]#1 / Apr 18, 2012 3:47pm
Hi,
Here’s an interesting one, that I can;t figure out at the moment,
If I have an index template (Homepage) that changes it’s content using iframes, how do I get the {segment_1} of the parent of the iFrame?
UKFreelancer.
#2 / Apr 26, 2012 7:53pm
Not sure exactly what you mean but a long time ago I needed to integrate EE with 3rd party affiliate content pagess using a iframe. The only way I could manipulate iframe content was to wrap it in a channel entries tag, the update the iframe src by using a custom entry field which contained the actual iframe URL:
{exp:channel:entries channel="something"}
<iframe src="{channel_custom_url_field}"></iframe>
{/exp:channel:entries}#3 / Apr 28, 2012 9:15am
In short, you can’t. The page loading into the iframe is a separate page, and when the server parses that page it has no notion of even being in an iframe.
What you could do is pass {segment_1} as a new segment to the src url that you load in the iframe. seomething like:
<iframe src="/template_group/template/{segment_1}"></iframe>That would make segment_1 in the “outer frame”, segment_3 in the iframe.
But… Don’t use iframes. 😉
#4 / May 08, 2012 6:09am
Thanks for advice,
All sorted now and the solution is using iframes. Quite impressed with it actually, but being an Extranet, the outside world won’t see it :-(
UKFreelancer.