• Resolved mygrove

    (@mygrove)


    On a WP page (parent) I have a link to another WP page (child). That second page 9child) simply includes an auto-iframe link. So looks something like this:

    [auto-iframe link=”https://www.mydomain.com/cgi-bin/mysearch.pl?show=%5BLINK_ID%5D”%5D

    What I would really like is to be able to do is to pass the parameter LINK_ID from the parent to the child page.

    I can put the auto-iframe code in the parent page, but then it does not include the rest of the content from the child page.

    Can this passing a parameter be done?

    Is there another way of doing this with auto-iframe?

    Or a completely different approach?

    Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Greg Ross

    (@gregross)

    Not really possible as the shortcode is processed and only the resulting html is sent to the browser.

    I guess you could alter the plugin to “add” the parameters from the parent page to the iframe link during the shrotcode processing but I’m not sure if that would achieve what your looking for or not.

    Thread Starter mygrove

    (@mygrove)

    Apologies for posting here my solution outside of Auto-iframe, but in case anyone else needs to do this.

    First step was to revert to the standard iframe but adding a little php, using a plugin “Code snippets”.

    <iframe id="table-iframe" src=https://www.example.com/search.pl?&<?php echo $_SERVER['QUERY_STRING']; ?> style="margin:0; width:100%; height:150px; border:none; overflow:hidden;" scrolling="no" onload="AdjustIframeHeightOnLoad()"></iframe>

    $_SERVER['QUERY_STRING'] brings the query string from the parent page.

    "AdjustIframeHeightOnLoad()" is described in the link below

    Then I was left without the key function of Auto-iframe – automatically adjusting the height to iframe contents.

    The approach described here simply involved adding a little Javascript via the “Code snippets” plugin again, into the page with the iframe and after the iframe is loaded.

    <script type="text/javascript">
    function AdjustIframeHeightOnLoad() { document.getElementById("table-iframe").style.height = document.getElementById("table-iframe").contentWindow.document.body.scrollHeight + "px"; }
    function AdjustIframeHeight(i) { document.getElementById("table-iframe").style.height = parseInt(i) + "px"; }
    </script>

    The iframe id=”table-iframe” is key to linking the two parts together.

    Interested if anyone has a better solution, particularly if the Auto-iframe plugin could be enhanced as suggested.

    • This reply was modified 8 years ago by mygrove.
    Plugin Author Greg Ross

    (@gregross)

    Version 1.4 includes support to pass the parents query to the iFrame.

    Thread Starter mygrove

    (@mygrove)

    I can confirm version 1.4 – passing the query works for me. Thank you.

    Hi

    I used a different approach.

    1.-Install plugin “Code Snippets”. Add new snippet with this code:

    function add_custom_query_var( $vars ){
    $vars[] = “ticketid”;
    return $vars;
    }
    add_filter( ‘query_vars’, ‘add_custom_query_var’ );

    My variable is ticketid. Make sure to activate snippet after creation.

    2.-Install plugin “Insert PHP” and go the page you want to modify Auto iFrame.

    3.-Add this code to page:

    [insert_php] $ticketid = get_query_var( ‘ticketid’ );[/insert_php]

    [auto-iframe link=”https://anydomain.com/any/view.php?ticketid=%5Binsert_php%5Decho $ticketid;[/insert_php]” tag=10 width=100% height=100% autosize=yes]

    4.-Go to your page:

    https://anydomain.com/yourpage/?ticketid=123456

    Its done

    Plugin Author Greg Ross

    (@gregross)

    @quantiko2000 I would not suggest that method as the processing of shortcodes inside of other shortcodes is problematic at best and not guaranteed to work.

    I have a page at mysite.com/score-card/ with the [auto-iframe] code in, that I want to reference in links as mysite.com/score-care/506263 for example so that the page loads [auto-iframe link=iframe.com/plugins/base/matches/506263/ query=yes width=900 height=1350 autosize=yes] where the number at the end of the link changes depending on what I put in the calling URL (if that makes sense).

    Is this possible ?

    TL;DR want number added to page URL to be passed to auto-iframe url to load different pages

    • This reply was modified 7 years, 7 months ago by stuart0870.
    • This reply was modified 7 years, 7 months ago by stuart0870.
    Plugin Author Greg Ross

    (@gregross)

    No that’s not possible in the current code.

    Ok, cheers, I’ll try and find a work around.

    Hi, This is supported by advanced iframe pro: https://codecanyon.net/item/advanced-iframe-pro/5344999

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Passing a parameter to an iframe?’ is closed to new replies.