• Resolved andrezasv

    (@andrezasv)


    Hi,

    The URL of my iframe is dynamically defined through a PHP code. For instance, to show in the iframe the list of pages of a given site in a multisite I do: [php_code_to_get_the_full_url_of_my_site]/wp-admin/edit.php?post_type=page

    Can I insert PHP code in the iframe url field?

    https://ww.wp.xz.cn/plugins/advanced-iframe/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author mdempfle

    (@mdempfle)

    No. But adding this by yourself should not be a big problem. The src can be set e.g. by a parameter to url mapping in the pro version. Maybe this already solves your problem…

    Below you find the description of the filed I mean:

    Map parameter to url
    You can map an url parameter value pair to an url or pass the url directly which should be opened in the iframe. If you e.g. have a page with the iframe and you like to have different content in the iframe depending on an url parameter than this is the setting you have to use. You have to specify this setting in the following syntax “parameter|value|url” e.g. “show|1|http://www.tinywebgallery.com”. If you than open the parent page with ?show=1 than http://www.tinywebgallery.com is opened inside the iframe. You can also specify several mappings by separating them by ‘,’. You can also only specify 1 parameter here! The value of this paramter is than used as iframe url. e.g. show=http%3A%2F%2Fwww.tinywebgallery.com%3Fparam=value. You need to encode the url if you pass it in the url. Especially ? (%3F) and & (%26)! Please note that because of security reason only whitelisted chars [a-zA-Z0-9/:?&.] are allowed. Encoded parameters in the passed urls are not supported because all input is decoded and checked. If no parameter/value pair does match the normal src attribute of the configuration is used. Shortcode attribute: map_parameter_to_url=””

    Best, Michael

    Thread Starter andrezasv

    (@andrezasv)

    Sorry, but I could not understand where I have to isnert the php code (echo site_url();) to obtain the full url of my site. I’m doing this because I have a multisite instalation.

    Remember I cannot define the URL statically, but only with the function site_url();

    Is it possible? How?

    Plugin Author mdempfle

    (@mdempfle)

    If you have to use site_url() you have to go into the code.

    Look for the place where the <iframe is written. The src value is one of the first ones you have to extend/replace then.

    Best, Michael

    Thread Starter andrezasv

    (@andrezasv)

    So, is it possible?

    Plugin Author mdempfle

    (@mdempfle)

    sure.

    as I have written.

    Search for <iframe in advanced-iframe

    there you find
    $html .= ” src='” . $src . “‘ “;

    Simply set $src to what you want…

    Best, Michael

    Thread Starter andrezasv

    (@andrezasv)

    If I modify the $src in the code it will be applied to all iframes. I have several iframes, for instance, to open the pages and the posts of the subsites. So, if I’m in the subsite A, the src would be: . And if I’m in the subsite B, the src would be:

    So, I cant define the src in the code. I want to use your plugin, it is very helpful. Tell me other ways to dynamically set the src, it would be nice if it accept shortcodes.

    Plugin Author mdempfle

    (@mdempfle)

    I thought you only want to define the first part of it. And than the rest in the src attribute. So that this will be put together.
    It this not what you need.
    Which shortcode plugin would you use? Extending the plugin that this be possible is also a way. But than I would need how this should look like.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘PHP code into iframe url’ is closed to new replies.