1

Here is my template simplified for brevity

{exp:structure:entries channel="iconGroup" limit="1" sort="asc" paginate="bottom"}

    <h1>{title}</h1>
    <div class="icon-grid">
    {exp:file:entries directory_id="{file_upload_id}" dynamic="no" disable="categories" orderby="date"}
         <span>{filename}</span>
         <span class="extra-desc">{description}</span>
 {/exp:file:entries}
     </div>
{/exp:structure:entries}

The issue i am having is that the description does not show up when it is nested in the entries template. If i move it out of that it shows fine. Is there a way i can make it show up?

Alternatively The main reason i need it nested is to get the file_upload_id from the channel above. Maybe there is a way to get that single entry?

Thanks!

1 Answer 1

1

You should never to nest exp:channel:entries, but, in this case, you have a fair reason.

Let's use an embed!

{exp:structure:entries channel="iconGroup" limit="1" sort="asc" paginate="bottom" disable="categories|member_data|member_data|pagination"} 
    <h1>{title}</h1>
    <div class="icon-grid">
    {embed="includes/.files-and-descriptions" id_of_directory="{file_upload_id}"}
     </div>
{/exp:structure:entries}

Then, on embed:

{exp:file:entries directory_id="{embed:id_of_directory}" dynamic="no" disable="categories|member_data|member_data|pagination" orderby="date"}
     <span>{filename}</span>
     <span class="extra-desc">{description}</span>
{/exp:file:entries}

If this embed is used just once per page, I suggest you to enable the template cache of both files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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