SitePoint Sponsor |
|
User Tag List
Results 26 to 50 of 58
Thread: Template Engines Really DO Suck
-
Apr 20, 2004, 07:35 #26
- Join Date
- Apr 2004
- Location
- FL, USA
- Posts
- 87
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by been
-
Apr 20, 2004, 11:41 #27
- Join Date
- Oct 2001
- Posts
- 656
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
At least that's what my cat said when I asked him.
and..indeed:..."not another "not another "not another template discussion" discussion" discussion"...
-
Apr 20, 2004, 20:53 #28
- Join Date
- May 2002
- Location
- Gent, Belgium
- Posts
- 284
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Captain Proton, these threads will keep on raising their ugly heads I'm afraid.
Maybe sitepoint should develop a bot:
-----%<--------------------
Hi there!
Just wanted to warn you you're gonna be in for a lengthy discussion, the infamous "Not another template discussion part ${useless_template_discussion_part_number}"
The reason you are gonna have this discussion is because everybody has a different idea of what a template is.
As such the discussion will be pointless.
Please clarify what you mean by template.
Have a nice day!
SP-NATD
-----%<--------------------
Seems like 2 files are mixed and called "template":
A source file of a designer's software tool. Let's call this Template1 for simplicity.
A file that's read and processed by a webapp, it contains place holders that will be replaced at runtime with dynamic content. Let's call this Template2.
Numerous times, I have referred to Template1 as "a template". Definitely incorrect, but I couldn't come up with anything better and "designer's tool source file" becomes tedious to write and read.
I was trying to get across that Template1 and Template2 are different things, and that it doesn't seem like a good thing to me to replace one with the other for the deceiving easyness of then having to only process one file.
Well, I'm glad mwmitchell got it, and it seems that at least the cat of mr. Buddha had some notion about what I was rambling on about.
Yes, I was being very naïve, even arrogant, thinking I would get my thoughts across in a non-native-spoken language that would be equally pleasant for me to write as it would be for someone to read.
I've failed miserably
Apologies for having taken up that much forum space.Per
Everything works on a PowerPoint slide
-
Apr 20, 2004, 22:52 #29
- Join Date
- Apr 2004
- Location
- FL, USA
- Posts
- 87
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
That darn cat of mine is too smart.
Usually when dealing with designers I only expect template1, I always figure it's my job to come up with template2. I kind of wonder if I'm the only one who works this way?
I don't think you failed BEEN. You english is better than mine, @#$% THOSE AMERICAN PUBLIC SCHOOLS!!
-
Apr 21, 2004, 03:05 #30
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by lazy_yogi
Code:<h1 tal:content="$word">Fruit (this is dummy content that doesn't appear in the result)<h1> <ul tal:repeat="element list"> <li tal:content="element">Orange (=more dummy content)</li> <li tal:replace="">Banana</li> <li tal:replace="">Mango</li> </ul>
Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
-
Apr 21, 2004, 03:09 #31
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by lazy_yogi
Code:<h1 tal:content="word">Fruit (this is dummy content that doesn't appear in the result)<h1/> <ul tal:repeat="element list"> <li tal:content="element">Orange (=more dummy content)</li> <li tal:replace="">Banana</li> <li tal:replace="">Mango</li> </ul>
Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
-
Apr 21, 2004, 12:05 #32
- Join Date
- May 2002
- Location
- Gent, Belgium
- Posts
- 284
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I can't believe I went through all the trouble...
Seriously, what was that all about? A sad try at my 15 minutes of fame?
Anyway, I just realized a better message for the not-another-template-debate-bot would be:
---%<----------
Hello there,
You could be heading for a long and maybe pointless discussion, we would like to point your attention to
http://wact.sourceforge.net/index.php/TemplateView
If, after reading that, you happen to have any questions/enlightening opinions/grutches/etc... about "templating", feel free to post them.
If not, and this is especially for member been, you may very well consider to refrain from posting.
Thank you and have a nice day!
SP-NATD
---%<----------Per
Everything works on a PowerPoint slide
-
Apr 21, 2004, 12:15 #33
- Join Date
- Jan 2003
- Location
- Belgium
- Posts
- 133
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by dagfinn
How does it compare feature/speedwise to other, more popular engines?
I can imagine that designers are quite happy with TAL too...being a designer+coder myself...
I use PEAR::HTML_Flexy atm, but I try to keep my eyes open
Thanks!
-
Apr 21, 2004, 16:10 #34
- Join Date
- May 2003
- Location
- virginia
- Posts
- 988
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by been
Matt
-
Apr 22, 2004, 01:02 #35
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by prefab
I haven't tried to compare features. The manual is at http://phptal.sourceforge.net/bagpac...te_PHPTAL/doc/.Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
-
Apr 23, 2004, 20:52 #36
- Join Date
- Nov 2002
- Posts
- 841
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by been
I have some updates to make to that page. Some recent work on the Model View Controller and study of the paper Enforcing Model-View Seperation in Template Engines [PDF] have given me new perspectives.
I'd like to update the whole Presentation Logic and Templates section, add a section on how TemplateView fits inside the MVC pattern and expand on the Push versus Pull Data Population.
-
Apr 24, 2004, 00:59 #37
- Join Date
- Jan 2004
- Location
- Planet Earth
- Posts
- 1,764
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for the link to the PDF Selkirk - going to read it later
...intent that it be used like a template FAQ.
-
Apr 24, 2004, 06:16 #38
- Join Date
- Jan 2004
- Location
- USA
- Posts
- 4
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Widow Maker
Matt
-
Apr 24, 2004, 09:52 #39
- Join Date
- Jan 2004
- Location
- Planet Earth
- Posts
- 1,764
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Knock, Knock?
Wasn't really suggesting there was anyone knocking WACT, but just stateing the obvious I suppose
-
Apr 24, 2004, 11:29 #40
- Join Date
- Jun 2003
- Location
- Waterloo, ON
- Posts
- 1,517
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by lazy_yogi
Code:<ul> <xsl:for-each select="list"> <li><xsl:value-of select="element"/></li> </xsl:for-each> </ul>
[It is my humble opinion that HTML, as an specific subset of XML, should never be embedded in PHP.]
XSL-T boasts a declarative syntax, which has been shown to be easier to comprehend by non-programmers (don't ask me to quote this...). It supports all the common conditional operators and loop constructs, and, best-of-all, has a syntax defined by another web-standard, namely XML!
Every WYSIWYG editor I know of supports reading and parsing XML, some even with specific colour-coding for XSL-T.
I couldn't imagine having to switch from XSL-T to other templating engines -- believe me, I've tried. What was easy in XSL-T turned into a nightmare in Smarty (granted, smarty.php.net was down during that little project, but....) -- working with a deeply nested hierarchy of elements, some with optional attributes or child elements, and all with conveniently-named tags (i.e. <user>, <permission>, ...) proved to be a waste of time in Smarty.
Combined with MVC, XML & XSL-T give me the luxury of easily stitching together parts of other controller's outputs. I can't imagine a better solution.
Granted, PHP-4 w/ Sablotron can be a bit hairy... but it *does* work, and it will work even better w/ PHP. Also, while I don't exactly like it (since it locks one into PHP [which isn't a bad place to be]), PHP-5 has some interesting new additions that promise to make XSL-T w/ PHP even better.My name is Steve, and I'm a super-villian.
-
Apr 24, 2004, 14:28 #41
- Join Date
- Jan 2004
- Location
- Planet Earth
- Posts
- 1,764
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I'm really surprised how little focus is given to XSL-T.
[It is my humble opinion that HTML, as an specific subset of XML, should never be embedded in PHP.]
Though if I'm in a hurry to get something out ASAP I've seen me embed PHP iterator's within HTML, just to get something finished and out of the way.
Usually small projects and web sites - things that are not going to come back and haunt me later in regards to code re-use and/or expansion
Used Sablotron in the past, now I advocate the absolute use of PHPs DOM extension, which is stable from 4.3 but wouldn't go back to using Sablotron since it is slow
-
Apr 24, 2004, 19:33 #42
- Join Date
- Jun 2003
- Location
- Waterloo, ON
- Posts
- 1,517
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Widow Maker
)
Originally Posted by Widow Maker
Sablotron was a must in one scenario where PHP could not be recompiled, but access to the sabcmd executables was permitted. Saved my butt it did!My name is Steve, and I'm a super-villian.
-
Apr 25, 2004, 04:02 #43
- Join Date
- Jan 2004
- Location
- Planet Earth
- Posts
- 1,764
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I presume you have had good success?
Glad the newer version I use is now stable enough so I can relax and just script, without having to hack a problem
Cannot wait to get my teeth into PHP5 myself, though I can see it being early next year before I settle into using it
-
Apr 25, 2004, 06:14 #44
- Join Date
- May 2003
- Location
- Lancaster
- Posts
- 240
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
All i have to say is "Typo3"
The absolute best CMS, template and integration system around
-
Apr 25, 2004, 10:20 #45
- Join Date
- Feb 2004
- Location
- France
- Posts
- 58
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by lieut_data
However I wouldn't say it's easy. XSLT is a very clean and clever design, and it's rather simple most of the time. However for some situations, where a procedural structure is necessary, it's incredibly difficult to use. Some of my templates got so convoluted I can't understand them anymore
The beauty of XSLT is that it's totally standard - every scripting or compiled language out there knows how to handle it. And even on the client side modern browsers are also capable of doing the transformation themselves, without any server-side processing. Widespread standardisation is very good
-
Apr 25, 2004, 10:51 #46
- Join Date
- Jun 2003
- Location
- Waterloo, ON
- Posts
- 1,517
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Betcour
XSLT shines in places where other template engines wallow -- but it too has its drawbacks, especially, as you mentioned, proceduarally. Again, though it draws away from XSL-T's standardization, PHP5's ability to integrate functions into the XSL-T stylesheet may help to resolve these complexity issues.
Example: Date Formatting. I found a *great* XSL-T date formatter, but it was ~1000 lines, and in order to get the result I wanted, ended up having four nested <xsl:call-template/> tags. A handy call to date or even [fphp]sprintf[/php] could have simplified the stylesheet considerably. (something that is already made trivial by Smarty)
Of course, I could have passed a formatted date value to the sheet, but I wanted the template to have the formatting power, leaving the model to pass only the raw data.My name is Steve, and I'm a super-villian.
-
Apr 26, 2004, 06:27 #47
- Join Date
- Mar 2001
- Location
- Tampa, FL
- Posts
- 376
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
To be honest I am pretty proud of the WACT system. It is basically a system I had written myself using some hardcore regex, but it was definately not as feature rich as WACT is today. If you ever want to be friendly to designers, WACT is the way to go due to its conformance with standards.
Web template systems make more sense when you combine a controller and model together because your output eventually becomes something like XHTML which is decorated by CSS (if you have'nt moved to XHTML standards, you need to sometime this week... I reccomend it).
Just my advice before you fly off the handle with this whole templating system smacktalk.
-
Apr 26, 2004, 08:55 #48
- Join Date
- Jan 2004
- Location
- Planet Earth
- Posts
- 1,764
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Would ask everyone reads the PDF that Selkirk posted the other day there
It's suggested that XSL-T isn't in fact, a template engine/language, which is true. But by it's own nature, it can render templates I suppose.
The reasoning why you shouldn't put for example date formatting into a template is also given in the document, alas there is 2 definitions of a template though
A good read none the less though
-
Apr 26, 2004, 09:18 #49
- Join Date
- Jun 2003
- Location
- Waterloo, ON
- Posts
- 1,517
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Widow Maker
Thanks!My name is Steve, and I'm a super-villian.
-
Apr 27, 2004, 01:40 #50
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Widow Maker
I agree that the paper is extremely interesting. It really helps clarify some issues. But I'm not sure I agree with him that the boundary between program code and template should be the same as the Model-View boundary in MVC. I'm more inclined to keep some view logic (but no HTML code) outside the template, but in separate classes so it's still separate from the Model and the Controller.Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
Bookmarks