Implementing the 360 magic spin in smarty - smarty

I can't integrate the 360 magic spin in smarty templates. While adding the following code
<a class="Magic360" href="assets/spin-images/Bar-360-01.jpg" data-magic360-options="filename: Bar-360-{col}.jpg;">
While adding the attribute of data-magic360-options with filename, the screen will goes blank.
I amusing smarty 2.x.

Smarty (PHP framework) counts all strings {..} like its own directives.
To avoid that, you should use the following code:
{literal}<a class="Magic360" href="assets/spin-images/Bar-360-01.jpg" data-magic360-options="filename: Bar-360-{col}.jpg;">{/literal}
or
<a class="Magic360" href="assets/spin-images/Bar-360-01.jpg" data-magic360-options="filename: Bar-360-{ldelim}col{rdelim}.jpg;">

Did you forget $ sign for col variable?
data-magic360-options="filename: Bar-360-{col}.jpg;"
Maybe you should use {$col}:
<a class="Magic360" href="assets/spin-images/Bar-360-01.jpg" data-magic360-options="filename: Bar-360-{$col}.jpg;">

Related

smarty cs-cart assign a link to a variable

I am learning smarty. I want to assign a link to a variable:
{assign var="book_link" value="`$smarty.capture.$name` nofilter"}
I want to use truncate to produce that book_link, so i use
<div class="title-book">{$book_link|truncate:50}</div>
But it did not work.
just change the double quotes from value and try this
{assign var="book_link" value=`$smarty.capture.$name` nofilter}

Laravel blade not escaping HTML

I am using Laravel 5.2 and for some reason the blade standard tags {{...}} are not escaping HTML as wrote in the documentation.
When I tries to write for example {{ HTML::tag('span','hello') }} I get the correct HTML and see hello in my browser. The I get same results if I write {!! HTML::tag('span','hello') !!}.
So why the {{...}} tags does not escaping the HTML tags, as they should?
you should use {{...}} for variable printing.
and {!!...!!} this for normal html. you can just write plain html without braces and it will show correctly.

CKEDITOR's source code mode scrambles custom template code

I'm trying to allow custom "template code" within the source code editor. My code snippets would always look like {* anything here *}. It mostly works, but if used inside an HTML tag things gets scrambled.
I'm already using allowedContent: true, when starting CKEDITOR.
Example:
<p style="{* some "short code" of mine... *}">Text</p>
turns into
<p style="{* some " short="" code"="" of="" mine...="" *}"="">Text</p>
And
<p {* tet_pos_is_inside *}>Fuss</p>
into
<p {*="" tet_pos_is_inside="" *}="">Fuss</p>
Any advise ?
Thanks,
Sebastian
My advise would be to never use them inside tags, it sounds like a nightmare to configure. What is the requirement you are trying to fill with those?
You could go around this issue with pre- and post processing using classes, data attributes and/or custom attributes. For example you could use something like his:
<p class="tet_pos_is_inside_val-12345 foo-val-12345">I love horses</p>
<p data-tet_pos_is_inside="12345" data-foo="">I love bunnies</p>
<p tet_pos_is_inside="12345" foo="">I love cats</p>
Well,
apparently there was a simple solution to solve my current problem:
<p style="{* some 'short code' of mine... *}">Text</p>
works ! Note the use of singe-quotes inside the double quotes.
IOW, as long as there is a <tag attr="val"> then val can be anything except containing more double quotes.
Thanks for the comments.

Joomla overrides my Quotes to &quote

I was trying to take advantage of the joomla class input by entering scroll-link" data-id="home so the output would be: <a class="scroll-link" data-id="home" href="#homes">Home</a> but instead joomla outputs: <a class="scroll-link" data-id="home" href="#homes">Home</a> Is there any way to turn off the conversion to &quot?
The correct way to do this is by overriding your menu module's output and adding the data-id attribute. Read more about layout overrides here - http://docs.joomla.org/Layout_Overrides_in_Joomla
What you're trying will not work since the class suffixes are most probably escaped to avoid incompatible characters.

Eval Smarty Code inside a Smarty Template

is there a way to evaluate Smarty Code inside an existing Smarty template? For example, I may have the following construct:
smartyTemplate.tpl
<body>
<div id="dynamicPart">
{$valueFromDatabase}
</div>
</body>
Whereas the Smarty variable $valueFromDatabase contains another Smarty Template which I would like to be inserted in place of the variable and then evaluated as a template (with all the logic expressions in replacements neccessary).
without a custom resource, you could have just used an {include file="your/template.tpl"}. Or render the template from the database in code using $smarty->fetch("your/template.tpl") and assigning that to $valueFromDatabase.
{eval var=$valueFromDatabase}
will work

Resources