|
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 |
dmllc Smarty Rookie
Joined: 15 Oct 2010 Posts: 6
|
Posted: Sun Mar 25, 2012 6:57 pm Post subject: including dynamic tpl content |
|
|
smarty n00b here. i need some help trying to figure out how to include a recordset into multiple templates.
i have a php script which queries a db and outputs the results into a template named mod_citylist.tpl. this works fine. i can access this file via the broswer and see the results. the problem is when i try to include mod_citylist.tpl into other templates which need the same data. i get the following errors:
Notice: Undefined index: results in C:\Users\dev\workspace\templates_c\ea66ce8811d4c8679cbd06944e2437ef9a7a8e76.file.mod_citylist.tpl.php on line 30
Notice: Trying to get property of non-object in C:\Users\dev\workspace\templates_c\ea66ce8811d4c8679cbd06944e2437ef9a7a8e76.file.mod_citylist.tpl.php on line 30
i am not sure if i am approaching my design in the right manner or how to fix the problem. any ideas? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Mar 25, 2012 8:28 pm Post subject: |
|
|
If you include mod_citylist.tpl into other templates you must also query the db and assign the result. |
|
Back to top |
|
dmllc Smarty Rookie
Joined: 15 Oct 2010 Posts: 6
|
Posted: Sun Mar 25, 2012 9:03 pm Post subject: |
|
|
if i need to access this results set from other templates throughout the site, should i implement it as a plugin? |
|
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
|