Jump to content

xml parsing and smarty templates


bullchina

Recommended Posts

I tried posting this two days ago, but it never got answered...

I just want to learn how to parse xml that has more than three levels of depth in php, and display the results, sorted, in a smarty template. thanks for any advice you have to offer
Link to comment
Share on other sites

What results do you want to display? What do you want to parse the XML for? Why not simply use an XSL stylesheet to do your transformation, if that is indeed what you are doing? That's more standard than Smarty, anyway. :)
Link to comment
Share on other sites

well i have this xml code:

[code]<?xml version="1.0" encoding="ISO-8859-1"?>
<projects>
<project>
<name>Test Project</name>
<date>2006</date>
<location>Barcelona, Spain</location>
<description><![CDATA[<p>This is a test project description with two paragraphs</p><p>this is the second paragraph</p> ]]></description>
<type>Corporate Garden</type>
<info>this is a field for extra information, about the clients, the size, price, etc...</info>
<directory>test</directory>
<images>
<image name="test.porch.jpg" title="this is image 1." />
<image name="test.firstfloor.jpg" title="this is image 2." />
<image name="test.firstfloor2.jpg" title="this is image 2." />
</images>
<files>
<file />
<file />
</files>
<status>built</status>
</project>
</projects>[/code]

and i want to be able to display the projects (there will be a lot of them) sorted by different parameters, like by type, by date, by location, and also be able to print out image thumbnails, hyperlinks to the big images, etc...

I also know very little about XSL, and i wouldn't even know where to start. I'm just learning smarty, and i have the whole rest of the site working in smarty.
Link to comment
Share on other sites

Kind of depends how fast you learn things. It can be anywhere from fairly simple to magnificently comjplicated, depending on what you need to do.

XPath really isn't all that hard; it is XSLT that gets difficult.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.