|
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 |
flipmode85 Smarty n00b
Joined: 08 Sep 2018 Posts: 1
|
Posted: Sat Sep 08, 2018 8:17 pm Post subject: How to get a variable from another template? |
|
|
Hey guys!
i'm new to smarty and doing some learning stuff. Actually i'm stuck getting the needed data.
i need the following generated data, located in templates/common/company_data.tpl
Code: | {capture name="logo_`$obj_id`"}
{if $show_logo}
{if $show_links}<a href="{"companies.products?company_id=`$company.company_id`"|fn_url}">{/if}
<span>
{include file="common/image.tpl" images=$company.logos.theme.image image_width="120"}
</span>
{if $show_links}</a>{/if}
{/if}
{/capture}
|
in this location templates/blocks/product_templates/default_template.tpl
I've tried this...
Code: |
{assign var="logo_data" value="logo_`$obj_id`"}
{$smarty.capture.$logo_data nofilter}
|
Anyone want push me in the right direction? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat Sep 08, 2018 11:51 pm Post subject: |
|
|
Again, don't use captures like that, they are simply not supposed to be used that way.
Use template functions, write proper plugin, use includes. |
|
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
|