bye bye patTemplate
-
- Joomla! Enthusiast
- Posts: 121
- Joined: Wed Jan 18, 2006 1:48 pm
- Contact:
bye bye patTemplate
trying it for 45 mins... too hard to do anything simple, but it looks like easy to create something complicated. I am giving up.. rolling my own, super simple template system ... bye bye patTemplate!
www.jomsocial.com - Social networking component build for Yoomla
-
- Joomla! Intern
- Posts: 84
- Joined: Sat Dec 31, 2005 7:22 pm
Re: bye bye patTemplate
Have you tried the tutorials on Melonfire. They provide a lot of examples for working with master templates, subtemplates, conditional templates, etc. Follow these links:
http://www.melonfire.com/community/colu ... php?id=130
http://www.melonfire.com/community/colu ... php?id=132
The above articles are dated, but they may help you over the basics.
http://www.melonfire.com/community/colu ... php?id=130
http://www.melonfire.com/community/colu ... php?id=132
The above articles are dated, but they may help you over the basics.
- ianmac
- Joomla! Virtuoso
- Posts: 4784
- Joined: Sat Sep 24, 2005 11:01 pm
- Location: Toronto, Canada
Re: bye bye patTemplate
Is there any thought on revisiting the use of patTemplate? I tried various experiments with patTemplate and it was definitely a love-hate relationship. There were something which I used it for an it was great - it make some things very easy and very clean.
Other things were not quite as simple though, and either couldn't be done by design or by bug.
This in itself wouldn't be much cause for reconsideration, but it also looks like development has stopped on these packages (am I wrong in this?) An alpha version was released in April 2005 of 3.1... nothing has happened since. I tried to look at the SVN, but it was down. The guy who is as far as I know the lead developer has not posted on the forum since March 25th.
Perhaps we ought to revisit this and check the status of patTemplate? I know that we have already included in the core since 1.0, but on the other hand, the new API is fairly modular so it shouldn't be too difficult to change (although I guess the syntax extends past the API).
I guess bottom line, if this is a library that is not going to serve its purpose (and maybe we need to poll the community), then it is best to make that change now before we go further down the patTemplate road (which hasn't been adopted to widely as of now, AFAIK, because there is a substantial performance hit involved with it)...
Thoughts?
Ian
Other things were not quite as simple though, and either couldn't be done by design or by bug.
This in itself wouldn't be much cause for reconsideration, but it also looks like development has stopped on these packages (am I wrong in this?) An alpha version was released in April 2005 of 3.1... nothing has happened since. I tried to look at the SVN, but it was down. The guy who is as far as I know the lead developer has not posted on the forum since March 25th.
Perhaps we ought to revisit this and check the status of patTemplate? I know that we have already included in the core since 1.0, but on the other hand, the new API is fairly modular so it shouldn't be too difficult to change (although I guess the syntax extends past the API).
I guess bottom line, if this is a library that is not going to serve its purpose (and maybe we need to poll the community), then it is best to make that change now before we go further down the patTemplate road (which hasn't been adopted to widely as of now, AFAIK, because there is a substantial performance hit involved with it)...
Thoughts?
Ian
- masterchief
- Joomla! Hero
- Posts: 2247
- Joined: Fri Aug 12, 2005 2:45 am
- Location: Brisbane, Australia
- Contact:
Re: bye bye patTemplate
Hi Ian
What are the problems? I can probably give you some help - or if nothing else we know what problems you have faced to know what to look for in selecting an improved system, or making improvements to pat itself (JPat, hehe, bring it on).
I do all my development with pat now and actually find few situations that I can't get around. Nested loops is probably the hardest thing to do in pat but I have techniques to do these that only take a few lines of code and a few templates.
What are the problems? I can probably give you some help - or if nothing else we know what problems you have faced to know what to look for in selecting an improved system, or making improvements to pat itself (JPat, hehe, bring it on).
I do all my development with pat now and actually find few situations that I can't get around. Nested loops is probably the hardest thing to do in pat but I have techniques to do these that only take a few lines of code and a few templates.
Andrew Eddie - Tweet @AndrewEddie
<><
http://eddify.me
http://www.kiva.org/team/joomla - Got Joomla for free? Pay it forward and help fight poverty.
<><
http://eddify.me
http://www.kiva.org/team/joomla - Got Joomla for free? Pay it forward and help fight poverty.
- Vimes
- Joomla! Ace
- Posts: 1675
- Joined: Fri Aug 19, 2005 12:14 am
- Location: United Kingdom
- Contact:
Re: bye bye patTemplate
I was talking to somebody else the other day who was using some of the inbuilt functionality of patT to do some of the logic, granted not with a lot of luck, although I suspect he's cracked it by now. It surprised me because I take a probably simplistic approach to how I use them: they're used strictly for output, no logic, no loops, nothing.
My main reason for using them was to help my clients. Virtually all of them wanted to edit the layout in one form or another, so all I do is normally to an addRows with most of the output in just the one variable. Obviously there are times when you need to output rows of stuff, but largely that's all I do. Let's be honest, I'm the developer here, not them, and it doesn't seem fair to ask them to learn patT just so's they can move a little stuff around.
Perhaps I am being a little simplistic, but I love patT and how they work. It's really easy once you get your head around it, almost without fail my output now is doing using them even for the simplest pages.
It never fails to surprise me that we work so hard to remove the logic from the output, then bu**er it all up by putting logic in anyway.
Maybe I'm just being thick.
My main reason for using them was to help my clients. Virtually all of them wanted to edit the layout in one form or another, so all I do is normally to an addRows with most of the output in just the one variable. Obviously there are times when you need to output rows of stuff, but largely that's all I do. Let's be honest, I'm the developer here, not them, and it doesn't seem fair to ask them to learn patT just so's they can move a little stuff around.
Perhaps I am being a little simplistic, but I love patT and how they work. It's really easy once you get your head around it, almost without fail my output now is doing using them even for the simplest pages.
It never fails to surprise me that we work so hard to remove the logic from the output, then bu**er it all up by putting logic in anyway.
Maybe I'm just being thick.
http://www.jomres.net THE online hotel booking and reservation system for Joomla and Wordpress.
- masterchief
- Joomla! Hero
- Posts: 2247
- Joined: Fri Aug 12, 2005 2:45 am
- Location: Brisbane, Australia
- Contact:
Re: bye bye patTemplate
Vimes, can you explain a little more. I suspect you are not setting things up correct and that's why it seems difficult.
Andrew Eddie - Tweet @AndrewEddie
<><
http://eddify.me
http://www.kiva.org/team/joomla - Got Joomla for free? Pay it forward and help fight poverty.
<><
http://eddify.me
http://www.kiva.org/team/joomla - Got Joomla for free? Pay it forward and help fight poverty.
- Vimes
- Joomla! Ace
- Posts: 1675
- Joined: Fri Aug 19, 2005 12:14 am
- Location: United Kingdom
- Contact:
Re: bye bye patTemplate
On the contrary, it works a treat for me I was just commenting on how I don't understand when folks try to do logic in patT, it seems to defeat the object.
http://www.jomres.net THE online hotel booking and reservation system for Joomla and Wordpress.
-
- Joomla! Enthusiast
- Posts: 220
- Joined: Fri Aug 19, 2005 12:28 pm
- Contact:
Re: bye bye patTemplate
Initially I had a very difficult time trying to figure out how to use patTemplate.
First I was trying to create a directory with sections and categories within the sections and it was not easy, but I found a way around it while still using patT and not sending html to patT variables. Thanks to encouragement from Vimes and Phil I have now developed a component using 100% patT (in the frontend) and it makes life a lot easier.
I hope to release my component soon!
First I was trying to create a directory with sections and categories within the sections and it was not easy, but I found a way around it while still using patT and not sending html to patT variables. Thanks to encouragement from Vimes and Phil I have now developed a component using 100% patT (in the frontend) and it makes life a lot easier.
I hope to release my component soon!
Last edited by Alejo on Wed Jul 12, 2006 2:16 pm, edited 1 time in total.
https://www.jreviews.com/joomla directory, classifieds, and reviews system for Joomla and WordPress
-
- Joomla! Enthusiast
- Posts: 200
- Joined: Wed Aug 24, 2005 7:20 pm
- Location: Los Angeles
- Contact:
Re: bye bye patTemplate
Nested loops and logic in templates is a nightmare. For example, I develop a portfolio component that we roll out for most of our clients. Now while most of our clients have similar needs for the portfolio, the end display functionality is often very different. I try to solve this using patTemplate, so that I only need to develop a template for each of my clients to handle the differences. The catch is that every time I find myself having to rewrite my component's functionality because I can't do things just in the template. Like looping through an array with a conditional, and then looping through the same array again with a different conditional in another portion of the template. Providing the template with multiple copies of the array is redundant, especially when I don't know how many times I'll need it untill I develop the template.
Another thing that really bugs me is using PHP in a template. It works, but it operates before the {PATVALUES} replacements, which makes it useless in trying to do loops or other basic, but very usefull things that are based on the values of the patTemplate variables.
Overall I'm finding patTemplate to be somewhat usefull, definitely more robust that the custom template system I was beginning to use when I switched, but there are many things that are very difficult, or require modifying your extension instead of just modifying the template. I don't have experience with other templating systems, so I'm not sure how it compares.
Maybee I'm just going about using patTemplate in my components the wrong way, but documentation/tutorials are severely lacking.
Another thing that really bugs me is using PHP in a template. It works, but it operates before the {PATVALUES} replacements, which makes it useless in trying to do loops or other basic, but very usefull things that are based on the values of the patTemplate variables.
Overall I'm finding patTemplate to be somewhat usefull, definitely more robust that the custom template system I was beginning to use when I switched, but there are many things that are very difficult, or require modifying your extension instead of just modifying the template. I don't have experience with other templating systems, so I'm not sure how it compares.
Maybee I'm just going about using patTemplate in my components the wrong way, but documentation/tutorials are severely lacking.
-
- Joomla! Intern
- Posts: 84
- Joined: Sat Dec 31, 2005 7:22 pm
Re: bye bye patTemplate
Some Joomla-specific tutorials will most likely solve the majority of problems discussed here. There appears to be a lot of misunderstanding about how it should be used.Vimes wrote: On the contrary, it works a treat for me I was just commenting on how I don't understand when folks try to do logic in patT, it seems to defeat the object.
ianmac... I spotted a few posts on a German site a few weeks ago. I believe that the author is working on a new project which I'm assuming to be a PHP n-tier framework or portal of some sort based on the topic matter in the thread.
- ianmac
- Joomla! Virtuoso
- Posts: 4784
- Joined: Sat Sep 24, 2005 11:01 pm
- Location: Toronto, Canada
Re: bye bye patTemplate
I don't recall the nuances of my frustration...
But what I was trying to do was to write a HTML template library in patTemplate so that I could use it instead of the mosHTML class, since it seemed like this ought to be the way to do it...
At the start I was using the JDesigner component as an architecture model for my component.
I couldn't find a straightforward way to build this library. Could just be me though... this is a hobby, not a profession for me
Ian
But what I was trying to do was to write a HTML template library in patTemplate so that I could use it instead of the mosHTML class, since it seemed like this ought to be the way to do it...
At the start I was using the JDesigner component as an architecture model for my component.
I couldn't find a straightforward way to build this library. Could just be me though... this is a hobby, not a profession for me
Ian
- ianmac
- Joomla! Virtuoso
- Posts: 4784
- Joined: Sat Sep 24, 2005 11:01 pm
- Location: Toronto, Canada
Re: bye bye patTemplate
Also,
did anybody ever find a way to output { or } in a template? I seem to recall someone having trouble with this, and it seemed to me to be a bug with patTemplate...
This shouldn't be a difficult thing - a simple escape character SHOULD do the trick...
Ian
did anybody ever find a way to output { or } in a template? I seem to recall someone having trouble with this, and it seemed to me to be a bug with patTemplate...
This shouldn't be a difficult thing - a simple escape character SHOULD do the trick...
Ian
-
- Joomla! Enthusiast
- Posts: 200
- Joined: Wed Aug 24, 2005 7:20 pm
- Location: Los Angeles
- Contact:
Re: bye bye patTemplate
There's good reasons to do logic in the template. Specifically display logic instead of functionality logic. The odd/even condition used to make alternating row colors in a table or list is a good example of display logic. Another example of display logic would be highlighting an item in a list because it is the "active" item, or display certain variables if certain other nested variables from a display loop are set to certain values.Vimes wrote: On the contrary, it works a treat for me I was just commenting on how I don't understand when folks try to do logic in patT, it seems to defeat the object.
- akede
- Joomla! Ace
- Posts: 1258
- Joined: Fri Aug 12, 2005 6:15 am
- Location: Munich, Germany
- Contact:
Re: bye bye patTemplate
This could be a solution - Alexianmac wrote: Also,
did anybody ever find a way to output { or } in a template? I seem to recall someone having trouble with this, and it seemed to me to be a bug with patTemplate...
This shouldn't be a difficult thing - a simple escape character SHOULD do the trick...
Ian
http://forum.php-tools.net/index.php?t= ... 3b1a04e798
Joom!Fish 2.0 your free multilingual solution for Joomla! 1.5 i - http://www.joomfish.net - follow us on twitter @joomfish
Meet us at J and Beyond, 30.05 - 1.06.10, Wiesbaden, Germany - http://jandbeyond.org
Meet us at J and Beyond, 30.05 - 1.06.10, Wiesbaden, Germany - http://jandbeyond.org
- ianmac
- Joomla! Virtuoso
- Posts: 4784
- Joined: Sat Sep 24, 2005 11:01 pm
- Location: Toronto, Canada
Re: bye bye patTemplate
Thanks for writing Andrew...
You're continued use provides me with reassurance that perhaps this will be a good solution. I suppose the core team will have to worry about maintenance though - it looks like development has stopped. The reason I raised the question was that I was surprised at first that all the component were being refactored, yet none were using patTemplate. Hard to push something that isn't being used in the core... ;(
It was mentioned before that performance took a real hit with patTemplate... is there a solution in the works for this?
Anyway, I will give it another shot and see where I get.
Ian
You're continued use provides me with reassurance that perhaps this will be a good solution. I suppose the core team will have to worry about maintenance though - it looks like development has stopped. The reason I raised the question was that I was surprised at first that all the component were being refactored, yet none were using patTemplate. Hard to push something that isn't being used in the core... ;(
It was mentioned before that performance took a real hit with patTemplate... is there a solution in the works for this?
Anyway, I will give it another shot and see where I get.
Ian
-
- Joomla! Fledgling
- Posts: 2
- Joined: Thu Aug 10, 2006 3:46 pm
Re: bye bye patTemplate
Stupid question, what is pat Tempalte?
- louis.landry
- Joomla! Ace
- Posts: 1380
- Joined: Wed Aug 17, 2005 11:03 pm
- Location: San Jose, California
- Contact:
Re: bye bye patTemplate
patTemplate does have some considerable weaknesses with regards to performance. My personal opinion is that we need to utilize a system which uses the syntax/API of patTemplate or something very similar because I consider it to be a great example of presentation logic / business logic separation, it uses XML syntax which means with a proper DTD it could pass validation and can render to some degree in a WYSIWYG editor, it also allows for a very finite set of logic which gently forces the separation.ianmac wrote: Thanks for writing Andrew...
You're continued use provides me with reassurance that perhaps this will be a good solution. I suppose the core team will have to worry about maintenance though - it looks like development has stopped. The reason I raised the question was that I was surprised at first that all the component were being refactored, yet none were using patTemplate. Hard to push something that isn't being used in the core... ;(
It was mentioned before that performance took a real hit with patTemplate... is there a solution in the works for this?
Anyway, I will give it another shot and see where I get.
Ian
We need those benefits with appropriate performance gains... how we get to that end I'm not sure yet but it will definitely be a part of the planning process for future versions.
I'm not sure we need to be pushing patTemplate's use to the developer community. It is an available tool, but I wouldn't go so far as to say it is even necessarily recommended... its just available
Louis
PS. regarding "what is patTemplate": http://www.google.com/search?q=patTemplate
Joomla Platform Maintainer
A hacker does for love what others would not do for money.
A hacker does for love what others would not do for money.
-
- Joomla! Intern
- Posts: 84
- Joined: Sat Dec 31, 2005 7:22 pm
Re: bye bye patTemplate
Louis... there are a few lightweight template parser classes based on the Decorator Pattern that are used on some of the MVC frameworks. There include the template classes for WACT, Mojavi, and CodeIgniter. The tokens used in CodeIgniter's template parser classs are similar to patTemplate. However, all of these template were designed to be lightweight to achieve high performance and lack support for loops, conditionals, etc. I did some testing on CodeIgniter earlier to compare the cache speed differences between their standard PHP views and their optional template parser views and found the speed hit to be negligible.louis.landry wrote:patTemplate does have some considerable weaknesses with regards to performance. My personal opinion is that we need to utilize a system which uses the syntax/API of patTemplate or something very similar because I consider it to be a great example of presentation logic / business logic separation, it uses XML syntax which means with a proper DTD it could pass validation and can render to some degree in a WYSIWYG editor, it also allows for a very finite set of logic which gently forces the separation.ianmac wrote: Thanks for writing Andrew...
You're continued use provides me with reassurance that perhaps this will be a good solution. I suppose the core team will have to worry about maintenance though - it looks like development has stopped. The reason I raised the question was that I was surprised at first that all the component were being refactored, yet none were using patTemplate. Hard to push something that isn't being used in the core... ;(
It was mentioned before that performance took a real hit with patTemplate... is there a solution in the works for this?
Anyway, I will give it another shot and see where I get.
Ian
We need those benefits with appropriate performance gains... how we get to that end I'm not sure yet but it will definitely be a part of the planning process for future versions.
I'm not sure we need to be pushing patTemplate's use to the developer community. It is an available tool, but I wouldn't go so far as to say it is even necessarily recommended... its just available
Louis
PS. regarding "what is patTemplate": http://www.google.com/search?q=patTemplate
- louis.landry
- Joomla! Ace
- Posts: 1380
- Joined: Wed Aug 17, 2005 11:03 pm
- Location: San Jose, California
- Contact:
Re: bye bye patTemplate
Excellent ... as soon as i get a little free time i'll delve into the options and see waht we can come up with. I personally am thinking it may be worth taking ideas / concepts from lseveral different options and building our own templating engine based on the best features of each of these. Would love to work together with you and whomever else to nail down a solid requirement and go after a proof of concept sometime in teh future.
As always your insight is appreciated
Louis
As always your insight is appreciated
Louis
Joomla Platform Maintainer
A hacker does for love what others would not do for money.
A hacker does for love what others would not do for money.
-
- Joomla! Intern
- Posts: 84
- Joined: Sat Dec 31, 2005 7:22 pm
Re: bye bye patTemplate
Louis... I'm not sure if you have looked at this one. It uses a simple tag syntax that renders cleanly in a WYSIWYG editor. This is a single class with 6 methods and 5 properties. It has a plugin architecture for extensibility, loops, conditionals, and support for databases. I have not used this myself, but it looks interesting. If you want to play with this with a MVC architecture, there is a code snippet on the CodeIgniter wiki that installs TinyButStrong as a plugin template engine.
http://www.tinybutstrong.com/
http://www.tinybutstrong.com/
-
- Joomla! Hero
- Posts: 2454
- Joined: Sun Aug 28, 2005 5:03 pm
Re: bye bye patTemplate
Louis - would it not be better to create an API that we could plug different rendering systems into?
almost like the driver system for cross DB support?
I was thinking of output as a sort of CSS file of code where you define tags as a subroutine and call to those tags in the same way you do with CSS.
If joomla can provide that type of general hook it should be possible to create a driver file for PTTemps and Shorty and any other renderer you could think of.
But I admit that is a bit beyond my scope and not sure if that would even be possible....
almost like the driver system for cross DB support?
I was thinking of output as a sort of CSS file of code where you define tags as a subroutine and call to those tags in the same way you do with CSS.
If joomla can provide that type of general hook it should be possible to create a driver file for PTTemps and Shorty and any other renderer you could think of.
But I admit that is a bit beyond my scope and not sure if that would even be possible....
- louis.landry
- Joomla! Ace
- Posts: 1380
- Joined: Wed Aug 17, 2005 11:03 pm
- Location: San Jose, California
- Contact:
Re: bye bye patTemplate
@mmx: Thanks for the pointer, I will certainly have a look at it. I really like the idea of having an XML syntax for a templating language because it enables really fun things like xml transformations to achieve lots and lots of different things.
@Asphyx: Ultimately yes, you are spot on, what I would like to do is evaluate the different templating systems out there... take notes on the different APIs... then come to a consensus on what WE need in a rendering engine API. Once we settle on a common API for the Joomla! framework, we abstract the API such that templating engines are pluggable much like the driver system for JDatabase as you mentioned. As part of this exercise though, I would like to implement a core rendering engine that utilizes what we consider to be the best aspects of the different engines out there.
Your idea of a tag library of defined templates is in line with how I would like our final MVCR system to work, but I will admit that I haven't given it enough thought yet to determine exactly how I think it should behave.
Louis
@Asphyx: Ultimately yes, you are spot on, what I would like to do is evaluate the different templating systems out there... take notes on the different APIs... then come to a consensus on what WE need in a rendering engine API. Once we settle on a common API for the Joomla! framework, we abstract the API such that templating engines are pluggable much like the driver system for JDatabase as you mentioned. As part of this exercise though, I would like to implement a core rendering engine that utilizes what we consider to be the best aspects of the different engines out there.
Your idea of a tag library of defined templates is in line with how I would like our final MVCR system to work, but I will admit that I haven't given it enough thought yet to determine exactly how I think it should behave.
Louis
Joomla Platform Maintainer
A hacker does for love what others would not do for money.
A hacker does for love what others would not do for money.
-
- Joomla! Hero
- Posts: 2454
- Joined: Sun Aug 28, 2005 5:03 pm
Re: bye bye patTemplate
ok Louis I have to admit I cheated...
Johan explained all that to me at some point in the definition of MVCR when I asked him about it in another topic! I just took the API concept and tried to visualize how it would work which is where I got the tags from! LOL
I agree you will have to supply a rendering engine (either custom or one you pick) just so that the output is set in the default. But whatever is chosen or created can then at least be built upon or even replaced by someone who needs someone else...
This is what makes the Application framework of the 1.5 track so great!
Johan explained all that to me at some point in the definition of MVCR when I asked him about it in another topic! I just took the API concept and tried to visualize how it would work which is where I got the tags from! LOL
I agree you will have to supply a rendering engine (either custom or one you pick) just so that the output is set in the default. But whatever is chosen or created can then at least be built upon or even replaced by someone who needs someone else...
This is what makes the Application framework of the 1.5 track so great!
- ianmac
- Joomla! Virtuoso
- Posts: 4784
- Joined: Sat Sep 24, 2005 11:01 pm
- Location: Toronto, Canada
Re: bye bye patTemplate
Andrew,masterchief wrote: Hi Ian
What are the problems? I can probably give you some help - or if nothing else we know what problems you have faced to know what to look for in selecting an improved system, or making improvements to pat itself (JPat, hehe, bring it on).
I do all my development with pat now and actually find few situations that I can't get around. Nested loops is probably the hardest thing to do in pat but I have techniques to do these that only take a few lines of code and a few templates.
Here is the issue I have faced before and am facing again. I would like to be able to link a template using variables passed from the linking template.
So for example, I could have something like:
I realize I could to this by simply specifying varscope for the linked template, but I would like to be able to call this from different templates without having to add extra PHP code.
Is this possible with patTemplate?
Ian
-
- Joomla! Enthusiast
- Posts: 213
- Joined: Thu Aug 18, 2005 7:34 pm
- Location: Belgium
- Contact:
Re: bye bye patTemplate
A further note on usage of patTemplate: joomlaboard 1.2 will use it heavilly, so don't remove it! It's our new templating system and so far it' working good.
How big is the performance hit mentioned earlier?
How big is the performance hit mentioned earlier?
See joomlaboard in action: http://www.tsmf.net/component/option,co ... /Itemid,32
More information: http://www.tsmf.net/content/view/24/38/
More information: http://www.tsmf.net/content/view/24/38/
- globule
- Joomla! Guru
- Posts: 551
- Joined: Tue Aug 30, 2005 9:11 pm
- Location: Aix-En-Provence, France
- Contact:
Re: bye bye patTemplate
It is a wonderfull idea!progster wrote: A further note on usage of patTemplate: joomlaboard 1.2 will use it heavilly, so don't remove it! It's our new templating system and so far it' working good.
How big is the performance hit mentioned earlier?
I love this component, the only "full Joomla!" forum. But the actual version is to much "iterative", as we discussed on your forum (globule=lolo on tsmf). This will be a really good example of using pT, which I don't really know.
We translated some tutos from J! Wiki (hello_world, patTemplate, toolbar...). Each describes one way of writing J! code but there is no tuto compiling all of them... is it possible such a tuto appear one day?
-
- Joomla! Apprentice
- Posts: 44
- Joined: Fri Sep 01, 2006 8:04 am
- Location: Berlin
Re: bye bye patTemplate
I've already used some Template Engines.
First something like Sigma, IT, IT[X] from PEAR-Library. But because they use Pattern-Search and does'nt have built-in caching there performance was not very good.
Then i found Smarty. An engine that precompiles the template to some php and caches the compiled template. Seems that phptal is not very different but on my own i would prefer smarty as it seems easier to me and i already use this template engine in some other projects.
Maybe there will be a probability to switch the template engine?
But i will look forward till Joomla uses phptal to render the page template.
First something like Sigma, IT, IT[X] from PEAR-Library. But because they use Pattern-Search and does'nt have built-in caching there performance was not very good.
Then i found Smarty. An engine that precompiles the template to some php and caches the compiled template. Seems that phptal is not very different but on my own i would prefer smarty as it seems easier to me and i already use this template engine in some other projects.
Maybe there will be a probability to switch the template engine?
But i will look forward till Joomla uses phptal to render the page template.
- absalom
- Joomla! Ace
- Posts: 1199
- Joined: Thu Aug 18, 2005 12:37 am
- Location: Melbourne, Australia
- Contact:
Re: bye bye patTemplate
I'm currently investigating TBS as a way of migitating the perfomance hits if we ever get to semantic J! (perhaps through semantics as sub-blocks).
If MMX and I come to the same place with the same ideas, we must be onto something
If MMX and I come to the same place with the same ideas, we must be onto something
Last edited by absalom on Tue Oct 03, 2006 10:10 am, edited 1 time in total.
Design with integrity : Web accessible solutions
http://www.absalom.biz
http://twitter.com/absalomedia
http://www.absalom.biz
http://twitter.com/absalomedia
-
- Joomla! Intern
- Posts: 84
- Joined: Sat Dec 31, 2005 7:22 pm
Re: bye bye patTemplate
absalom... I followed Louis' advice and looked a bit further. I'm currently experimenting with the Template Parser class from the CodeIgniter framework. The general idea is to minimize the complexity of the template parser by utilizing the controller code and helpers to achieve better performance over a full-blown template engine. I'm playing with this in CodeIgniter and will attempt to adapt the general approach to Joomla! for a project I'm working on. The html for a sample View shown in their user guide (copyright 2006, pMachine, Inc.) is shown below.absalom wrote: I'm currently investigating TBS as a way of migitating the perfomance hits if we ever get to semantic J! (perhaps through semantics as sub-blocks).
If MMX and I come to the same place with the same ideas, we must be onto something
Code: Select all
<html>
<head>
<title>{blog_title}</title>
</head>
<body>
<h3>{blog_heading}</h3>
{blog_entries}
<h5>{title}</h5>
<p>{body}</p>
{/blog_entries}
</body>
</html>
Their controller code for the view is below.
Code: Select all
$query = $this->db->query("SELECT * FROM blog");
$this->load->library('parser');
$data = array(
'blog_title' => 'My Blog Title',
'blog_heading' => 'My Blog Heading',
'blog_entries' => $query->result_array()
);
$this->parser->parse('blog_template', $data);
Keep in mind that this is not a full-blown template engine. Things like loops and conditionals are handled by the controller and appear as pseudo variables in the view.
- absalom
- Joomla! Ace
- Posts: 1199
- Joined: Thu Aug 18, 2005 12:37 am
- Location: Melbourne, Australia
- Contact:
Re: bye bye patTemplate
It seems we can also learn from our competition. MODx: http://modxcms.com/ also uses TBS, so I'm looking through how they've implemented it and what we can learn from it. Walking through the source code now..
And then there's this on how Modx construct: http://modxcms.com/modx-tags.html
And then there's this on how Modx construct: http://modxcms.com/modx-tags.html
Last edited by absalom on Wed Oct 04, 2006 1:45 am, edited 1 time in total.
Design with integrity : Web accessible solutions
http://www.absalom.biz
http://twitter.com/absalomedia
http://www.absalom.biz
http://twitter.com/absalomedia