|
Instructional Technology Portfolio | Design and Development Tools | Lessons | Zope Lessons Login | Résumé | IT Portfolio | Home |
This is an example of how to combine python scripts and form inputs. This engine takes an input string and replaces all < and > signs with "<" and ">", thus emitting code that can readily be copied to a source HTML file.
<form action="." method="POST"> <table> <tr> <td align="right" valign=top>Code Snippet:</td> <td align="left"> <textarea name="snippet" cols="50" rows="10"></textarea> </td> </tr> <tr><td></td><td><input type="submit" value="Convert" name="dtml2html:method"></td></tr> </table> </form>
# dtml2html script # Replace all < and > with "<" and ">" # This scripts accepts one input parameter, "snippet" newsnippet = "<blockquote><pre><hr noshade size=1 color=#cccccc>" for i in snippet: if i == "<": newsnippet = newsnippet + "<" elif i == ">": newsnippet = newsnippet + ">" else: newsnippet = newsnippet + i newsnippet = newsnippet + "<hr noshade size=1 color=#cccccc></pre></blockquote>" return newsnippet
| mwlang@cybrains.net | Guest | Login | Home |