New template compile error in 2.1.5

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

New template compile error in 2.1.5

Post by spcherub »

I have a template that outputs text or HTML based on a query parameter. This works well in 2.1.4 (and a few versions below), but fails with the following error ins 2.1.5
Syntax error in template "tpl_top:36" on line 9 "" unclosed {else} tag
The simplified template code is as follows:

Code: Select all

{content assign="my_content" wysiwyg="false"}
{strip}
  {process_pagedata}
{/strip}
{if isset($smarty.get.text)}
  This is plain text
{else}
<!DOCTYPE html>
< html>
< head>
  <title>Test</title>
</ head>
< body>
This is HTML body stuff
</ body>
</ html>
{/if}
Any hints as to how adapt in my code to account for the changes in 2.1.5 is much appreciated.

Note: I had put spaces in the HTML tags in the code above so it would look right in this posting.

TIA,
Sanjay
User avatar
Rolf
Dev Team Member
Dev Team Member
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: New template compile error in 2.1.5

Post by Rolf »

I have an extended demo template here: http://www.cmscanbesimple.org/blog/base ... d-metatags
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: New template compile error in 2.1.5

Post by spcherub »

@Rolf - thanks for link. There are some good references there.

However, it does not address the specific parsing issue I'm facing.

Also it looks like the scope processing has changed in the current version of the platform. For instance I used to be able to assign a variable in zone 1 and use it in zone 2 without needing to declare global scope. That does not seem to be the case any more in 2.1.5
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: New template compile error in 2.1.5

Post by spcherub »

Just to clarify my current use-case/need (in pseudocode):

Code: Select all

if logic condition is true
then
  display text information (no html tags)
else
  display html page
end if
I need to be able to do this at a template level, so that the page can render text or html output depending on how it is accessed. If there is a better (more standard) way to do this, please let me know.

Thanks,
Sanjay
User avatar
Rolf
Dev Team Member
Dev Team Member
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: New template compile error in 2.1.5

Post by Rolf »

Note the explanation about the template areas!
You can't have an {if} in an other area/scope as the {else} or {/if}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: New template compile error in 2.1.5

Post by spcherub »

Got it.

I was using a way to hide the <head> tag from the template parser:

Code: Select all

{assign var="htmlhead" val="head"}
<__html>
<{$htmlhead}>
...
I'm assuming this is unstable workaround at best. Is there any other way to accomplish what I need (as outlined in my earlier pseudo-code)?
Post Reply

Return to “CMSMS Core”