Jump to content

Smarty won't assign section values


Anzeo

Recommended Posts

Hi all,

 

 

 

I've recently switched from TemplatePower to Smarty and it was definitely the right choice. I'm fiddling around a bit with all the possibilities and stumbled upon a strange porblem, which I seem not to be able to fix.

 

I want to use a simple section, my template code is:

{section name=row loop=$MYPOEF}
{strip}
$MYPOEF[row].ID
$MYPOEF[row].Username<br />
{/strip}
{/section}

 

and in my php file I have:

 $qry = new SelectQuery("SELECT ID,Username FROM USER", TRUE );
$tpl->assign("MYPOEF",$qry->result());

 

the $qry->result returns an associative array (var_dump below):

array(3) { 
[0]=>  array(2) { ["ID"]=>  string(1) "1" ["Username"]=>  string(4) "test" }
[1]=>  array(2) { ["ID"]=>  string(1) "2" ["Username"]=>  string(5) "test1" }
[2]=>  array(2) { ["ID"]=>  string(1) "3" ["Username"]=>  string(5) "test2" }
} 

 

Which seems correct to me? Yet the output is:

$MYPOEF[row].ID $MYPOEF[row].Username
$MYPOEF[row].ID $MYPOEF[row].Username
$MYPOEF[row].ID $MYPOEF[row].Username 

 

I've tried searching for tutorials, looked into the manual over and over but I can't seem to figure out what's wrong with this? (other variables on the pages are assigned correctly and I have setup the $tpl object correctly as a smarty one).

 

Does anyone see what I'm doing wrong here? Any help greatly appreciated.

 

 

 

Thanks in advance,

A.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.