X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   How to include Smarty variable into path to file (https://forum.x-cart.com/showthread.php?t=36487)

HumanNature 01-02-2008 03:01 PM

How to include Smarty variable into path to file
 
Dear friends,

I have a custom smarty variable in my '$page_data' array called '$page_data.pagemenu'

The value of '$page_data.pagemenu' is the text 'pagemenu.tpl'.

If I write the following in my templates {$page_data.pagemenu} I obtain the text 'pagemenu.tpl' written, which is OK.

The problem is that I need to use '$page_data.pagemenu' to include a file this way:

{include file="path/to/{$page_data.pagemenu}" }

Doing this I try to include the following file:

{include file="path/to/pagemenu.tpl"}

I don╢t Know why but I allways obtain an smarty error and I have tried a lot of different sintaxes with no luck.

Can you please help me?

inebriate 01-02-2008 04:24 PM

Re: How to include Smarty variable into path to file
 
use back quotes to evaluate like in unix/linux ('':literal, "":expression, ``:evaluate)

ie:
{include file="path/to/`$page_data.pagemenu`" }


All times are GMT -8. The time now is 07:17 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.