Dynamic Attributes in a Snippet Tag?

Has anyone ever thought about adding an attribute to a Snippet call

e.g. <r:snippet linktext=“Read more of this column” />

and then having a way of pulling that attribute in the Snippet all using
Radius tags?:

e.g. Snippet content <r:linktext /> more Snippet content…

This is one of those things which could lead to all “misuse” of Radiant
I suppose, but it would sure be an easy implemenation that would enable
a number of useful and potentially in-scope applications.

I have a particular use-case if there is any interest.


Loren J.
[email protected]

You could do something similar, but it wouldn’t work that way because
would have to define the tag when you were already parsing! Instead you
would have to make modifications to the “snippet” tag definition to
attributes it doesn’t use in a tag.locals, and then add a new tag, say
“echo” that outputs individual dynamic attributes. <r:echo
/>, for example. Still, I don’t see what that accomplishes.

Sean C.

On 10/27/06, Sean C. [email protected] wrote:

Still, I don’t see what that accomplishes.

Giving snippets context?


It sounds like you need page parts, but if I’m understanding you
correctly, you need at least one snippet so it can be evaluated in the
template or in multiple pages. A page part would contain the summary,
which would be accessed and formatted by the snippet.


We do currently use a Summary page part and a ArticleSummary snippet.
In the following scenario it allows us to flow-in article summaries
with 3 lines of markup instead of 6. Big deal… but it would allow
us to build-up a CMS vocabulary and more viably bring a client
directly into the content management themselves. I do understand that
this sort of simplified Content Management workflow stuff begins to
fall out of the scope of Radiant as so far articulated.

I digress.


On Oct 27, 2006, at 6:26 PM, Sean C. wrote:

So I say to Paul, no problem I’ll just through that little set of
spots if we want to change something global outside the scope of
<r:find url="/news/ecs/article/" >

Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant

Loren J.
[email protected]

Sean and Mislav thanks for the responses –

For what it’s worth, below is the use case for dynamic attributes in
Snippets. There are things that I’d like to see added to a Radiant
release more and before than this without question (page reordering
and reparenting please), but at least here is a use case for the
record of what I think could be an easy, useful and possibly in-scope
extension to Snippets.

An Article Summary Template

I work with a designer for most everything I do. His HTML/CSS skills
are poor. We are just finishing-up a site (http://
diopa.grimedesign.com) and in that site on several pages we pull-in
the summary part of an article and attached a nice little header
which spits out the name of the Section and the date the Article was
posted before the title. This summary pattern repeats many times and
is always the same except that we like to customized the link text
which goes to the full article. Everything else is dynamic.

So I say to Paul, no problem I’ll just through that little set of
tags into a snippet such that he can do a

<r:find url="/news/ecs/article">
<r:snippet name=“summary” linkText=“Read more about this on ECS
News” />

This means that he doesn’t have to copy and paste a format for this
summary over and over as he populates the site with content. It also
of course means we don’t have to change it in all those spots if we
want to change something global outside the scope of the CSS in this
summary format.

We had considered using another page part called "linkText’ to
accomplish the same end, however we have situations where the same
article is posted in multiple places on the site in different
contexts and the link text changes accordingly.

Without any of these options working we’re left with the acceptable,
though less than preferable solution of:

<r:find url="/news/ecs/article/" >

Read more about this on ECS News...


Loren J.
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs