I've been using Low's technique of combining snippets and preload variables (as described here) in order to be able to use a particular snippet repeatedly (and DRYly). The snippet contains conditionals and preload_replace variables form part of the criteria for those conditionals, so the criteria can change depending upon the template in which the snippet is used.

Up until the point that I upgraded to 2.9.0 it worked just fine, because the Conditionals were advanced and so parsed long after the preload replacement had taken place. Now, under 2.9.0's new conditional parsing regime, it would appear that the conditionals are firing before the preload replacement has taken place, and the template throws an error.

Does anyone have a method of forcing the preload replacement to take place before the conditional are parsed, like in the old days? I'm trying to avoid using an embed if possible, but accept that there might be no other way. Still, I'd be interested to see if anyone has an alternative.


UPDATE: In response to the requests in the first couple of replies, here is some code. It's not the entire template, just the relevant channel entries loop and the problem snippet. (The rest of the template is pretty mundane).

CE loop:

{exp:channel:entries channel="news"}
    {!-- ...some other fields... --}
    {!-- ...some more fields... --}

Snippet snp_gridfield_output:

    {if {pre_gridfield}:image}
        {if {pre_gridfield}:caption != "" || {pre_gridfield}:credit != ""}
                <img src="{if {ress} < 480}{{pre_gridfield}:image:mobilesize}{if:else}{{pre_gridfield}:image}{/if}" alt="{{pre_gridfield}:alt}" title="{{pre_gridfield}:caption}">
                <figcaption>{{pre_gridfield}:caption}<span>{if {pre_gridfield}:credit != "" && {pre_gridfield}:caption != ""}&emsp;/&emsp;{/if}{if {pre_gridfield}:credit}&copy;&nbsp;{{pre_gridfield}:credit}{/if}</span></figcaption>
            <img src="{if {ress} < 480}{{pre_gridfield}:image:mobilesize}{if:else}{{pre_gridfield}:image}{/if}" alt="{{pre_gridfield}:alt}" title="{{pre_gridfield}:caption}">

The various Grid fields that this snippet might reference all have the following columns: text|image|alt (for image alt text)|caption|credit. What's going on in this snippet's code is that once the preload replacement has correctly set the name of appropriate Grid field, the Grid loop will first place the text, then look to see if there is an image. If there is then it checks to see whether the image has a caption and/or a credit. If it does, then a <figure> element is used (with <img> and <figcaption> elements inside), otherwise the <img> element is used on its own. There is also some degree of content negotiation based upon the screen size (the {ress} tag) which can be seen in the img element's src attribute.

The preload replace is definitely the problem; if I do the replacement manually inside the snippet (ie. search-and-replace '{pre_gridfield}' with 'name_of_grid_field') and do away with the preload_replace tag entirely, the problem disappears. But so does my flexibility for reusing the snippet.

Hope this helps.

  • 1
    Can you post some of your template code? I'd say the parse='inward' should help if you add that to your loops, but would need to see what you're trying to do. Plus others could assist too if we can see your setup :) Aug 14, 2014 at 19:24
  • I use the same technique without any problems on 2.9. Please, show us some code.
    – Sobral
    Aug 14, 2014 at 23:07
  • I've updated my original question to include code and some explanatory notes. I've been reviewing Low's parse order PDF (loweblog.com/downloads/ee-parse-order.pdf) and comparing it to the parse order listed in the current EE docs. Clearly what's causing my problem is the new edict that 'Conditionals now evaluate when ready'). It would appear that the conditionals are considered 'ready' even though they have unreplaced preload_replace variables as criteria. Previously they were evaluating AFTER the preload replace stage of the parse order.
    – RickL
    Aug 15, 2014 at 9:26
  • I just tried adding a {exp:stash:parse process="end" priority="10"} tag pair around the outermost {if} statement in the snippet. No effect, sadly.
    – RickL
    Aug 16, 2014 at 10:13
  • have you tried moving "{snp_gridfield_output}" into an embed instead? also what happens when you add parse="inward" ? Aug 19, 2014 at 20:34

1 Answer 1


I recently had the same problem. Through the process of elimination I discovered it was an apostrophe in my Entry that was causing this error to happen.


            {if '{cancerstreated_sec1_studies}{cancerstreated_sec1_studies:medicalprof_sec1b_title}{/cancerstreated_sec1_studies}'!=''}
            <div class="twelveRightSection">
                <div class="topTitle">
                    <p>Related Studies</p>
                <div class="bottomTable">
                    <table class="relatedStudies">
                        <tr class="{cancerstreated_sec1_studies:switch='|oddRow'}">
                            <td class="studyName">{cancerstreated_sec1_studies:medicalprof_sec1b_title}</td>
                            <td class="studyAuthor">{cancerstreated_sec1_studies:medicalprof_sec1b_author}</td>
                            <td class="studyCTA"><a href="{cancerstreated_sec1_studies:medicalprof_sec1b_url}" title="Read Story" target="_blank">Read Study</a></td>

I was using an IF to check if the following Grid field existed. IF it existed, show the content.{cancerstreated_sec1_studies:medicalprof_sec1b_title}

By removing the apostrophe from my entries title name, the error went away. I'm now checking for the Author's name instead of the entry title for this conditional. Not ideal, but it works.

in EE V2.9 Grid has been such a headache...

I hope this helped!

Your Answer

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

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