Good call @Steven on Backdoor.
============
On Backdoor:
I didn't realize that you could do instance variables with Backdoor,
although of course now that makes sense.
A question about that - in this piece of code, here, what is the = in
front of @parent_url doing?
<r:if_url matches="=...@parent_url " >...</r:if_url>
===========
Horst,
I wasn't suggesting that you modify the Paperclipped tags, but that you
could write your own tags to do your arbitrarily complex logic, if,
for example, you couldn't use @Steven's method.
But it may be interesting to look at the Paperclipped tags, just to get
an idea how Radius tags work. They're here:
http://github.com/kbingman/paperclipped/blob/master/app/models/asset_page_tags.rb
http://github.com/kbingman/paperclipped/blob/master/app/models/asset_tags.rb
W
On 10/24/10 2:38 PM, Horst Rischbode wrote:
Thanks Steven for pointing at the Backdoor extension. Seems to do,
what I am looking for.
@Wes: I've tried to figure out, where the radius tags of paperclipped
are declared. But I couldn't find the right place. And Backdoor seems
to give back the flexibility, I've missed so far.
Best Regards
Horst
Am 24.10.2010 04:29, schrieb Steven Southard:
Hold up! If you add the Backdoor extension you can use this:
<r:ruby>
@parent_url = '<r:parent><r:url/></r:parent>'
""
</r:ruby>
<r:if_url matches="=...@parent_url " >...</r:if_url>
On Oct 23, 2010, at 2:38 PM, Wes Gamble wrote:
From "Basic Usage" at http://github.com/radiant/radiant/wiki/Radius-Tags
"As the |<r:parent>| example above shows, it is possible to nest
Radius tags *within* other Radius tags, so long as they are separate
elements. However, *using a Radius tag as the the attribute of
another Radius tag is /NOT ALLOWED/*. For example:
|<r:if_url matches="<r:parent><r:url/></r:parent>">...</r:if_url>
^ DON'T DO THIS, it breaks! ^|
Now you’re probably wondering, “How can I use variables or constants
within the attributes of a Radius tag?” The answer is that you can’t."
What you could do is write a custom tag to output this entire set of
HTML - see
http://github.com/radiant/radiant/wiki/Adding-Custom-Radius-Tags for
more details.
Wes
On 10/23/10 3:22 PM, Horst Rischbode wrote:
Hi,
I want to use this code within a page several times with different
orientations (image_left/image_right) and different ids:
<div class="image_left">
<r:assets:image id="3" size="normal" />
<h4 class="image_title"><r:assets:title id="3" /></h4>
<div class="image_caption"><r:assets:caption id="3" /></div>
</div>
I tried to be DRY by using the parameterized_snippets extension and
put this code into a snippet:
<div class="image_<r:var name="orientation" />">
<r:assets:image id="<r:var name="id" />" size="normal" />
<h4 class="image_title"><r:assets:title id="<r:var name="id" />"
/></h4>
<div class="image_caption"><r:assets:caption id="<r:var name="id"
/>" /></div>
</div>
and call it from the page like:
<r:snippet name="include_image" id="3" orientation="left" />
But this doesn't work. The ID and orientation is resolved
correctly. But the r:assets tags are not resolved and appear as
plain text in the page.
Is it possible to use the attached assets of a page within a snippet?
If not, is there any other way to avoid repeating the same code
several times?
Best Regards
Horst