|
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 |
s2xi Smarty Rookie
Joined: 02 Mar 2011 Posts: 8
|
Posted: Sat Apr 16, 2011 5:06 am Post subject: Get values from PDO query and pass the fields into an array |
|
|
How can I do the following.
1. Get values from a PDO statement (I have already done this)
2. Pass each value as an array object that I can construct like this
(this is an insert from my class file that handles the connection via PDO and data manipulation)
$r = $this->query($sql);
foreach($r as $m)
{
$contents = $smarty->fetch($path_to_module);
$smarty->assign($m['module_name']."_module", $contents)
}
is this the correct way to approach this?
My goal is to not do any logic in the template file but rather just simply insert variables like
{$navigation_module}
{$search_module} |
|
Back to top |
|
s2xi Smarty Rookie
Joined: 02 Mar 2011 Posts: 8
|
Posted: Sat Apr 16, 2011 9:00 am Post subject: |
|
|
aaah, i see. wish i could understand the thread but i got it by looking at the code snippet. Gave me the idea! thank you my friend. |
|
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
|