Re: [SMARTY] How far to go with smarty templating?
| From: | Travis Low | Date: | Sun, 23 Jun 2002 13:26:05 +0000 |
| Subject: | Re: [SMARTY] How far to go with smarty templating? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4973@lists.php.net to get a copy of this message | ||
Whenever I have to do something like this, I dump the database table to a text file, reformat the data (by using regexp search/replace), then reimport the data. Not always easy, or even possible (depends on the data), but when it works, it works great.
cheers,
Travis
Peter Bowyer wrote:
Hello Avern, At 09:22 23/06/02 +0000, Avern Williams wrote:-- Travis Low <mailto:travis@dawnstar.org> <http://dawnstar.org/travis>This may be more of a philosophical smarty question, but here goes. I have an existing php application that does a database query, formats the results, and then displays the formatted results within a webpage. To integrate this app with smarty, does it make more sense for me to: A) have the existing app do the query and format the query results. Then have smarty display those results in a web page OR B) have the existing app only do the database the query, then have smarty both format the query results and display the entire web page Again, I'm new to smarty, but I'd appreciate your opinions on whether one method has advantages over the other.I had the same problem with an old application that I was revamping to use in a Smarty powered site. In the end I came to a compromise and did both. My problem was the addresses I had to print out. The database had 3 columns for the address, + columns for postcode and county. I wanted to separate each line of the address with a ", ". The problem was that not all entries in the database used the three columns, and to print ", , ," looks messy :-) To do this using smarty would have required much logic in the templates - using {if} statements to test whether to add a ", " after each address entry. So I moved this formatting logic into the PHP script and just assigned the complete address string to the template. For other entries in the database I used Smarty's formatting, and it works brilliantly. HTH! Peter --oOo-- Narrow Gauge on the web - photos, directory and forums! http://www.narrow-gauge.co.uk --oOo-- Glenbranter - Scottish narrow gauge in 009 http://glenbranter.narrow-gauge.co.uk --oOo--