You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my React-JS Project, I am trying to use the smarty template. It is working for variables but it is not working at all for the loop and conditional statement. I have following code written in my template :
Following Data From Template
<div>
Simple Data Passing <br/>
<h1>{$data}</h1>
<hr/>
for loop code : <br/>
{$ar = ['a','b','c','d']}
{for $i=0 to $ar|count-1 max=3}
{$ar[$i]}
{/for}
<hr />
if statement : <br/>
{assign var='xyz' value="1"}
{if '1' eq $xyz }
if condition working
{else}
if condition is not working
{/if}
</div>
Which is giving following output :
<div>Simple Data Passing <br>
<h1>Hello World</h1>
<hr>
for loop code : <br>
<hr>
if statement : <br>
{if '1' eq $xyz }
if condition working
{else}
if condition is not working
{/if}
</div>
Here I am passing the $data as "Hello World" it is working properly, but the below of for each is not working.
So could you please help me with this?
The text was updated successfully, but these errors were encountered:
You have to register count modifier yourself in the new jSmart version. It has been removed in new version like Smarty did. Here is smarty link documentation which shows no mention of |count modifier:- https://www.smarty.net/docs/en/language.modifiers.tpl
In my React-JS Project, I am trying to use the smarty template. It is working for variables but it is not working at all for the loop and conditional statement.
I have following code written in my template :
Following Data From Template
<div>
Simple Data Passing <br/>
<h1>{$data}</h1>
<hr/>
for loop code : <br/>
{$ar = ['a','b','c','d']}
{for $i=0 to $ar|count-1 max=3}
{$ar[$i]}
{/for}
<hr />
if statement : <br/>
{assign var='xyz' value="1"}
{if '1' eq $xyz }
if condition working
{else}
if condition is not working
{/if}
</div>
Which is giving following output :
<div>Simple Data Passing <br>
<h1>Hello World</h1>
<hr>
for loop code : <br>
<hr>
if statement : <br>
{if '1' eq $xyz }
if condition working
{else}
if condition is not working
{/if}
</div>
Here I am passing the $data as "Hello World" it is working properly, but the below of for each is not working.
So could you please help me with this?
The text was updated successfully, but these errors were encountered: