attr

An article by Gaspard Bucher

find value as attribute

  1. action
  2. ajax
  3. API
  4. classes
  5. common attributes
    1. ..._if
    2. actions
    3. anchor
    4. attr
    5. date selection
    6. draggable
    7. eval
    8. label
    9. link params
    10. name
    11. prefix
    12. publish
    13. set_...
    14. status
    15. store
    16. text, t
    17. tlabel
    18. toggle
  6. conditions
  7. context
  8. dates
  9. display
  10. forms
  11. i18n
  12. meta
  13. SQLiss
  14. urls

This works exactly like eval except that the evaluation scope starts in the current node. This means you can for the use of an attribute with “attr” if you have a helper method with the same name for example. If you have a ‘trans’ property (same name as trans, the translation method), you could access it with:

<r:show attr='trans'/>

Which is finally the same as:

<r:show eval='node.trans'/>

obsolete docs to be removed

<r:show attr='name'/>
<li do='link' attr='v_title'/>
<r:show attr='v_updated_at'/>
<r:show attr='updated_at'/>
<!-- rss feed -->
<link rel="alternate" type="application/rss+xml" title="RSS Super site" do='void' mode='rss' format='xml' set_href='[url]'/>
<a do='void' set_href='[path]'>blah</a>

<r:set var='hours'><r:stat find='sum'/></r:set>
<r:show var='hours'/>

The last example displays the pseudo-attribute ‘url’ using the ‘show’ shortcut.

The “rss feed” example above works because the “do” tag is after type, rel and title, thus considering these parts as pure html and mode,format,set_href are after the “do” tag so they are parsed as zafu.