I am starting over and relearning Drupal, hopefully unlearning some bad habits. I'm reading Drupal 6 Themes by Ric Shreves and he briefly covers different theming engines Drupal can use, one of which being Smarty.
One bad a habit I started with is sometimes putting queries or other complex logic in tpl files. It was often difficult to follow the chain up to the preprocessor or module in order to get what you wanted. Also, quite frankly, when you're on a deadline it just works.
In my short experience with Smarty I remember it boiling down to formatting and simple loop constructs, so you had to to find the preprocessing function. If I was forced to use Smarty when I first started with Drupal, I probably wouldn't be in the state I am now.
Finally a question. Is there a case to be made for people picking up Drupal for the first time to use Smarty?
Admittedly, I haven't used Smarty myself, but I wouldn't recommend it. The vast majority of Drupal documentation, books, blog posts, etc are based on PHPTemplate. The majority of Drupal developers you might turn to, if you need help, aren't going to know Smarty, or at least won't know it as well as they know PHPTemplate.
I think you'd just be trading one problem for a another, different problem. Instead, I think you'd be better off digging in and trying to solve the original problem by learning the preferred way to do things.
I agree from past experience, it will be easier in the long term to just learn PHP fundamentals before trying work with drupal. Everything will make more sense if you have a good PHP base. Especially when it comes to the CMS.
Well, I have to disagree. Smarty is a fantastic way to make a clean separation of the presentation layer:
I think you will find that developers who have experience with Smarty will generally have a lot of loyalty too it. The newest 3.x versions are fantastic.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.