Thank you, Mario, for making your extension available.
It's very well documented and record tags are easy to use.
I have extended the 'records' tag adding a 'SQL' attribute where one can
place a SQL statement that is executed via [model].find_by_sql.
Here is the patched code:
tag 'records' do |tag|
raise TagError, "'#{tag.name}' tag must contain a 'model'
attribute." unless tag.attr['model']
if tag.attr['SQL']
records =
eval("#{tag.attr['model']}.find_by_sql(tag.attr['SQL'])")
else
if tag.attr['id']
records =
eval("#{tag.attr['model']}.find(tag.attr['id'])")
else
records =
eval("#{tag.attr['model']}.find(:all, :conditions =>
tag.attr['conditions'], :order => tag.attr['order'], :offset =>
tag.attr['offset'], :limit => tag.attr['limit'])")
end
end
tag.locals.records = records
tag.expand
end
I gave a look to the 'record' tag, used for showing individual records.
The tags has an 'id' attribute that can be set manually in a dedicated
radiant page. I was wondering how to make a radiant page showing
individual records dynamic, i.e. selecting the record with the id passed
as a request param. In this case the page acts as a template used for
every record, avoiding the creation of distinct pages with the id value
"hard coded" in each of them.
I posed this same problem in a previous post, and tried new attempts at
solving it, but have not been able to figure out a solution so far.
Luca
[EMAIL PROTECTED]
>Some of you had indicated an interest in my not-yet-mature extension for
>rendering models. Basically, it allows you to use Radius tags to
>display records from your Radiant database. Obviously, this is most
>useful if you've created custom models and the back-end interface (an
>extension) to maintain those models.
>You can download the extension at:
>http://www.boardgamerspastime.com/downloads/radiant/extensions/record_tags.zip
>Please notify me of any issues you encounter. I've tested on Ubuntu.
>Mario
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant