# Processing unrelated nested Radius tags

**URL:** <https://www.ruby-forum.com/t/processing-unrelated-nested-radius-tags/126289>\
**Category:** Radiant CMS\
**Created:** [January 17, 2008, 12:43am UTC](https://www.ruby-forum.com/t/processing-unrelated-nested-radius-tags/126289 "2008-01-17T00:43:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [January 17, 2008, 12:43am UTC](https://www.ruby-forum.com/t/processing-unrelated-nested-radius-tags/126289/1 "2008-01-17T00:43:39Z")

</div>

Hello,

I’m trying to process one radius tag inside another. For example, one  
tag retrieves a photo name such as “Dave.jpg” and sticks it into the  
page\_attachments tag for an image:

\<r:attachment:image name="\<r:photo\>\<r:photo:name /\>\</r:photo\>"  
alt=“photograph” /\>

The resulting HTML output is…

\<r:attachment:image name=“Dave.jpg” alt=“photograph” /\>

… but the problem is the \<r:attachment:image\> tag itself is never  
processed, so the photo does not appear on the screen.

I’m guessing this is a tag scope issue. Any help?

Thanks,

- Dave

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [January 17, 2008, 1:00am UTC](https://www.ruby-forum.com/t/processing-unrelated-nested-radius-tags/126289/2 "2008-01-17T01:00:09Z")

</div>

> \<r:attachment:image name="\<r:photo\>\<r:photo:name /\>\</r:photo\>" alt=“photograph” /\>

This also produces the same unprocessed \<r:attachment:image\> tag:

\<r:attachment:image name="\<r:photo\>\<r:name /\>\</r:photo\>" /\>

This fails completely, however:

\<r:attachment:image name="\<r:photo:name /\>" /\>

“You have a nil object when you didn’t expect it! The error occurred  
while evaluating nil.content\_type”

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [January 17, 2008, 5:16am UTC](https://www.ruby-forum.com/t/processing-unrelated-nested-radius-tags/126289/3 "2008-01-17T05:16:27Z")

</div>

On 1/16/08, David P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> \<r:attachment:image name=“\<r:photo\>\<r:photo:name /\>\</r:photo\>” alt=“photograph” /\>

This fails because Radius can’t parse tags that are within attributes.  
Why are you trying to do this? Is there a way to accomplish what you  
want without using tags within attributes.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [January 19, 2008, 6:18pm UTC](https://www.ruby-forum.com/t/processing-unrelated-nested-radius-tags/126289/4 "2008-01-19T18:18:18Z")

</div>

John L. wrote:

> On 1/16/08, David P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > \<r:attachment:image name=“\<r:photo\>\<r:photo:name /\>\</r:photo\>” alt=“photograph” /\>
> 
> This fails because Radius can’t parse tags that are within attributes.  
> Why are you trying to do this? Is there a way to accomplish what you  
> want without using tags within attributes.

My goal was to have a person’s name in the DB generate a filename that I  
could pass to the page\_attachments tag to grab. Example:

David P. → david\_piehler.jpg → \<r:attachment:image  
name=“david\_piehler.jpg” /\>

As you’ve said though, something like this is not possible due to the  
way Radius tags are parsed. Thanks for clarifying this. I’ve since taken  
a more heavy-handed approach to solve it.

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [January 20, 2008, 12:22am UTC](https://www.ruby-forum.com/t/processing-unrelated-nested-radius-tags/126289/5 "2008-01-20T00:22:41Z")

</div>

David P. wrote:

> My goal was to have a person’s name in the DB generate a filename that I  
> could pass to the page\_attachments tag to grab. Example:
> 
> David P. -\> david\_piehler.jpg -\> \<r:attachment:image  
> name=“david\_piehler.jpg” /\>
> 
> As you’ve said though, something like this is not possible due to the  
> way Radius tags are parsed. Thanks for clarifying this. I’ve since taken  
> a more heavy-handed approach to solve it.

David,

The way I’ve found to do this is to use nested Radius tags that pass  
information back up to the parent. However, the page\_attachments tags  
are currently not structured to support this. If they were, it might  
look like this:

\<r:attachment:image\>\<r:name\>david\_piehler.jpg\</r:name\>\</r:attachment:image\>

Obviously, you would use some of your own tags to generate the name.

Sean

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [January 20, 2008, 2:49am UTC](https://www.ruby-forum.com/t/processing-unrelated-nested-radius-tags/126289/6 "2008-01-20T02:49:07Z")

</div>

Sean C. wrote:

> > > >
> 
> are currently not structured to support this. If they were, it might  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

I don’t see why you couldn’t override \<r:attachment:image\> with your own  
custom version that would permit either a ‘name’ or ‘user\_name’  
attribute like:

\<r:attachment:image user\_name=“David P.” /\>

Of course you’d have the issue of keeping your version of the tag in  
sync with revisions to the PageAttachments extension. But it would  
probably be pretty easy to implement too.

-Chris

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [January 24, 2008, 11:02pm UTC](https://www.ruby-forum.com/t/processing-unrelated-nested-radius-tags/126289/7 "2008-01-24T23:02:58Z")

</div>

Chris P. wrote:

> I don’t see why you couldn’t override \<r:attachment:image\> with your own  
> custom version that would permit either a ‘name’ or ‘user\_name’  
> attribute like:
> 
> \<r:attachment:image user\_name=“David P.” /\>
> 
> Of course you’d have the issue of keeping your version of the tag in  
> sync with revisions to the PageAttachments extension. But it would  
> probably be pretty easy to implement too.
> 
> -Chris

That’s a good idea. If my temporary solution doesn’t work out, I’ll try  
that. Thanks!

- Dave
