Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Search found 210 matches
Smarty Forum Index
Author Message
  Topic: How find where will data pass?
bsmither

Replies: 11
Views: 183

PostForum: General   Posted: Fri May 24, 2019 9:48 am   Subject: How find where will data pass?
What makes a template engine useful is that the application determines important things and then a conclusion is assigned to a Smarty variable: a specific language, a defined set of instructions, etc. ...
  Topic: How find where will data pass?
bsmither

Replies: 11
Views: 183

PostForum: General   Posted: Sun May 19, 2019 7:05 pm   Subject: How find where will data pass?
I think you cannot get to file_dependency. I think that is because this array is created after the template is compiled, but you may be asking for it before the template is compiled.

Instead, in th ...
  Topic: How find where will data pass?
bsmither

Replies: 11
Views: 183

PostForum: General   Posted: Sat May 11, 2019 11:29 pm   Subject: How find where will data pass?
I am not aware of how one can get Smarty to do its thing using means other than its published API. That is, fetch() and display() are the only means I know of.

Of course, one can create a Class set ...
  Topic: Want to check if the values are duplicate.
bsmither

Replies: 4
Views: 119

PostForum: Smarty Development   Posted: Thu May 09, 2019 6:22 pm   Subject: Want to check if the values are duplicate.
The following should work (but I haven't tried it):
PHP Code:
$array = ["red","blue","green","green"];
$arrValueCounts = array_count_values($ ...
  Topic: [Solved] Display in same div products with same value
bsmither

Replies: 2
Views: 100

PostForum: General   Posted: Tue May 07, 2019 2:34 am   Subject: [Solved] Display in same div products with same value
You would have to presort the given array into a new multi-level array.
{foreach $orders as $n}
{$OIDs[{$n.order_id}][] = $n}
{/foreach}

T ...
  Topic: [Solved] Getting sum of values in multi dimensional array
bsmither

Replies: 4
Views: 122

PostForum: General   Posted: Mon May 06, 2019 4:59 am   Subject: [Solved] Getting sum of values in multi dimensional array
{$cart_item_count += $cartItem.quantity}" - Unexpected "= "Interesting. It then appears that Smarty (at least the version you are using) does not know about the operator short ...
  Topic: [Solved] Getting sum of values in multi dimensional array
bsmither

Replies: 4
Views: 122

PostForum: General   Posted: Sun May 05, 2019 11:14 pm   Subject: [Solved] Getting sum of values in multi dimensional array
I would try:
{$cart_item_count = 0}
{foreach $session.shopping_cart as $cartItem}
{$cart_item_count += $cartItem.quantity}
{/foreach}
Total item count: ...
  Topic: Return first x items in array, return items after x
bsmither

Replies: 2
Views: 162

PostForum: General   Posted: Sun Apr 21, 2019 5:54 pm   Subject: Return first x items in array, return items after x
This effect could be caused by Smarty honoring line endings after the control structure tags. If so, you may need to run the tags together:
{foreach from=$crt_certificates_prd_products_1 item=ID ...
  Topic: Unable to load template (Hosted site)
bsmither

Replies: 1
Views: 301

PostForum: Article Discussions   Posted: Fri Apr 05, 2019 1:39 am   Subject: Unable to load template (Hosted site)
According to https://www.smarty.net/docs/en/resources.tpl the section "Templates from any directory", you need to specify a computer's filesystem path - not a URI.

So, you might try:
 ...
  Topic: Display array as nested list
bsmither

Replies: 6
Views: 6536

PostForum: General   Posted: Fri Mar 01, 2019 3:42 am   Subject: Display array as nested list
Do you have access to, and can edit the source PHP code that populates the Smarty variables?

If so, you can build your $list with child branches. Then pass the whole tree to Smarty.
  Topic: dashed array key
bsmither

Replies: 2
Views: 614

PostForum: General   Posted: Thu Feb 14, 2019 7:01 pm   Subject: dashed array key
I believe this works:
{$activity['start-date']}
  Topic: Can't get Smarty to register new plugin
bsmither

Replies: 23
Views: 1180

PostForum: Installation and Setup   Posted: Tue Feb 05, 2019 2:39 am   Subject: Can't get Smarty to register new plugin
I think the name of the callback argument needs to be the actual name of a function that PHP is already aware of.

The plugin block.t.php is probably parsed by PHP early enough, so the names of the ...
  Topic: Total of "Row Numbers" in tpl? (Hiring/Paid)
bsmither

Replies: 4
Views: 1615

PostForum: Help Wanted (commercial)   Posted: Fri Jan 04, 2019 1:28 am   Subject: Total of "Row Numbers" in tpl? (Hiring/Paid)
See also:
https://www.smarty.net/docs/en/language.function.foreach.tpl#foreach.property.total
  Topic: how to use isset without generating notice ?
bsmither

Replies: 5
Views: 1099

PostForum: General   Posted: Sun Dec 16, 2018 8:03 am   Subject: how to use isset without generating notice ?
Let's try a few variants and see which works. Even though PHP understands $$varname, we need to check to determine if Smarty parses it that way.

Also, break apart the statement so that the error ge ...
  Topic: Prestashop 1.7 and layout
bsmither

Replies: 2
Views: 1817

PostForum: Frameworks   Posted: Sat Dec 01, 2018 12:32 am   Subject: Prestashop 1.7 and layout
I would try this:

<div class="category-cover">
<img src=
"{$category.image.large.url|default:'url_of_cat_id_1_large_image'}"
alt=
"& ...
 
Page 1 of 14 Goto page 1, 2, 3 ... 12, 13, 14  Next
All times are GMT
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP