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

SQL parsing folders aka sql and sql_c CLASS (and LANGUAGE)

 
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 -> Feature Requests
View previous topic :: View next topic  
Author Message
JurgenD
Smarty Rookie


Joined: 20 Jul 2005
Posts: 12
Location: Belgium

PostPosted: Mon Sep 12, 2005 8:27 am    Post subject: SQL parsing folders aka sql and sql_c CLASS (and LANGUAGE) Reply with quote

I am thinking. Maybe smarty can be aggregated one level, and my opinion, this will not be too hard to do is.

So:

A) You strip off the parse engine
B) You create an child class for TEMPLATES
C) You create an child class for SQL files (dot sql)
D) You provide two additional folders sql and sql_c

In this way, we should be able to put our sql into separate text files (like example.sql) and they can be parsed (and compiled) by the smarty+ engine.

And maybe the same for languages config files, because they often need parsed values too.

language
language_c
Back to top
View user's profile Send private message Visit poster's website
TrevorP
Smarty n00b


Joined: 19 Sep 2005
Posts: 1
Location: Australia

PostPosted: Mon Sep 19, 2005 5:20 pm    Post subject: Object-Oriented Smarty Templating Reply with quote

I have been involved in a project (long term university group assignment), developing a smarty+php+mysql app, and spent some time looking for a way to simplify DB access. I ended up writing a set of classes, and some smarty plugins to turn smarty into an object oriented database interface (with no modification to the original smarty classes, all be it we're still using 2.5.0).
At first it was only an idea, which I started developing in my own time to prove the concept, and have since donated the code for use in the project. The code is now being developed in parallel with the project, but has been kept 90% generic and isolated from the specific project.
If anyone is sufficiently interested I'd be happy to take the time to extract the code.
Its pretty ad-hock at the moment, but is proving to be quite powerful, we are now using it through the entire application (with the exception of testing scripts), sometimes allowing database processing to be done in smarty with no PHP at all.

The system is based on the idea that every record is an object. You call a generator template as a starting point to get the starting object (or array of objects). you can then call fields on that object. If the field links to another table, a query will automatically be performed to retrieve the foreign data (either single record, or array). It supports custom queries (views) to provide field formatting or extra calculated fields, virtual fields (queries that link to tables and act like fields), updating, inserting, deleting, and if there's something it still cant do, custom classes for each table (untested as yet, as we haven't needed it).

I *may*, at the end of the year (if I think I will ever use PHP again) clean up the code and publish it as a generic library, but as I mentioned above, I would be glad to donate it if anyone else would like to develop it.

Some (very quickly written) documentation may be found here:
http://peacocktech.com:8080/mediawiki/index.php/Smarty_db

Our application is available here:
http://itc307.peacocktech.com:8080/timeshare/
(updated every 10 minutes from CVS, feel free to play, promise not to screw with it)

Two related threads on this forum:
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=2281
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=222
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
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 -> Feature Requests 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