[ThorFramework-devel] SF.net SVN: thorframework: [36] trunk/thor/doc/why_thor.html
Status: Planning
Brought to you by:
denniskempin
From: <den...@us...> - 2006-03-03 11:11:27
|
Revision: 36 Author: denniskempin Date: 2006-03-03 03:11:17 -0800 (Fri, 03 Mar 2006) ViewCVS: http://svn.sourceforge.net/thorframework/?rev=36&view=rev Log Message: ----------- Modified Paths: -------------- trunk/thor/doc/why_thor.html Modified: trunk/thor/doc/why_thor.html =================================================================== --- trunk/thor/doc/why_thor.html 2006-03-03 11:01:01 UTC (rev 35) +++ trunk/thor/doc/why_thor.html 2006-03-03 11:11:17 UTC (rev 36) @@ -88,5 +88,102 @@ Die Performance sollte um einiges besser sein als vergleichbare PHP Anwendungen, aus den oben Bereits genannten gründen. </p> + <h2>Und was soll ich nun damit?</h2> + <p> + Das Framework ist bisher nur ein Konzept, eine Idee (welche ich ständig versuche zu verbessern und mit Test Implementierungen zu Testen), + und ich suche Leute die Interesse haben an solch einem Projekt mitzuwirken. Da es sich um ein Open Source Projekt handelt + ist jeder herzlichst Eingeladen: + <ul> + <li> + <b>Java Entwickler:</b><br/> + Entweder als Berater oder am besten als mit Entwickler kann ich jede Hilfe gebrauchen. + </li> + <li> + <b>PHP Entwickler:</b><br/> + Wenn ihr PHP programmiert und Interesse habt mal was neues auszuprobieren, dann seid auch ihr + willkommen. Denn ohne Tester, und vor allem ohne Leute die die usability bestimmter Konzepte beurteilen + wird das nichts ;). + </li> + </ul> + </p> + <h2>Anhang</h2> + <h3>A. Shoutbox component sample template</h3> + Dieses Template zeigt wie einfach man im Templatesystem + die bereitgestellten Daten verwenden kann. + <pre> +<?xml version="1.0" encoding="UTF-8"?> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:thor="http://www.y2k1.org/thor/template"> + + <head> + <link href="/shoutbox/style.css" rel="stylesheet" type="text/css" /> + </head> + + <body> + <div class="shoutbox"> + + <!-- Iterate over all messages --> + <div class="entry" thor:foreach="${message in messages}"> + ${message} <!-- print the message text --> + </div> + + <!-- Display message if the messages list is empty --> + <div class="entry" thor:if="${empty messages}"> + No messages + </div> + + <h3>Post a Message:</h3> + <form method="POST" thor:listener="PostMessage"> + <input type="text" name="message" /> + <input type="submit" /> + </form> + + </div> + </body> +</html> + </pre> + <h3>B. Matching sample component class file</h3> + Die Logik zum Template wird in eine extra Klasse ausgelagert. + Diese wird nur einmal beim starten der Anwendung erzeugt, so dass + der Inhalt der Liste namens "messages" so lange erhalten bleibt wie + die Anwendung läuft. Es ist also gar keine Datenbank nötig für dieses Beispiel, + versucht das mal mit PHP ;).<br/> + Der Einfachheit halber habe ich auf Sicherheitsabfragen etc verzichtet. + <pre> +public class Shoutbox extends Page +{ + /** + * This List contains all messages posted to the shoutbox. + */ + private List<String> messages; + + /** + * We create a shoutbox page and construct a new messages list. + * this is called once per application start. + */ + public TestComponent() + { + this.messages = new LinkedList<String>(); + } + + /** + * This method is called each time the page is called. + * @param request contains informations about the request just like session objects or GET parameters. + */ + public void onRequest(IRequest request, IResponse response) + { + // we pass our message list to the template to process it there. + response.set("messages", messages); + } + + /** + * This method is called when the PostMessage Formular is invoked. + * after this the request is handled just like a common page request. + */ + public void onPostMessage(IRequest request, IResponse response) + { + // we fetch the message text from the request data and add it to the messages list. + messages.add(request.getParameter("message")); + } +} </body> </html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |