For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > December 2004 > RE: [SMARTY] Displaying xml









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: [SMARTY] Displaying xml
George Pitcher

2004-12-07, 4:23 am

Rainer,

Thanks - that did the trick.

In the first line of my xml.tpl file, I put {header} and the first thing
assigned to smarty instance was:

$smarty->assign('header', header("Content-type: application/xml"));

Great!

Cheers

George


> -----Original Message-----
> From: Rainer Müller [mailto:mueller_rainer@gmx.de]
> Sent: 4 December 2004 12:11 pm
> To: George Pitcher
> Subject: Re: [SMARTY] Displaying xml
>
>
> George Pitcher wrote:
> can do this
>
> You have to send it as application/xml instead of the default text/html.
>
> <?php
> header("Content-type: application/xml");
> ?>
>
> You have to use this before any output is done.
>
> Rainer
>

Rainer müller

2004-12-07, 4:23 am

George Pitcher wrote:
> Rainer,
>
> Thanks - that did the trick.
>
> In the first line of my xml.tpl file, I put {header} and the first thing
> assigned to smarty instance was:
>
> $smarty->assign('header', header("Content-type: application/xml"));
>
> Great!


Do not assign it to smarty. That's unnecessary. header() has nothing to
return (void).
Just use
header("Content-type: application/xml")
in the first line of the php file and it will work as expected. You
don't have to change your template file at all.

Rainer
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com