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

How to use smarty function in an include

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
BUONJG
Smarty n00b


Joined: 25 Feb 2011
Posts: 1

PostPosted: Fri Feb 25, 2011 6:08 pm    Post subject: How to use smarty function in an include Reply with quote

Hello,

I have a question about how to use a smarty function in an include.

I have the following:

{include file='std_header.email.tpl' title="$title"}


It works fine, the variable $title is passed to the called template.

I have also a smarty function I use like that :
{gconfig module='TDL_ETATS' value=$etat}

It works really fine.

But now, I would like to mix to two, but I don't know how...

I tried :
- {include file='std_header.email.tpl' title="{gconfig module='TDL_ETATS' value=$etat}"}

and :
- {include file='std_header.email.tpl' title="gconfig module='TDL_ETATS' value=$etat"}

It doesn't work...

Any body can help me?

Regards,

Jean-Guy BUON
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Feb 26, 2011 11:05 am    Post subject: Reply with quote

In Smarty3
Code:
{include file='std_header.email.tpl' title="{gconfig module='TDL_ETATS' value=$etat}"}
should work.

For Smarty2 use
Code:
{capture assign='title'}{gconfig module='TDL_ETATS' value=$etat}{/capture}
{include file='std_header.email.tpl' title=$title}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP