sequalit Posted March 30, 2008 Share Posted March 30, 2008 Read this -> http://www.sitepoint.com/forums/showpost.php?p=498687&postcount=15 What do you guys think? I think he's right, a template engine just makes things go that much slower... Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/ Share on other sites More sharing options...
dbo Posted March 30, 2008 Share Posted March 30, 2008 I don't have enough of an attention span to read that entire rant, but in general yes I agree. Templating systems can create some overhead. I think the big sell for something like smarty is that it forces it's rules on you (whereas the generic version doesn't), for most things this is good, but for large software applications, not so much. Also, by using a third party templating system like that you can easily develop your system in a way that others can easily replace the theme of the said system. Without something like smarty, it requires someone to first learn the way the said system does it in order to change the presentation. So yeah, smarty provides some interoperability that would not otherwise exist. All that being said, for my little generic MVC framework thingy I built. I built a templating system in place of the view, that works in the same manner that the article displays. It also handles my server side caching. Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-505153 Share on other sites More sharing options...
sequalit Posted March 30, 2008 Author Share Posted March 30, 2008 do you mind sharing ? Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-505157 Share on other sites More sharing options...
dbo Posted March 30, 2008 Share Posted March 30, 2008 Send me a PM and I'll send you the framework. The file you'll be interested in is Template.php Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-505158 Share on other sites More sharing options...
448191 Posted March 31, 2008 Share Posted March 31, 2008 Some people hold on religously to Smarty. I think it sucks. This guy makes some good points as well: http://www.sitepoint.com/article/beyond-template-engine/1 Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-505391 Share on other sites More sharing options...
roopurt18 Posted March 31, 2008 Share Posted March 31, 2008 I use PHP as my template engine. I don't see any reason to add another layer on what can already become a bogged down process (i.e. generating a page). Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-505727 Share on other sites More sharing options...
sequalit Posted April 1, 2008 Author Share Posted April 1, 2008 Thank you dbo and 448191 I ended up looking at both for examples and idea's and built my own I now have a great MVC template system that I LOVE!!!! It's so awesome, works great! I love you guys ;p Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-506207 Share on other sites More sharing options...
dbo Posted April 1, 2008 Share Posted April 1, 2008 Rock on Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-506235 Share on other sites More sharing options...
Daniel0 Posted April 2, 2008 Share Posted April 2, 2008 I don't mind template engines as long as they use PHP. I find it a bit stupid "inventing" a new language for the sole purpose of that template engine. Even if your code is something like this: function getTemplate($name) { include 'templates/' . $name . '.php'; } then it's still a template engine because of what the code do. Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-507182 Share on other sites More sharing options...
Liquid Fire Posted April 2, 2008 Share Posted April 2, 2008 I don't mind template engines as long as they use PHP it not really a template engine but a "view" file using php. Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-507307 Share on other sites More sharing options...
Daniel0 Posted April 2, 2008 Share Posted April 2, 2008 Uhm... there is no difference except for the language used. <ul> <?php foreach ($users as $user): ?> <li><a href="/profile/<?php echo $user->username ?>"><?php echo $user->username ?></a></li> <?php endforeach ?> </ul> <ul> {foreach from=$users item=user} <li><a href="/profile/{user->username}">{user->username}</a></li> {/foreach} </ul> Both of them could be template files thus the code which deals with the template files is a template engine. Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-507378 Share on other sites More sharing options...
skalli Posted April 2, 2008 Share Posted April 2, 2008 I agree with the author's point. Since I made my first experiences with Smarty, i wondered how people could use it - it's only an overlay for php-amateurs, who aren't aware of the functionalities of PHP. Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-507659 Share on other sites More sharing options...
moon 111 Posted April 2, 2008 Share Posted April 2, 2008 Most of the PHP programmers don't know what an O(n^2) algorithm is, or who Donald Knuth is, or why a sorting algorithm can never be faster than O(n log n), or how Dijkstra's shortest path algorithm works. Well I for one don't know any of that. Would anyone like to recommend a book/tutorial? Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-507728 Share on other sites More sharing options...
Daniel0 Posted April 2, 2008 Share Posted April 2, 2008 Most of the PHP programmers don't know what an O(n^2) algorithm is, or who Donald Knuth is, or why a sorting algorithm can never be faster than O(n log n), or how Dijkstra's shortest path algorithm works. Well I for one don't know any of that. Would anyone like to recommend a book/tutorial? The thing about the O is called Big O notation and is a way of measuring efficiency. E.g. if an algorithm is running at O(n^2) it means that the system resources used or the running time will increase quadratically as you add more data to be processed by the algorithm. Any book about algorithms would probably cover that. I believe "Introduction to Algorithms" is a pretty common one. Otherwise just google it. Donald Knuth is a famous computer scientist. Again, just google him. Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-507740 Share on other sites More sharing options...
dbo Posted April 2, 2008 Share Posted April 2, 2008 It's mostly rubbish anyways. You can be a good programmer without knowing any of that. Big O notation is just a way to mathematically represent runtimes. In Computer Science, we are usually interested in the worst case. O(n^2) would be like a loop nested inside of a loop... so a single loop would be O(n) or a loop inside a loop thats inside a loop would be O(n^3) etc. No idea who Donald Knuth is... nor do I care. Sorting algorithms can't be faster than O(n log n) because Big O notation considers the worst case... and if you are doing an insert into a sorted list... you can check various points in the array to determine if you need to go up or down... which makes it better than O(n) (completely unsorted)... but... yeah it assumes its inserting into an already sorted list. Dijkstra's shortest path uses a grid/map datatype. Unless you are using those datastructures... which is not applicable for most applications, you don't need to know it. Furthermore, who cares how proven algorithms work. If you need to use them, they're published all over the place why care? Long story short, if you know the stuff great... but you don't need to know it to do just fine. Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-507742 Share on other sites More sharing options...
sequalit Posted April 3, 2008 Author Share Posted April 3, 2008 At first I didn't think PHP could do half the stuff it can, such as write and read files and such. The more I learn about PHP the more I see its just like any other OO-Programming language out there, and can do all the same stuff, only difference is you have to run a apache server and a web browser haha Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-508119 Share on other sites More sharing options...
dbo Posted April 3, 2008 Share Posted April 3, 2008 You don't have to have a browser and apache to run PHP. You could use it for a scripting language too. Quote Link to comment https://forums.phpfreaks.com/topic/98707-template-engines/#findComment-508166 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.