Jump to content

get iframe url into a "if" function on html page not working?"


antonyfal

Recommended Posts

I been going about it the wrong way..

 

the search page is accessed in two ways using 2 different urls:

// this loads the search with all the mainsites pages

main url: www.xxxx.com/xxx/xxxx/xxxx/search.html

 

then in a iframe like this:

//this loads only the search page without the rest of the main page

http:///www.xxx.com/xxx/xxx/xxx/search.html?tmpl=component

i use this in the iframe on the main page.

I need to add the following script to the search page to determin if the "tmpl=component"

is in the url, if it is!? then it must continue to load it-- with this hidden input:

 

<input type="hidden" name="tmpl" value="component"/>  // but my snippets not working.. i dont need the parent url, only the current iframe url

 

heres my code:

 

</head>

<body>

<?php

 

        $url = $_SERVER['REQUEST_URI'];

      echo $url;

        $parts = explode("=", $url);

        If ($parts==component){

<input type="hidden" name="tmpl" value="component"/>

}else{echo "";}

?>

</body>

</html>

Link to comment
Share on other sites

how about...

 

<?php

     //$url = $_SERVER['REQUEST_URI'];
     // echo $url;
     //   $parts = explode("=", $url);
     //   If ($parts==component){
    if(isset($_GET['tmpl']) && $_GET['tmpl'] == "component"){ ?>

<input type="hidden" name="tmpl" value="component"/>

<?php }else{echo ""; }

?>

Link to comment
Share on other sites

Thanks,

But not quite working:

without all the fuss, the hidden input adds the tmpl=component to the url already-- so that i get search.html page without the rest of the index.php page..

 

What im trying to do is to let the search page determin weather it is called by the Iframe or not-- If its called by the iframe the url will have tmpl=component in it and it is neccesary to continue this url with the tmpl=component in it and the hidden input must be displayed-- if there is no tmpl=component in the url, then the search.html page must not load the hidden input..

 

So the link in the iframe == www.xxxxx.com/xxxx/xxxxx/xxxxx/search.html/?tmpl=component  // so now the page know's its in an iframe and will continue to load the hidden input.. if no tmpl=component then the hidden input should not load..

 

The fix you gave me loaded the hidden input on both urls..  :( is it maybe missing something?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.