The opening <programlisting> tag must indicate the appropriate "language" attribute and be indented at the same level as its sibling blocks.
<para>Sibling paragraph.</para> <programlisting language="php"><![CDATA[
CDATA should be used around all program listings.
<programlisting> sections must not add linebreaks or whitespace at the beginning or end of the section, as these are then represented in the final output.
<!-- NOT ALLOWED --> <programlisting language="php"><![CDATA[ $render = "xxx"; ]]></programlisting> <!-- OK --> <programlisting language="php"><![CDATA[ $render = "xxx"; ]]></programlisting>
Ending CDATA and <programlisting> tags should be on the same line, without any indentation.
<!-- NOT ALLOWED -->
<programlisting language="php"><![CDATA[
$render = "xxx";
]]>
</programlisting>
<!-- NOT ALLOWED -->
<programlisting language="php"><![CDATA[
$render = "xxx";
]]></programlisting>
<!-- OK -->
<programlisting language="php"><![CDATA[
$render = "xxx";
]]></programlisting>
The <programlisting> tag should contain the "language" attribute with a value appropriate to the contents of the program listing. Typical values include "css", "html", "ini", "javascript", "php", "text", and "xml".
<!-- PHP --> <programlisting language="php"><![CDATA[ <!-- Javascript --> <programlisting language="javascript"><![CDATA[ <!-- XML --> <programlisting language="xml"><![CDATA[
For program listings containing only PHP code, PHP tags (e.g., "<?php", "?>") are not required, and should not be used. They simply clutter the narrative, and are implied by the use of the <programlisting> tag.
<!-- NOT ALLOWED -->
<programlisting language="php"<![CDATA[<?php
// ...
?>]]></programlisting>
<programlisting language="php"<![CDATA[
<?php
// ...
?>
]]></programlisting>
Line lengths within program listings should follow the coding standards recommendations.
Refrain from using require_once(),
require(), include_once(), and
include() calls within PHP listings.
They simply clutter the narrative, and are largely obviated when using an
autoloader. Use them only when they are essential to the example.
Never use short tags
Short tags (e.g., "<?", "<?=") should never be used within programlisting or the narrative of a document.




