0

I am using Structure (v3.3.8), Assets (v2.0.5), Structure Entries (v1.2.8), and CE Image (v2.4.1). For the major section pages of my site (top-level navigation), I would like to output on the page a section-specific navigation which includes a "page image" (custom field), "page intro", title, and link. Everything is working fine except for the images, and I'm not sure if it's a Structure Entries problem or an Assets problem (or a CE Image problem).

I am trying to do this:

{exp:structure_entries depth="1" parent="{embed:my_parent_id}"}
<div class="column one-third">
    <div class="pic">

        {page_image}
            <a href="{page_uri}">
                {exp:ce_img:pair src="{page_image}" width="420" height="279" crop="yes"}
                    <img src="{made}" alt="{page_image:title}{if 
                    page_image:author} - Photo by {page_image:author}{/if}" />
                {/exp:ce_img:pair}
                <div class="img_overlay_zoom"></div>
            </a>
        {/page_image}

    </div>
    <h3><a href="{page_uri}">{title}</a></h3>
    <p>{page_intro}</p>
</div>
{switch='||<div class="clearfix"></div>'}
{/exp:structure_entries}                

On the calling page, I have this code:

{embed="embeds/_section_navigation_images" my_parent_id="{structure:page:entry_id}"}

The embed is working fine (the correct section is being displayed), but the images aren't showing up. This is the HTML code that is generated:

<div class="column one-third">
    <div class="pic">
        {page_image}
            <a href="/mysite/index.php/get-involved/donate">
                <div class="img_overlay_zoom"></div>
            </a>
        {/page_image}
    </div>
    <h3><a href="/mysite/index.php/get-involved/donate">Donate</a></h3>
    <p>Donate to our organization and help ...</p>
</div>
...

The {page_image} tags are not being parsed, and the image isn't being output at all.

Debugger Output (Excerpt)

(26.607746 / 30.22MB)      Tag: {exp:structure_entries depth="1" parent="65"}
(26.608122 / 30.22MB)      Closing Tag Found
(26.608356 / 30.22MB)      Processing Tags
(26.608584 / 30.22MB)      Plugin Tag: Structure_entries/
(26.608702 / 30.22MB)      Including Files for Plugins and Modules
(26.608801 / 30.22MB)      Files for Plugins and Modules All Included
(26.608893 / 30.22MB)      Beginning Final Tag Data Processing
(26.609005 / 30.22MB)      Calling Class/Method: Structure_entries/
(26.609129 / 30.22MB)      Nested Plugins in Tag, Parsing Outward First
(26.609618 / 30.24MB) Tag: {exp:ce_img:pair src="{page_image}" width="420" height="279" crop="yes" filter="auto_sharpen"}
(26.610344 / 30.24MB) Closing Tag Found
(26.610655 / 30.24MB) Plugin Tag: Ce_img/pair
(26.610761 / 30.24MB) Including Files for Plugins and Modules
(26.610847 / 30.24MB) Files for Plugins and Modules All Included
(26.610974 / 30.24MB) Beginning Final Tag Data Processing
(26.611076 / 30.24MB) Calling Class/Method: Ce_img/pair
(26.611854 / 30.24MB) -> Class Called: Ce_img
(26.612009 / 30.25MB) -> Method Called: pair
(26.621115 / 30.26MB)   ***  CE Image debug: Base path: 'C:/Users/Amy/Dropbox/www/'
(26.621214 / 30.26MB)   ***  CE Image debug: Source image: '{page_image}', Fallback image: ''
(26.621292 / 30.26MB)   ***  CE Image debug: Source image is not readable or does not exist: '{page_image}'.
(26.621367 / 30.26MB)   ***  CE Image debug: Fallback source image is not readable or does not exist: ''.
(26.621515 / 30.27MB) Returning No Results Content
(26.621909 / 30.25MB) -> Data Returned
(26.623894 / 30.23MB)       -> Class Called: Structure_entries
(26.909353 / 30.25MB)      structure_entries: Starting main loop through entries. Total rows from DB=32
(27.371411 / 30.31MB)      structure_entries: tagdata= <div class="column one-third"> <div class="pic"> {page_image} <a href="{page_uri}"> <div class="img_overlay_zoom"></div> </a> {/page_image} </div> <h3><a href="{page_uri}">{title}</a></h3> <p>{page_intro}</p> </div> {switch='||<div class="clearfix"></div>'}
(27.371651 / 30.31MB)      structure_entries: ID=72 url=/ee-mjv/index.php/get-involved/donate
(27.377516 / 30.32MB)      structure_entries: tagdata= <div class="column one-third"> <div class="pic"> {page_image} <a href="{page_uri}"> <div class="img_overlay_zoom"></div> </a> {/page_image} </div> <h3><a href="{page_uri}">{title}</a></h3> <p>{page_intro}</p> </div> {switch='||<div class="clearfix"></div>'}

