RE : [SMARTY] Problem with caracter inserted in first line (RSS)
| From: | Christopher Rousseau | Date: | Mon, 19 Jan 2004 13:04:39 +0000 |
| Subject: | RE : [SMARTY] Problem with caracter inserted in first line (RSS) | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10847@lists.php.net to get a copy of this message | ||
I did have the same problem with XML and resolve it this way:
My php script start with
<?ob_start();?>
on the first line to bufferize the output of php.
and juste before outputing the XML code I do
<?
ob_clean();
echo $xml; // or whatever you have to create your XML
?>
The ob_clean() command clear the output buffer
Thus you remove all the blank line that can be output before the real
XML/HTML output.
Have a nice day,
Christopher
-----Message d'origine-----
De : Luc Saint-Elie [mailto:luc@saint-elie.com]
Envoyé : lundi 19 janvier 2004 13:03
À : smarty-general@lists.php.net
Objet : [SMARTY] Problem with caracter inserted in first line (RSS)
Hello,
I have a rather simple backend.php page that is supposed to output a rss
feed.
The system is rather simple
....
$smarty->assign('sitedata',$sitedata);
header ("content-type: text/xml");
$smarty->display($smarty->design.'/rss/backend.tpl');
My backend.tpl file is a rss (091) file that calls a plugin for fetching
news titles
the canonical "<?xml version="1.0"..." is at the very beginning of the
file.
The output is screwed beacsue on the resulting file the <?xml
version="1.0"
is not at the very beginning, a caracter is inserted before.
Any idea ?
Luc
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php