Error You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}. Parser State: Unexpected { expected ENDIF.
After reading up on all the changes to how conditionals work in 2.9.0 I thought I would be wise to update an existing/fully functional site (one we use for testing) and see how this might effect us.
It appears that the new way of doing things isn’t backwards compatible at the moment.
We’ve been greeted with this error that really doesn’t do much to tell us what template we should be looking in.
So I’m wondering if there’s any way within EE’s Template Engine to search and locate the offending conditional so we can update it to the new format?
In site’s using pretty DRY development methods, and where a single page might include over a dozen snippets and/or embeds and such, it can take a while to hunt down the needle(s) in the haystack.
It sounds like you’re hitting the bug that Low caught this thread. I’ve attached a patched file there, but I expect we will also have another preview soon. Sorry for the instability.
It does bring up a very good point though, we should have a way of tracking where things come from. File locations would be nice and line numbers would be the panacea. We’ll look into it for sure!
Oh when I say find the file, I definitely mean find the source file. So the name of the snippet if it’s in a snippet. But yes, we could try to do a mysql-esque error output “You have an error near ‘{if [exp;] == …’”.
The progressive buildup of the templates makes both the line numbers and the source code difficult since it changes during execution.
Finally having a moment to try out the latest build and things are looking better:
Parser State: Unexpected ‘}’ (RD); expected ENDIF tag in Template “site_system/index” on line 306.
The only issue now is that this template only has 26 lines total.
So I’m guessing that the issue is within one of a possible 8 different embedded templates (used conditionally, based on the URI). When some combination of the 8 embeds is used, then this template must end up with 306 lines or more.
Thanks for the work on this up to this point, if there’s anyway to narrow things down to the actual template, or the line number at which the actual template is embedded, then this would be much, much more helpful.
Hey Kurt, I get the actual line of the actual resource when I introduce a conditionals error. For example, if I put this conditional in various locations:
{if something so{/if}Then I get these errors depending on where I’ve placed it:
Parser State: Unexpected ‘so’ (VARIABLE); expected RD in Snippet “snp-test” on line 1
Parser State: Unexpected ‘so’ (VARIABLE); expected RD in Template “default/embed” on line 5.
So if it were a conditional on the embedded template, it should indicate the embedded template name and line. How is site_system/index being built? Do you have PHP enabled and pulling anything in that way?
No PHP,
This is the template:
{preload_replace:preload_language="{embed:display_language}"}
{if segment_1 == 'site_system'}
{redirect='404'}
{if:elseif segment_1 == 'print'}
{embed='site_display/header_html' {snippet_dynamic_variables}}
{embed='site_display/print' {snippet_dynamic_variables}}
{if:elseif segment_1 != '' AND '{embed:404}' == '404'}
{redirect='404'}
{if:else}
{embed='site_display/header_html' {snippet_dynamic_variables}}
{embed='site_display/header' {snippet_dynamic_variables}}
{if segment_3}{!-- SINGLE ENTRY PAGE --}
{embed='site_display/single_entry' {snippet_dynamic_variables}}
{/if}
{if (segment_1 OR segment_2) AND segment_3 == ''}{!-- LANDING AND CATEGORY PAGE --}
{embed='site_display/category' {snippet_dynamic_variables}}
{/if}
{if segment_1 == ''}{!-- HOME PAGE --}
{embed='site_display/home' {snippet_dynamic_variables}}
{/if}
{embed='site_display/footer' {snippet_dynamic_variables}}
{/if}{!-- SEGMENT_2 CATEGORY MATCH CHECK -- 404 --}And I can reduce it down to this and the two embedded templates load:
{preload_replace:preload_language="{embed:display_language}"}
{embed='site_display/header_html'}
{embed='site_display/footer'}But this wont fly, and the interesting part is that it wont fly even when the /header template is totally empty:
{preload_replace:preload_language="{embed:display_language}"}
{embed='site_display/header_html'}
{embed='site_display/header'}
{embed='site_display/footer'}So I’m scratching my head big time on this one.
Give me a few moments, and I’ll pack something up for you.
Hm…. well “export all” in the template manager (first time I’ve ever tried it) create an unzipp-able zip. … reminds me of someone’s “unblock-able move”.
… and same with export group.
So let me do this another way.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.