Posted by Thomas 'PointedEars' Lahn on 09/27/11 11:37
ted benedict wrote:
> 2. dynamically generated XML from a server side php script.
>
---------------------------------------------------------------------------------------
> the server side script looks like this:
> <?php
> header("Content-type: text/xml; charset=iso-8859-1");
> echo('<entries>');
> echo('<entry>');
> // more elements
> echo('</entry>');
> echo('</entries>');
> ?>
One more comment: Such coding is seldom wise.
1. `echo' is not a PHP function, but a language feature. Good code style
calls for not using the parantheses, unless the expression used is more
complicated.
2. You do not have to feed to PHP's parser what is not PHP code. Therefore
it is PHP, the PHP _Hypertext Preprocessor_ :)
Consider this:
<?php
// PHP code
?><entries>
<entry>
<?php
// PHP code that generates more elements
?>
</entry>
</entries><?php
PHP code
?>
See also <URL:http://www.php.net/manual/en/tutorial.firstpage.php>
X-Post & F'up2 comp.lang.php
PointedEars
Navigation:
[Reply to this message]
|