Anzeo Posted November 21, 2009 Share Posted November 21, 2009 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. Quote Link to comment Share on other sites More sharing options...
Zyx Posted November 22, 2009 Share Posted November 22, 2009 You forgot the curly brackets around the variables: {$MYPOEF[row].ID} Quote Link to comment Share on other sites More sharing options...
Anzeo Posted November 22, 2009 Author Share Posted November 22, 2009 You forgot the curly brackets around the variables: {$MYPOEF[row].ID} OMG ... can't believe I didn't realize that -__-. Thanks a bunch! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.