Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

In a template, how to PHP query and get the return values

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
TirednBurntOut
Smarty Rookie


Joined: 21 Nov 2014
Posts: 24

PostPosted: Sun Mar 15, 2015 10:54 pm    Post subject: In a template, how to PHP query and get the return values Reply with quote

How do I call/perform a PHP/MySQL query from within a template in order to retrieve more data and bring it back into the template?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Mar 15, 2015 11:54 pm    Post subject: Reply with quote

Write a plugin

See http://www.smarty.net/docs/en/plugins.tpl
http://www.smarty.net/docs/en/plugins.functions.tpl
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Mar 16, 2015 12:41 am    Post subject: Reply with quote

Best course of action would be to NOT do anything of this kind.
You're mixing business logic with template. You'll regret it a year later, when you need to make further changes to the app.
Back to top
View user's profile Send private message
TirednBurntOut
Smarty Rookie


Joined: 21 Nov 2014
Posts: 24

PostPosted: Mon Mar 16, 2015 1:11 am    Post subject: Reply with quote

AnrDaemon wrote:
Best course of action would be to NOT do anything of this kind.
You're mixing business logic with template. You'll regret it a year later, when you need to make further changes to the app.


I beg to disagree. It is business logic I am trying to change. Not helpful.
Back to top
View user's profile Send private message
TirednBurntOut
Smarty Rookie


Joined: 21 Nov 2014
Posts: 24

PostPosted: Mon Mar 16, 2015 1:42 pm    Post subject: Reply with quote

U.Tews wrote:
Write a plugin

See http://www.smarty.net/docs/en/plugins.tpl
http://www.smarty.net/docs/en/plugins.functions.tpl


Yes...and then I remembered I had done it before.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP