Page 1 of 1

user defined tag and {literal} {/literal} help

Posted: Fri Feb 13, 2009 5:09 am
by jdwork
I have a javascript calendar that I wanted to put into a user defined tag.

I pasted the script between {literal} {/literal} tags into a proper web page and it works fine.

When I paste the code into a user defined tag I get a syntax error on the curly brace } line 1.

I tried the documentation sample:

Code: Select all

  {literal}
  <__script__ language="JavaScript" type="text/javascript">
  // code here
  </__script>

  <style type="text/css">
  /* css here */
  </style>
  {/literal}
and I get the same error:
# Parse error: syntax error, unexpected '}' in /home/www/cmsmadesimple/admin/adduserplugin.php(100) : eval()'d code on line 1

Any ideas?
Thanks in advance!

Re: user defined tag and {literal} {/literal} help

Posted: Fri Feb 13, 2009 5:20 am
by viebig
UDT´s are PHP Code
Global Contents Blocks are smarty

if you want that on a UDT you should use

Code: Select all

echo '
 <__script__ language="JavaScript" type="text/javascript">
  // code here
  </__script>

  <style type="text/css">
  /* css here */
  </style>
';
Dont forget to escape chars!

then call it by {udtname}

If you use GCB´s

Code: Select all

 {literal}
  <__script__ language="JavaScript" type="text/javascript">
  // code here
  </__script>

  <style type="text/css">
  /* css here */
  </style>
  {/literal}
and call it by using {global_content name="gcbname"}

Hope that helps!