-
Website
http://buildingbrowsergames.com -
Original page
http://buildingbrowsergames.com/2008/05/22/building-browsergames-a-brief-design-document/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
gabrielbianconi
1 comment · 1 points
-
Luke
82 comments · 1 points
-
spatlabor
1 comment · 1 points
-
HughCompton
2 comments · 1 points
-
obat jerawat
1 comment · 1 points
-
-
Popular Threads
If u have a link to something u can mail me.
Greetings
a templating system lets you keep design and code separate from each other.
There is no Smarty-less version of the tutorials.
Keeping presentation separate from business logic is the foundation for good development, however, PHP is already a templating system. Using an abstraction on top of something that already does a good job at abstracting code is not a good idea.
Many languages do not have the luxury of combining code with HTML, which forces them to keep it separate and building the abstractions into their business logic. This creates complexities that are not needed. The primary focus should be building a solution as quickly, but as professional as possible.
Smarty goes against this by forcing both the designers and programmers to learn the language of Smarty. You then have to hope that the next project also uses Smarty and not some other convoluted custom system. I've seen many custom templating systems and I have to say that not many projects use Smarty.
Another issue from the developer's point-of-view is extensibility, which is difficult for Smarty, because while it has its own API for it, not every custom templating system will. The API for Smarty (when I last checked) was not as simple as it should be.
When I write a template system for a project, I think of WordPress, because they do it as easy as possible for both developers and designers ("Just plug this code in to your code and it just works"... "In most cases."). As opposed to spending two or three weeks learning how to use Smarty and other two or three weeks trying to learn how to extend Smarty with custom tags.
I can do everything Smarty does using just (X)HTML and PHP, which Smarty abstracts from the developer and designer. If you ask me, PHP is far easier to use than the syntax Smarty forces you to use.
business logic and presentation code(and even seems to encourage you to),
I'm wary of writing code that does that. Frequently for my own projects they
have begun with a sole developer(me), and then as they have gone on the team
has grown - all too often, a designer who knows nothing of PHP and has no
desire to learn it is the one who will be doing the final design for the
game. In those situations, being able to give them a list of the variables
available to them in the template and the Smarty documentation has proven
extremely useful to allow me to keep focusing on features, while someone
else focuses on making things look nice.
While embedding PHP directly into your files is an option, it is a bit of a
messy one - and it makes it far too easy for someone who doesn't know enough
PHP to have a firm grasp on what they're doing to break something that they
shouldn't.
To be clear, I am certainly not saying that Smarty is the *best* or *only* way to develop. I'm simply saying that your code *should* be abstracted from your presentation, and using a templating engine like Smarty or something else is a better way of doing that(in my opinion) than relying on someone copying and pasting code without understanding what it does.