• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Problems with OR - AND in navigation after upgrade to 2.2.1
PostPosted: Sat Jul 08, 2017 1:39 pm 
Offline
Forum Members
Forum Members

Joined: Sat Jul 08, 2017 1:10 pm
Posts: 14
Location: French speaking Switzerland
On a page I had this code :
\$1:
{if feu_smarty::is_user_memberof('Auteurs,Membres,potentiel')}
I choose this page page
 {Navigator template="nautres.tpl"}
{else}
You must be member
 {/if}

and the content of template nautres.tpl was
\$1:
{if !isset($depth)}{$depth=0}{/if}
{if isset($nodes)}{strip}
<ul style="list-style-type:none; ">
{foreach $nodes as $node}
{if ($node->extra1 == 'retour' ) or ($node->extra1== 'annonce') or
(   ($node->extra1=='membres'and feu_smarty::is_user_memberof('Membres')) or
    ($node->extra1=='auteurs'and feu_smarty::is_user_memberof('Auteurs'))or
    ($node->extra1=='attente'and feu_smarty::is_user_memberof('potentiel'))
    )}
  {if $node->current}
  <li><a href="{$node->url}" class="currentpage"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>
  {else}
  <li><a href="{$node->url}">{$node->menutext}</a></li>
  {/if}
{/if}
{/foreach}
</ul>
{/strip}{/if}

After upgrade from 2.1.5 to 2.2.1 open this page gave this error :
\$1:
Syntax error in template "module_file_tpl:module_file_tpl:Navigator;nautres.tpl" on line 19 "( ($node->extra1=='membres'and feu_smarty::is_user_memberof('Membres')) or" - Unexpected "and"

I could remove all AND by using more IF conditions and it was OK for this page.
But I had a new error in a gabarit with the code :
\$1:
{menu template="autres.tpl"}

and the content of template autres.tpl was
\$1:
<ul style="list-style-type:none; ">
{foreach from=$nodelist item=node}
{if ($node->extra1 == 'retour' ) or ($node->extra1== 'annonce') or
(  ($ccuser->loggedin())and
   (($node->extra1=='membres'and feu_smarty::is_user_memberof('Membres')) or
    ($node->extra1=='auteurs'and feu_smarty::is_user_memberof('Auteurs'))or
    ($node->extra1=='attente'and feu_smarty::is_user_memberof('potentiel'))
   ))}
  {if $node->current == true}
  <li><a href="{$node->url}" class="currentpage"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->Syntax error in template "module_file_tpl:module_file_tpl:MenuManager;autres.tpl"  on line 4 "(  ($ccuser->loggedin())and"  - Unexpected "and"
menutext} </a>
  {else}
  <li><a href="{$node->url}">{$node->menutext}</a></li>
  {/if}
{/if}
{/foreach}
</ul>

and here, came this error explanation :
\$1:
Syntax error in template "module_file_tpl:module_file_tpl:MenuManager;autres.tpl" on line 4 "( ($ccuser->loggedin())and" - Unexpected "and"


At this point, I changed all AND in && and all OR in || and since I made these changes in both templates, my site runs perfectly.

I presume that navigation with templates containing so much AND - OR are harder to compile than with && - || instead.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Problems with OR - AND in navigation after upgrade to 2.
PostPosted: Sat Jul 08, 2017 2:50 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 8169
Location: Fernie British Columbia, Canada
CMSMS 2.2 introduced a newer version of smarty that probably has tougher parsing rules.

The words 'or' and 'and' are permitted operators in exchange for '||' and '&&' respectively. I think the problem you are having here is with whitespace. The lexer/parser is probably having a problem understanding that the 'or' is intended as an operator. I would add whitespace around all of your comparison operators.

\$1:
($node->extra1=='auteurs'and feu_smarty::is_user_memberof('Auteurs'))or

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Problems with OR - AND in navigation after upgrade to 2.
PostPosted: Sat Jul 08, 2017 3:49 pm 
Offline
Forum Members
Forum Members

Joined: Sat Jul 08, 2017 1:10 pm
Posts: 14
Location: French speaking Switzerland
With whitespace around all of your comparison operators it's OK.
Many thanks for the answer


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Problems with OR - AND in navigation after upgrade to 2.
PostPosted: Sat Jul 08, 2017 6:08 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 8169
Location: Fernie British Columbia, Canada
As an added note: FEU can take care of 90% of that automatically now.

Change the content type to 'Protected content' and then set the allowed group(s) when editing the page.

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosting Nation - Managed CMSMS Hosting