This goes against the design of Radius.

You might be able to write a new assets tag and parse the contents of
the attributes first before rendering the tag.  Or write an assets tag
that checks to see if a local variable exists and use that if there is
no id given.


On Mon, Oct 25, 2010 at 4:04 PM, Horst Rischbode <ho...@horibo.de> wrote:
> Hi,
> Backdoor doesn't seem to be the solution :-(
>
> I want the id of the following statement to be variable:
> <r:assets:image id="3" size="normal" />
>
> So I have to use something like that:
> <r:erb>
>     <r:assets:image id="<%= @image_id %>" size="normal" />
> </r:erb>
>
> It seems, that first the radius tags are evaluated. Than, I have the same
> problem like before: nested tags, which are not allowed (and possible).
>
> Horst
>
>
> Am 24.10.2010 20:38, schrieb Horst Rischbode:
>
> 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
>
>
>
>
>
>



-- 
Jim Gay
Saturn Flyer LLC
http://www.saturnflyer.com
571-403-0338

Reply via email to