Hold up!  If you add the Backdoor extension you can use this:

      @parent_url = '<r:parent><r:url/></r:parent>'

<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.

On 10/23/10 3:22 PM, Horst Rischbode wrote:


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>

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>

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

Reply via email to