[solved] How to deal with {} sign that are not meant to be CMSMS tags

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Apprentice
Forum Members
Forum Members
Posts: 20
Joined: Tue Nov 11, 2008 11:25 pm

[solved] How to deal with {} sign that are not meant to be CMSMS tags

Post by Apprentice »

Hello,

I'm having a problem installing JavaScipt to webpages using CMSMS. The script doesn't work and I think it is because CMSMS interprets {} signs in this code wrongly (its working fine outside CMSMS, although directory paths are bit different):

                   



Shadowbox.loadSkin('classic', 'uploads/js/src/skin');
Shadowbox.loadLanguage('en', 'uploads/js/src/lang');
Shadowbox.loadPlayer(['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'], 'uploads/js/src/player');

window.onload = function(){
                    Shadowbox.init();
};


How can I get this working? Are [] signs in the code ok?

Thanks already.
Last edited by Apprentice on Fri Dec 19, 2008 4:55 am, edited 1 time in total.
reneh
Dev Team Member
Dev Team Member
Posts: 446
Joined: Tue Nov 28, 2006 8:39 pm

Re: How to deal with {} sign that are not meant to be CMSMS tags

Post by reneh »

the Smarty get confused if you include {} in the content!
This is fundamental Smarty knowledge:
Suround your scripts that include {}  with literal tags like this: {literal} {your code} {/literal}
ReneH 8-)
A search will save you hours waiting for an answer! Image
benjamin72070
Forum Members
Forum Members
Posts: 10
Joined: Tue Dec 02, 2008 8:04 pm

Re: How to deal with {} sign that are not meant to be CMSMS tags

Post by benjamin72070 »

From the Smarty docs page:
Escaping Smarty Parsing

It is sometimes desirable or even necessary to have Smarty ignore sections it would otherwise parse. A classic example is embedding Javascript or CSS code in a template. The problem arises as those languages use the { and } characters which are also the default delimiters for Smarty.

The simplest thing is to avoid the situation altogether by separating your Javascript and CSS code into their own files and then using standard HTML methods to access them.

Including literal content is possible using {literal}..{/literal} blocks. Similar to HTML entity usage, you can use {ldelim},{rdelim} or {$smarty.ldelim} to display the current delimiters.

It is often convenient to simply change Smarty's $left_delimiter and $right_delimiter.
Regards,

Ben  ;D
Hannibal
Forum Members
Forum Members
Posts: 74
Joined: Wed Nov 05, 2008 5:47 pm

Re: [solved] How to deal with {} sign that are not meant to be CMSMS tags

Post by Hannibal »

Exellent, this was exactly what I was looking for!  8)

Should have thought of the {literal} tags.
Post Reply

Return to “CMSMS Core”