Jump to content

Recommended Posts

how to used Global Smarty Variables in content like <img src="{$base_dir}/img/{$content_id}/cover.png">

  • Like 1

Share this post


Link to post
Share on other sites

it's not possbile to use these variables in CMS contents that you provide in tinymce editor

tinymce editor allows to use only static html / css code

this mean that you can't use there any "server side" scripts like smarty syntax, php etc.

 

 

you can only use smarty syntax in .tpl files.

Share this post


Link to post
Share on other sites

The closest thing you're likely to get is to set up a mini variable system for use in the CMS pages. Usually only useful if you're going to be using a variable a lot, like say the $base_dir variable

 

On your cms.tpl file, just find:

{$cms->content}

And change it to something like:

{str_replace(array('(BASE_DIR)'), array($base_dir), $cms->content)}

Then just enter (BASE_DIR) in your text editor code and it'll auto replace it on the front end.

 

You can add more by comma seperating them into the arrays, i.e.

{str_replace(array('(BASE_DIR)', '(CONTENT_ID)'), array($base_dir, $cms->id_cms), $cms->content)}
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More