Re: Need advice / suggestions
| From: | Sylvain Bergé | Date: | Fri, 30 Mar 2001 10:51:01 +0000 |
| Subject: | Re: Need advice / suggestions | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-504@lists.php.net to get a copy of this message | ||
I worked a little on it...
I'm sure to use Smarty and XML can be done an excellent solution...
To me I use XML (DOM or Expact depend of your use) for generate navigation menu stored in Xdimensionnal Array and use Smarty for template.
Maybe a DB is better, I don't know depend of your strategy ;-).
Use XML for data is difficult because there aren't more tools. So a lambda user can't build a XML page :-/
Of course you can use XSLT with the module Sablotron with Apache fort example but I think Smarty is not dedicated for a specific way (an advantage).
Sylvain
Alain Fontaine wrote:
Hi Smarty People :) I'd need some suggestive input from you template gods. I am storing data about an object (call it a datasheet) in XML format. This data has to be shown to users in various formats: HTML (summary and complete), but also other text-based layouts (E-mail and fax). I'd like to use Smarty templates to do the rendering. After talking to a colleague, we have come up with the idea to parse the XML using PHP's XML functions, and put all the elements into one or more (that needs to be defined) arrays. The associative arrays would have keys that are the name of the XML element. Also, the Smarty tags would be the names of the XML elements. That way, I could simply assign() the whole XML result array to a smarty template, because the XML tags and the Smarty tags "match". Now the question: I don't really know how to go about to create that array. What especially bogs me is the fact that some elements can have attributes, of course, and some other elements can have a variable amount of sub-elements, like this: <Book> <Author>Alain</Author> <Author>Monte</Author> </Book> I know how to parse XML with PHP, either the Expat way, or the DOM way, so that's not really part of the question. It's mainly about how to effectively use XML/PHP/Smarty to transform an XML document into a nice HTML. I know I could have used XSLT, but I prefer the Smarty way. That's today's exercise... :). I'd be happy about any suggestion / idea you could have ! Thanks ! --- You are currently subscribed to smarty as: sylvain.berge@medasys.fr To unsubscribe send a blank email to $subst('Email.Unsub') Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/-- ---------------- GROUPE MEDASYS ---------------- Sylvain Bergé Tél: 01 69 33 73 43 Chef de Projet Fax: 01 69 33 73 01 Dpt. Projet & Services http://www.medasys.fr ------------------------------------------------ /* In a world without walls and borders, who needs windows and gates ? */