ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Accessing variables inside nested template loops

October 10, 2012 8:15am

Subscribe [3]
  • #1 / Oct 10, 2012 8:15am

    tobycatlin

    4 posts

    Hello Everybody,

    I am a bit stuck and wanted to know if anyone has a solution to my problem. I realise that this may not be the most performant template but pls stick with me. This template is for a landing page that lists a set of components and links to their detail page. Each component has a bunch of detail pages linked to it using playa. Those detail pages are also linked to categories.

    The template displays exactly what i want but my problem is forming the link inside the inner most playa loop. I need to use the {url_title} from the component loop.

    {exp:channel:entries channel="component" dynamic="no"}
      <h3>{title} - {url_title}</h3>
    <p>  {exp:channel:categories channel="detail" class="category_titles"}<br />
        </p><h5>{category_name}</h5>
    <p>    {exp:playa:parents channel="detail" dynamic="no" category="{category_id}"}<br />
            <a href="http://{path=component/{component_url_title}/{category_url_title}/{url_title}}">{title}</a> <br />
        {/exp:playa:parents}</p>
    
    <p>  {/exp:channel:categories}<br />
    {/exp:channel:entries}

    I have tried using stash:
    {exp:stash:set name="component_title"}{url_title}{/exp:stash:set}
    {exp:stash:get dynamic="yes" name="component_title"}

    But i guess i am either using it incorrectly or misunderstanding the point of stash.

    Anyone got any ideas? This must have come up before.

    Thanks for your time and help
    toby

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases