Re: Seperating presentation from logic
| From: | Aaron | Date: | Tue, 25 Jun 2002 23:50:58 +0000 |
| Subject: | Re: Seperating presentation from logic | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103854@lists.php.net to get a copy of this message | ||
Thats how we do it.
the look, is TOTALY seperate from the logic. As in there aint no comon footer/header etc, You can make the page look however you want.
BUT
there are issues with special characters you'll have to play with. I also think Graphical designers might have a problem with xslt. Unless you have some kind of tool for it and I dont know of any and havent looked cause us programers do it here. We just get them to do the page in html, then we convert it to xsl, and where theres meant to be a table list or whatever we put in the appropriate stuff. Cause you need to do for loops etc in xslt say:
xml is :
<filelist>
<file><name>blah</name></file>
<file><name>blah</name></file>
<file><name>blah</name></file>
<file><name>blah</name></file>
<file><name>blah</name></file>
</filelist>
xsl :
<table>
<xsl:for-each select="/filelist/file"
<tr><td><xsl:value-of select="name"/></td></tr>
</xsl:for-each>
</table>
Jerome Houston wrote:
Is there a particular reason everyone is skipping over the idea of using XML/XSLT? What you're talking about is EXACTLY what XSLT was designed for. You can write scripts that access the DB, and output XML. Then you just use XSL files written by your designers to translate your XML into HTML. they get to choose EVERYTHING about what the page looks like. Granted, your designers need to learn a little XSL, but it sounds like, for what you're doing, they wouldn't need to learn much. If you're going to teach them to use something proprietary like pattemplate (as mentioned below), why not spend that time teaching them to use XSL, which is easy to use and isn't proprietary, it's actually W3 specified. for info on how to get it working with php, go to: http://www.webmasterbase.com/article/602 some people may disagree. -jeromeBasically, like someone else said, you teach your HTML designers to use custom tags that your template engine will recognize and place the correct values for. To make a loop, you'd tell your designers to do something like this <table> <pattemplate:loop> <tr><td><a href='{download_link}'>{filename}</a></td></tr> </pattemplate:loop> It's not exactly like that, mind you, but you get the idea. You can't ever completely separate you designers and programmers. What you do is provide an easy to understand way for your designers to include the programming elements. What's easier, teaching them to put <?=$_POST['name']?> or {name} in the document???_________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx