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

Include template $variable

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
okoweb
Smarty n00b


Joined: 09 Apr 2014
Posts: 3

PostPosted: Wed Apr 09, 2014 10:15 am    Post subject: Include template $variable Reply with quote

Good day.
I do this :
Code:
{foreach from=$posts key=k item=post}
   {$post.post_format} //show audio
   {include file="post-format/content-audio.tpl"} //include "post-format/content-audio.tpl correctly
   {include file="post-format/content-$post.post_format.tpl"} //Error : Unable to load template file 'post-format/content-Array.post_format.tpl'
{/foreach}


Why can i have error on second include
Code:
{include file="post-format/content-$post.post_format.tpl"}

Quote:
//Error : Unable to load template file 'post-format/content-Array.post_format.tpl'


Thank.
Back to top
View user's profile Send private message
okoweb
Smarty n00b


Joined: 09 Apr 2014
Posts: 3

PostPosted: Wed Apr 09, 2014 12:01 pm    Post subject: Reply with quote

I concatenate like this :
Code:
{include file="post-format/content-`$post.post_format`.tpl"}


This code display de same error with previous code.
Back to top
View user's profile Send private message
okoweb
Smarty n00b


Joined: 09 Apr 2014
Posts: 3

PostPosted: Wed Apr 09, 2014 12:27 pm    Post subject: Reply with quote

Sorry the last code work perfectly.

Thank.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    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