Displaying xml
| From: | George Pitcher | Date: | Sat, 04 Dec 2004 11:11:29 +0000 |
| Subject: | Displaying xml | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-12013@lists.php.net to get a copy of this message | ||
Hi,
I'd like to display my results as an xml page. Is there a way I can do this
using Smarty (in use for the rst of my sites)?
My tpl file looks like this:
<?xml version='1.0' encoding='utf-8'?>
<Documents>
<result_size>{$itemcount}</result_size>
{section name=nr loop=$results}
<record id='{$results[nr].tr_id}'>
<AUTHOR>{$results[nr].sa}</AUTHOR>
{$results[nr].sa}
<TITLE>{$results[nr].st}</TITLE>
{$results[nr].ea}
<FRAGMENT_AUTHOR>{$results[nr].ea}</FRAGMENT_AUTHOR>
{$results[nr].vol}
<FRAGMENT_TITLE>{$results[nr].et}</FRAGMENT_TITLE>
{$results[nr].pagerange}
<VOLUME>{$results[nr].vol}</VOLUME>
<ISSUE>{$results[nr].issue}</ISSUE>
<PAGERANGE>{$results[nr].pagerange}</PAGERANGE>
</record>
{/section}
</Documents>
The web result looks like (for one record):
Bryman, Alan Bryman, Alan Chapter 5: The debate about quantitative and
qualitativ 93-126
and the 'view source' is like:
<?xml version='1.0' encoding='utf-8'?>
<Documents>
<result_size>5</result_size>
<record id='50450'>
<AUTHOR>Bryman, Alan</AUTHOR>
<TITLE>Quantity and quality in social research</TITLE>
<FRAGMENT_AUTHOR>Bryman, Alan</FRAGMENT_AUTHOR>
<FRAGMENT_TITLE>Chapter 5: The debate about ...</FRAGMENT_TITLE>
<VOLUME></VOLUME>
<ISSUE></ISSUE>
<PAGERANGE>93-126</PAGERANGE>
</record>
...
</Documents>
Cay anyone point me in the right direction please?
George in Oxford