0

EE 2.8.1 Structure 3.3.14.5

I've got a template Where I need to use {structure:page:entry_id} to pass the current pages entry id in order to list some entries. However on this page {structure:page:entry_id} does nothing, zilch, nada. When I place it anywhere in the template it doesn't output the entry_id at all. In fact it gets rendered on the front end as if the variable were not valide with curly braces and all.

The Code that I'm trying to use is:

{exp:structure:entries parent_id="{structure:page:entry_id}"}
    {switch='<div class="tiles">||'}

        <div class="tile one-sided">
            <a href="{page_url}" class="tile-content">
                <img src="http://placehold.it/230x100" alt="">
                <h5>{title}</h5>
            </a>
        </div>

    {switch='||</div>'}
{/exp:structure:entries}

If I hard code in the parent_id the code renders as expected.

1

Structure's global variables are only applicable to a Structure Page or Listing.

It seems the template in which your code resides is not being utilised as a template by a Structure page or listing entry.

Firstly, I would suggest you disable and re-enable the Structure extension for sanity sake. The extension is what parses the template variables in the first place.

Secondly, to verify whether your template is a Structure page or listing, you will need to create a page in Structure and ensure you've selected the Structure Template (which has your code in it) from within the Structure tab. Check if your global variable outputs the correct {entry_id}

Finally, you may want to browse through the Structure Support forum to investigate further or get in touch with the vendor.

0

Turns out the issue is more about the way the templates are being routed and using Low Variables. The solution was to pass the the variable to low variables using the preparse parameter.

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.