Page 1 of 1

Please help with smarty tag usage [SOLVED]

Posted: Fri Jul 31, 2009 3:29 am
by christophera
I'm slowly learning my way around cmsms :)

Smarty tags is what I am working on now...  where can I use them?

Right now, I want to make a link on a page available just to logged on members.

I went to content/pages/thepage, and in the content wysiwyg editor, I put:

{if $customcontent_loggedin > 0}Download and print the lesson plan here. {else}Students: please log in to print lesson plan.
{/if}

But it breaks the page:  string(121) "Smarty error: [in content:content_en line 5]: syntax error: unidentified token ';' (Smarty_Compiler.class.php, line 1407)"

Do smarty tags not work directly in the content section like that? Do they only work in templates, that's where I used them before, but I thought it would go here on the single page level, no?

Thanks for any help,  Chris

(1.5.4, with feu and customContent installed)

Re: Please help with smarty tag usage

Posted: Fri Jul 31, 2009 4:53 am
by JohnnyB
I think you can use this instead:

{ if $ccuser->loggedin() }Download and print the lesson plan here. {else}Students: please log in to print lesson plan.{/if}


smarty tags are ok in the editor but I usually toggle it Off to work with them.

Re: Please help with smarty tag usage

Posted: Fri Jul 31, 2009 2:02 pm
by christophera
Tried that and get:

string(131) "Smarty error: [in content:content_en line 5]: syntax error: unidentified token ';loggedin()' (Smarty_Compiler.class.php, line 1407)"

So if it should be ok to use it in the content like I did, I'm guessing something is wrong in smarty or my set up?

Re: Please help with smarty tag usage

Posted: Fri Jul 31, 2009 2:14 pm
by jmcgin51
your WYSIWYG editor is mangling your Smarty tag by converting the ">" to the equivalent HTML code.

from

Code: Select all

{if $ccuser->loggedin() }Download and print the lesson plan here. {else}Students: please log in to print lesson plan.{/if}
to

Code: Select all

{if $ccuser->loggedin()}Download and print the lesson plan here. {else}Students: please log in to print lesson plan.{/if}
Turn off your WYSIWYG, or better yet, put this code in your template.

Re: Please help with smarty tag usage

Posted: Fri Jul 31, 2009 6:57 pm
by Dr.CSS
Turn off tiny for GCB and put it in there then call GCB in content of page and you can then use tiny to do page edit...

Re: Please help with smarty tag usage

Posted: Fri Jul 31, 2009 8:42 pm
by christophera
Got it :)

Thank you all very much!  That did the trick.

Chris