Third Light Developer Exchange

Code and templating community forum for developers and software integrators

You are not logged in.


If you wish to join the Developer Exchange, please contact your account manager - this is to avoid unnecessary spam in the forums. Many thanks for your understanding.

#1 2015-11-14 01:21:59

Registered: 2015-01-20
Posts: 43

Syntax for if in smarty

If I send a link to a container to someone who is not logged in they see a message that says "You do not have access..."  I want to change that message.  I have noticed that the label on the button is Login for this particular error.  I tracked the message down to a template called messagebox.tpl.  There is a line there that is:

{capture assign=strMessageNote}{if $strHTMLMessage != ""}{$strHTMLMessage}{else}{$strMessage|escape}{/if}{/capture}

I changed this to: 
{capture assign=strMessageNote}{if $strLinkLabel eq "Login"}{"Link label is login"}{else}{$strLinkLabel}{/if}{/capture}

Now this does change the message - it makes it "Login" which is the value of $strLinkLabel.  However my code is saying that if the value of $strlinkLabel is "Login" I should get a different message.
So obviously the syntax    {if $strLinkLabel eq "Login"}      is wrong.  I have tried without quotes, with a single quote and also all three of these options using == instead of eq.
Nothing works.
Can someone please tell me what this line should look like?  Once I can get this to work, I will go back and edit the original line to be what I need.


#2 2015-11-16 12:06:40

Third Light Staff
Registered: 2013-06-06
Posts: 105

Re: Syntax for if in smarty

Hi Michelle,

The value of strLinkLabel is '##LOGIN##' rather than 'Login' so changing to the following will help:
{capture assign=strMessageNote}{if $strLinkLabel eq "##LOGIN##"}{"Link label is login"}{else}{$strLinkLabel}{/if}{/capture}

##LOGIN## is a placeholder whose value is subsequently replaced with the translation for the language the templates are being displayed in.

Best Regards,


Board footer