Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

if-condition throws syntax error


Reply


5 Posts   1888 Views

Avatar
brokemeister

Community Member, 30 Posts

2 July 2009 at 8:32pm

Hi!

I always get following error and cannot figure out what is wrong:

Parse error: syntax error, unexpected '}' in ....\...MagazinViewSingle.ss on line 41

Template
         <div class="item $Item.ClassName">
         <% if Item.ClassName == ArticleDataObject %>
            <H2>$Item.Title</H2>
            <p>$Item.Text</p>
         <% else %>
            Content Type is not configured in MagazinViewSingle.ss
         <% end_if %>
         </div>

Any ideas or hints?

Thanks

Greetz from Germany,

Malte

Avatar
Fuzz10

Community Member, 787 Posts

2 July 2009 at 9:54pm

<% if Item.ClassName == ArticleDataObject %>

should be :

<% if Item.ClassName = ArticleDataObject %>

Avatar
brokemeister

Community Member, 30 Posts

2 July 2009 at 10:01pm

Hi lemon8,

The same error still occures.. :(

The output of Item.ClassName works pretty well.
By the way "Item" is a record...

Cheers,

Malte

Avatar
banal

Community Member, 901 Posts

2 July 2009 at 10:58pm

I suggest you do the following:

<% control Item %>
<div class="item $ClassName">
   <% if ClassName = ArticleDataObject %>
      <h2>$Title</h2>
      <p>$Text</p>
   <% else %>
      Content Type is not configured in MagazinViewSingle.ss
   <% end_if %>
</div>
<% end_control %>

Avatar
brokemeister

Community Member, 30 Posts

2 July 2009 at 11:24pm

Hi banal,

thanks for your reply.

It's working...