|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
okoweb Smarty n00b
Joined: 09 Apr 2014 Posts: 3
|
Posted: Wed Apr 09, 2014 10:15 am Post subject: Include template $variable |
|
|
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 |
|
okoweb Smarty n00b
Joined: 09 Apr 2014 Posts: 3
|
Posted: Wed Apr 09, 2014 12:01 pm Post subject: |
|
|
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 |
|
okoweb Smarty n00b
Joined: 09 Apr 2014 Posts: 3
|
Posted: Wed Apr 09, 2014 12:27 pm Post subject: |
|
|
Sorry the last code work perfectly.
Thank. |
|
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
|