When you're trying to share code in a blog entry, you might run into one big problem: HTML code is rendered as code, not text. To get around this, I've built a converter that turns HTML code into something that will render as text.
To see it in action, go to http://blog.lib.umn.edu/heinz062/uthink-forum/html-encoder.php
Create a new index template, call it "HTML Encoder", then click on Template Options to change the output file to "html-encoder.php".
<input type="submit" name="Encode" value="Encode" />
</form>
<?php
$htmlencode = $_POST['htmlencode'];
if($htmlencode){
$htmlencode = htmlentities($htmlencode);
$htmlencode = htmlentities($htmlencode);//encode twice
echo "<form id=\"create-entry-form\">";
echo " <div id=\"entry-body-field\" class=\"field-top-label field pkg \">
<div class=\"field-inner\">
<div class=\"field-header\">
<label id=\"entry-body-label\" for=\"entry-body\">Encoded HTML (copy-paste into the Body)</label>
</div>
<div class=\"field-content \">
<textarea id=\"entry-body\" class=\"ta\" rows=\"7\" cols=\"50\"><div class=\"htmlcode\">$htmlencode</div></textarea>
</div>
</div>
</div>
";//end echo
echo "</form>";
}
?>
Now link to it somewhere on your blog (like your Entry Form template) using code like this:
Just remember that form tags within form tags don't work very well. I also defined a class in the stylesheet for "htmlcode", so that code is separated from other entry content by a grey background.

Add a Reply