0

I need to send a page URL as a parameter into a plugin. So I have a global var called lv_shop_page (early parsing) which is an entry ID to a page which I'm passing to structure's {structure:page_uri_for:X} function. When I just output {structure:page_uri_for:{lv_shop_page}} it comes out with the proper URL but when I put this into the parameter of a plugin like so:

{exp:someplugin
parse="inward"
page="{structure:page_uri_for:{lv_shop_page}}/blah/blah"}

I get

{structure:page_uri_for:470}/blah/blah

I know this is a parse order problem, is there any way round this so I can make {structure:page_uri_for:X} parse earlier than my plugin? Or maybe another workaround using stash or embeds?

1

The {structure:page_uri_for:XXX} variable is parsed late, after template parsing has occurred (using the template_post_parse hook). In other words, too late to be used as a tag parameter in your plugin. However, there is an undocumented Structure tag you can use instead of the {structure:page_uri_for:XXX} variable: {exp:structure:page_slug}.

{exp:someplugin
    parse="inward"
    page="{exp:structure:page_slug entry_id='{lv_shop_page}'}/blah/blah"
}

You may have to you an embed and/or Stash to get the parse order right, but this should be possible.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.