简体   繁体   中英

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. eg ; 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM