As a matter of fact, it's based on DOM classes and ids. 

For example, you can fill a paragraph with content like this in your code:

(html/deftemplate index "tutorial/template1.html"
  [ctxt]
  [:p#message] (html/content (:message ctxt)))
deftemplate is a macro that creates a template called "index". It creates a 
function that is applied when the matching route is called (this is defined in 
conjunction with another library, Ring, which is inspired by Ruby's Sinatra). 
It loads the file "tutorial/template1.html", and matches each "p" tag with the 
id "message". Finally, a function is applied that fills the paragraph with the 
content from the ctxt parameter with the key :message (the colon marks a 
symbol, just like Ruby).

I have copied this from a tutorial. If you want to know more, check it out:
https://github.com/swannodette/enlive-tutorial


On 29.09.2011, at 19:00, Chuck Hill wrote:

> 
> On 2011-09-29, at 1:01 AM, Marius Soutier wrote:
> 
>> The Clojure Enlive library allows you to create code-free static HTML and 
>> replace the contents from Clojure dynamically by applying functions to 
>> CSS-like selectors. I think I like that approach best so far.
> 
> That sounds like an interesting approach.  Can you post a small example?  
> Does the code need to changed if signifiant change are made to the layout or 
> can you use things like the HTML ID?
> 
> 
> Chuck
> 
> 
> -- 
> Chuck Hill             Senior Consultant / VP Development
> 
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.    
> http://www.global-village.net/products/practical_webobjects
> 
> 
> 
> 
> 
> 
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to