 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. |
|
View previous topic :: View next topic |
Author |
Message |
4Axis Smarty n00b
Joined: 01 Sep 2015 Posts: 2
|
Posted: Tue Sep 01, 2015 8:04 am Post subject: "math" w tpl nie dziala |
|
|
Witam.
Chciałbym wykonać mnożenie w zmiennych w tpl.
Ale niestety nie działa i nie wiem dlaczego. Kod:
Code: |
{assign var="name" value=$product['name']|substr:-15}
{assign var="pos" value=$name|regex_replace:"/[\D]/":""}
{assign var="alla" value=$product['quantity']}
{$product['quantity']} --- {$pos} --- {$alla}
{math assign="span" equation="x * y" x=(int)$pos y=(int)$alla}
{$span} |
Powyższy fragment kodu generowany jest dla maila z potwierdzeniem zamówienia w prestashop.
Czyste $pos=50 a $alla=1, z (int) $pos=50 a (int)$alla=0.
Jeżeli próbuję math bez (int) to nic nie pokazuje.
Proszę o pomoc |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1701
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|