When I strip off the CE Image tags and just output the {page_image} it gives the filename. If I change it to {page_image:url}, it does not parse at all.

Updated Code

I'm updating my code based on @Aaron's comments:

    {exp:structure_entries depth="1" parent="{embed:my_parent_id}" parse="inward"}
<div class="column one-third">
    <div class="pic">
        {page_image}
            <a href="{page_uri}">
                {exp:ce_img:pair src="{url}" width="420" height="279" crop="yes" filter="auto_sharpen"}<img src="{made}" alt="{title}{if author} - Photo by {author}{/if}" />{/exp:ce_img:pair}
                <div class="img_overlay_zoom"></div>
            </a>
        {/page_image}
    </div>
    <h3><a href="{page_uri}">{title}</a></h3>
    <p>{page_intro}</p>
</div>
{switch='||<div class="clearfix"></div>'}
{/exp:structure_entries}

The Assets field (page_image) is still not being treated like a tag pair as it should.

I appreciate any help you can offer! Thanks.

  • Do you get any debug messages from the template debugger (see Debugging for more details)? – Aaron Waldon Feb 5 '13 at 0:15
  • There is a LOT of stuff in the debugger. What is most useful? There are 9 entries with the "***" at the beginning, but they are success messages for the 3 images in the footer. On this page right now, I have the code {page_image:url}, which did not parse. – Amy Witty Feb 5 '13 at 0:28
  • Okay, I changed back to my original code (shown in the top of the question), and got some other interesting debugger stuff. I'll update the question accordingly. – Amy Witty Feb 5 '13 at 0:33
3

If you're using Structure 3.3.8, it already includes the Structure Entries functionality (Official Documentation). Maybe give the native version a try and see if that parses the Assets tag correctly?

{exp:structure:entries parent_id="{embed:my_parent_id}"}
...
{/exp:structure:entries}
|improve this answer|||||
  • Yes, this worked! Thank you. I also was able to get rid of the embed and just place the code directly in the main template. – Amy Witty Feb 5 '13 at 15:35
3

I also just just noticed that you are using {page_image}...{/page_image} as a variable pair, and also using a single variable {page_image} inside that loop (that you are passing into the CE Image src= parameter). I think that's probably a typo, right? Shouldn't the single variable be {url}?

|improve this answer|||||
  • Good point. I changed all the references inside the {page_image} tag pair to {page_image:...} references. I also tried changing all the refences inside the {page_image} tag pair to {url}, {title}, {author}, etc. Neither worked inside the tag pair. The opening tag is being parsed as the file name, the image tag is being ignored, and then it outputs the unparsed end tag. – Amy Witty Feb 5 '13 at 1:27
  • When I get rid of the {page_image} tag pair altogether (keeping the full {page_image:...} references in the rest of the spots), everything related to the image disappears. – Amy Witty Feb 5 '13 at 1:28
  • ` *** CE Image debug: Source image is not readable or does not exist: '{page_image:url}'.` – Amy Witty Feb 5 '13 at 1:31
  • Yeah, leave in the {page_image}...{/page_image} tag pairs, just get rid of the {page_image} single variable (the one without a closing tag inside the tag pair). – Aaron Waldon Feb 5 '13 at 17:41
1

Since the Structure Entries add-on is a plugin, you'll need to add parse="inward" to the opening tag. That way, the plugin will parse its own variables before trying to parse the {exp:...} tags inside its tagdata (the text between the opening and closing {exp:}{/exp:} tags).

Modules and plugins behave in almost the same way, except for their default parse order. One advantage of plugins, is that you get to choose the order. By default, they wait until all the content inside them is parse by the EE parser before sending the tagdata to the parser. Modules, on the other hand, automatically parse inward.

|improve this answer|||||
  • So I add the parse="inward" to the opening exp:structure_entries tag? – Amy Witty Feb 5 '13 at 0:40
  • Yeah. If you do that, is there any change? – Aaron Waldon Feb 5 '13 at 0:42

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.