Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Search found 8 matches
Smarty Forum Index
Author Message
  Topic: Function parameters in templates
Majiy

Replies: 0
Views: 3140

PostForum: General   Posted: Mon Jul 26, 2010 10:12 am   Subject: Function parameters in templates
I want to call a function from within a template.

As a function parameter, I want to use a config variable PLUS ONE.

How do I do this, if possible, without assigning the value first?

For exam ...
  Topic: Call, Caching and Sub-Templates (RC3)
Majiy

Replies: 1
Views: 5570

PostForum: Smarty 3   Posted: Tue Jul 20, 2010 8:09 pm   Subject: Call, Caching and Sub-Templates (RC3)
I use one main Template file (named "index.tpl"), and several Sub-Templates that extend said template.

In the index.tpl, I use a call to create my siteīs navigation menu:
{call name='cre ...
  Topic: How to define an Array in Smarty Template?
Majiy

Replies: 1
Views: 3872

PostForum: General   Posted: Thu Apr 15, 2010 11:06 am   Subject: How to define an Array in Smarty Template?
Solved it with a string that gets exploded in the function. Would still be interesting to know...
  Topic: How to define an Array in Smarty Template?
Majiy

Replies: 1
Views: 3872

PostForum: General   Posted: Thu Apr 15, 2010 9:56 am   Subject: How to define an Array in Smarty Template?
Iīd like to call a function inside a template.

My problem is: I want to give the function an array (containing strings) as a parameter. How can I do this?

Example (which does not work, just to g ...
  Topic: PHP Autoload doesnīt work in Plugin
Majiy

Replies: 1
Views: 7781

PostForum: Plugins   Posted: Fri Feb 26, 2010 10:35 am   Subject: PHP Autoload doesnīt work in Plugin
In my website, I use an autoload function to include class-files when needed. I define this autoload function BEFORE including smarty.

The auto-loading works in regular php files.

I try to use o ...
  Topic: Problem with Associative Arrays
Majiy

Replies: 6
Views: 10065

PostForum: General   Posted: Tue May 19, 2009 2:23 pm   Subject: Problem with Associative Arrays
It looks like you'll need a tmp var, as object properties don't work as array indexes.

{assign var="idx" value=$product->category_id}
{$category_names[$idx] ...
  Topic: Problem with Associative Arrays
Majiy

Replies: 6
Views: 10065

PostForum: General   Posted: Tue May 19, 2009 2:16 pm   Subject: Problem with Associative Arrays
Thanks for the replies, but both solutions donīt work for me.

I think you're trying to get at
{$categories_names[$product.category_id]}


Result:
Fatal error: Cannot use obje ...
  Topic: Problem with Associative Arrays
Majiy

Replies: 6
Views: 10065

PostForum: General   Posted: Thu May 07, 2009 2:29 pm   Subject: Problem with Associative Arrays
Iīve got two Arrays:

Array #1, named $category_names:

Array(
{foreach from=$products item=product name=foreach_products}
...
{$category_names.$product->category_id} ...
 
Page 1 of 1
All times are GMT
Jump to:  


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