<slide title="Plan your Extension">
<blurb>
Try to plan your extension before you start writing your code.
A good way to do this is to write a sample PHP script that illustrates
how your extension is going to be accessed from a PHP script.
</blurb>
<example title="HTML Tidy Sample Extension" type="php" result="1" required_extension="tidy" ><![CDATA[<?php
$tidy = tidy_create();
tidy_set_option($tidy, "show-body-only", "yes");
@tidy_parse_string($tidy, "<b>foo <i>bar</b></i>");
tidy_clean_and_repair($tidy);
ob_start();
tidy_output($tidy);
$clean = ob_get_contents();
ob_end_clean();
echo htmlspecialchars($clean);
?>]]></example>
<example title="HTML Tidy Sample Extension (OO for PHP4)" type="php"><![CDATA[<?php
$tidy = new tidy();
$tidy->set_option("show-body-only", "yes");
$tidy->parse_string("<b>foo <i>bar</b></i>");
$tidy->clean_and_repair();
$tidy->output();
?>]]></example>
<example title="HTML Tidy Sample Extension (OO for PHP5)" type="php"><![CDATA[<?php
$tidy = new tidy();
$tidy->show_body_only = "yes";
$tidy->parse_string("<b>foo <i>bar</b></i>");
$tidy->clean_and_repair();
$tidy->output();
?>]]></example>

</slide>
