Jump to content

Variable from a TPL file


LordBurn

Recommended Posts

Hi to all.

I need to read a varible, an array contained in a tpl file, into another tpl file. This is my actually code.

the file with the array (my-list.tpl):

{php}
$my_list = Array();
$my_list[0]['name'] = 'pluto';
$my_list[1]['name'] = 'pippo';
$this->assign('my_list_tmp',$my_list);
{/php}
{$my_list_tmp.0.name}
{assign var="my_list" value=$my_list_tmp scope=parent}

 

the main file:

{include file="$template/my-list.tpl"}
{$my_list.0.name}

Unfortunally the value of the variable my_list in the main file remain NULL. How can i fix it?

Help me plz. Thank in advice.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated