Re: templates with php

From: Date: Mon, 31 Jul 2000 23:47:23 +0000
Subject: Re: templates with php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-9312@lists.php.net to get a copy of this message
on 31/7/00 11:41 pm, Rasmus Lerdorf at rasmus@php.net wrote: >> Rasmus, your template sytsem certainly has matured, into the best >> server-side scripting language I have used (actually make that the best >> scripting language I have used period.) What it isn't any more - at least to >> me - is a template system. Perhaps we need something like the PHP Template >> Engine to give us that back? > > The fact that it can do a lot more does not invalidate it asa template > system. > > A concrete example: > > <? require "logic.inc" ?> > <TABLE> > <? while(fetch_products()): ?> > > <TR><TD><?=$name?></TD><TD><?=$price?></TD></TR> > <? endwhile ?> > </TABLE> > > It should be obvious what fetch_products() would look like in logic.inc > Okay, I can see light at the end of the tunnel now. Thanks for the example. > My main beef with templating systems is that they do not give the > designers enough credit. > <snip> As I explained before, I am the only one here, so I have to do both. That's the problem - I never give myself enough credit :) The thing that strikes me about this, is that if you come from Rasmus's perspective, it seems you write a file that starts out as a web page, and then you add logic to it, so it becomes a template by default. If you start with the logic, the temptation is to pass the design off, and for that you need (or rather prefer) a template system like fastTemplates, etc. I don't think there is a right and wrong answer here, just a matter of which end you start from. What I do wonder is how well each style of solution scales to a large group of designers/programmers, split more formally along those lines. I myself have worked with other web designers who can't (won't) even write html, and do everything in a visual editor like GoLive or DreamWeaver. For them, adding in a {$title} placeholder in plaintext in the visual environment would be a lot more comfortable conceptually than <?=$title?> in the html-view of the same page. Actually, dragging a {$title} icon to the layout would be even better :) I guess it harks back to the magic-marker designers and the reprographic-aware artworkers in print; some designers wouldn't even want to touch the computer, because they knew their skills were better used elsewhere. On a personal level, as I am comfortable with both, I shall explore Rasmus's path a little more closely. I guess I need to rethink my approach to php as a template system, if only to work out which way of doing things is actually best in my situation. This would make an excellent article on phpbuilder. As a newbie it was extremely easy to consider fastTemplate, et al, as the only way to do split logic and presentation, rather than one option. I would, however, maintain that the PHP Template Engine proposed would be a useful addition for those designers who didn't want to learn php, or as an abstraction for ease-of-use. (One might even perceive it as a GUI over the top of linux :) Regards -- Andy Warwick andy.w@creed.co.uk

« previous php.general (#9312) next »