Re: For those helping on intrigue...
- Posted by jeremy (admin) Jun 18, 2009
- 1463 views
- Handles URL to Euphoria routine dispatching
- Query string/forum to function parameter mapping
Could you provide examples of what you mean by the above?
Sure. Let's say the request is:
http://myserver.com/apiary/find.html?name=Primary&city=Small%20Town
Webclay works on modules and actions. In the above, the module is "apiary" and the action is "find". This can be translated in any way (or not at all) by your web server. Now, in your actual code, you have things such as:
include webclay/webclay.e as webclay function apiary_index(integer template) webclay:set_value(template, "title", "Apiary Listing") return { TEMPLATE, "apiary_index.html" } end function w:add_handler(routine_id("apiary_index"), "apiary", "index") function apiary_find(integer template, sequence name, sequence city, sequence state, sequence zip) -- do query -- set values return { TEMPLATE, "apiary_find" } end function w:add_handler(routine_id("apiary_find"), "apiary", "find") w:handle_request()
The above is actually a fully working web application. Webclay takes care of mapping a URL (/apiary/find.html) to a Euphoria function (function apiary_find), via it's registered handlers. When you register a handler, you can do more things such as provide a type mapping definition or an input validation function. You can look at the hello world example in the source svn to see how to use those as well.
But with the above, it mapped the URL to the right Euphoria function, it also took the data coming in via a QUERY_STRING or via the POST data and sent it to the registered function. Notice how the user has to do nothing w/getting CGI values, reading POST data, etc... It's just an easy to use Euphoria app
- Far easier to use than a CGI application
What's the paradigm? For example, with BBCMF, you create "blocks" on a page, then fill those blocks with content (whether static, from a file, from a database, etc.). The content can be variable, depending on the URL, etc...
Webclay is not a CMF. It's a lower level tool than that. BBCMF would be a CMF that is built using Webclay. Webclay by itself does nothing of value, it does not come with pre-defined modules such as user management, news, etc... You can think of webclay as a much more robust replacement for:
include cgi.e
... i.e. It only enables you to write web applications, it is in no way a web application itself as in BBCMF.
If anyone wishes to use webclay or help in it's development, please let me know.
I'd be interested in using and helping. How easy is it to set up on a server? Does it work with Apache? Do you have any install/usage docs?
It's cake to setup a server. If you have CGI working, then webclay will work. Yes, it works with many web servers. I use Abyss web server on Windows, Apache on Linux and Lighttpd on OS X. I have tested with a few other web servers as well w/o issue.
Install/usage docs? Let's start with the install docs:
- svn co http://jeremy.cowgar.com/svn/webclay/trunk webclay
- Set your web server's root document folder to be webclay/htdocs
- Ensure that .ex files are executable as a cgi application
- Access http://localhost/hello.ex
Now, let's finish with usage docs:
- See webclay/htdocs/hello.ex, webclay/htdocs/form.html, webclay/htdocs/greet.html for documented examples
Sorry there is not more docs than that, but that's it. The greeter example actually does everything that webclay currently offers and is very easy to understand. As with any project just getting on it's feet, docs are, um, non-existant
Jeremy