# 3 level deep navigation tags

**URL:** <https://www.ruby-forum.com/t/3-level-deep-navigation-tags/106052>\
**Category:** Radiant CMS\
**Created:** [June 5, 2007, 11:20pm UTC](https://www.ruby-forum.com/t/3-level-deep-navigation-tags/106052 "2007-06-05T23:20:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave4c03](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@dave4c03](https://www.ruby-forum.com/u/dave4c03)\
**Post date:** [June 5, 2007, 11:20pm UTC](https://www.ruby-forum.com/t/3-level-deep-navigation-tags/106052/1 "2007-06-05T23:20:17Z")

</div>

I would like to convert [http://sanjosechiropractic.com/](http://sanjosechiropractic.com/) to a radiant  
based  
site. However, it seems to me radiant does not yet have navigation tags  
to  
deal with a 3 level deep menu. For example, see »  
Home[http://sanjosechiropractic.com/index.html](http://sanjosechiropractic.com/index.html)» About  
Chiropractic [http://sanjosechiropractic.com/chiropractic.html](http://sanjosechiropractic.com/chiropractic.html) »  
Straights  
and Mixers for the sort of menu structure required.

What is the current status of work being done in this area?

I know it is possible to solve the problem by hard coding the menu  
information into the site. however, that is unacceptable, I need to  
generate all navigational menus from the radiant file structure.

---

<div class="post-metadata">

**Author:** ![dave4c03](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@dave4c03](https://www.ruby-forum.com/u/dave4c03)\
**Post date:** [June 6, 2007, 7:57am UTC](https://www.ruby-forum.com/t/3-level-deep-navigation-tags/106052/2 "2007-06-06T07:57:10Z")

</div>

I got a \*undefined tag `if\_ancestor\_or\_self’.

\*I found your email at  
[http://lists.radiantcms.org/pipermail/radiant/2006-September/001968.html](http://lists.radiantcms.org/pipermail/radiant/2006-September/001968.html).  
Is  
the code in your email all that is required to define the  
if\_ancestor\_or\_self tag?

---

<div class="post-metadata">

**Author:** ![dave4c03](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@dave4c03](https://www.ruby-forum.com/u/dave4c03)\
**Post date:** [June 6, 2007, 12:02am UTC](https://www.ruby-forum.com/t/3-level-deep-navigation-tags/106052/3 "2007-06-06T00:02:23Z")

</div>

Dave,

Check back through the mailing-list archives for information about the  
sitemap snippet. It does most of what you want.

@Marty H. - would you be willing to share the working code for the  
if\_ancestor tag? I haven’t looked at it in a while.

Sean

---

<div class="post-metadata">

**Author:** ![dave4c03](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@dave4c03](https://www.ruby-forum.com/u/dave4c03)\
**Post date:** [June 6, 2007, 2:27pm UTC](https://www.ruby-forum.com/t/3-level-deep-navigation-tags/106052/4 "2007-06-06T14:27:06Z")

</div>

Dave,

Here’s some updated code that will work with 0.6. Keep in mind this  
doesn’t describe how to hook it up.

tag ‘if\_ancestor\_or\_self’ do  
page = tag.globals.actual\_page  
ancestors = page.ancestors  
context\_page = tag.locals.page  
tag.expand if context\_page == page || ancestors.include?(context\_page)  
end

Sean

---

<div class="post-metadata">

**Author:** ![dave4c03](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@dave4c03](https://www.ruby-forum.com/u/dave4c03)\
**Post date:** [June 6, 2007, 4:29pm UTC](https://www.ruby-forum.com/t/3-level-deep-navigation-tags/106052/5 "2007-06-06T16:29:37Z")

</div>

I have a plugin that gives you tags that you need to make nested  
navigation:

[http://svn.artofmission.com/svn/plugins/radiant/plugins/navigation\_tags/](http://svn.artofmission.com/svn/plugins/radiant/plugins/navigation_tags/)

On Jun 6, 2007, at 7:25 AM, Sean C. wrote:

> (context\_page)
> 
> > the code in your email all that is required to define the
> > 
> > > @Marty H. - would you be willing to share the working code  
> > > based  
> > > Straights
> > > 
> > > > Radiant mailing list  
> > > > Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> 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)

* * *

Ryan H.  
Art of Mission, Inc.  
3720 Gattis School Rd #800 PMB 245  
Round Rock, TX 78664

800-722-1492 (phone)

[www.artofmission.com](http://www.artofmission.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![dave4c03](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@dave4c03](https://www.ruby-forum.com/u/dave4c03)\
**Post date:** [June 7, 2007, 11:07pm UTC](https://www.ruby-forum.com/t/3-level-deep-navigation-tags/106052/6 "2007-06-07T23:07:41Z")

</div>

It looks like it just might work! Thanks!

Did you know the tag works in a snippet but does not work in a layout?  
It  
gets a \*undefined method `ancestors’ for nil:NilClass. \*(I might have  
installed it wrong, all I did was put it in a navigation\_tags directory  
under vendor/plugins)

---

<div class="post-metadata">

**Author:** ![dave4c03](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@dave4c03](https://www.ruby-forum.com/u/dave4c03)\
**Post date:** [June 8, 2007, 5:17am UTC](https://www.ruby-forum.com/t/3-level-deep-navigation-tags/106052/7 "2007-06-08T05:17:16Z")

</div>

> Did you know the tag works in a snippet but does not work in a  
> layout? It  
> gets a \*undefined method `ancestors’ for nil:NilClass. \*(I might have  
> installed it wrong, all I did was put it in a navigation\_tags  
> directory  
> under vendor/plugins)

Strange - I don’t know why it would do that - I haven’t tried it in a  
layout yet. Feel free to modify it; if you want to send me a patch  
I’ll see that it gets committed. Also, the tag can be terribly slow  
if you have a lot of pages. If you can figure out a way to make it  
render faster, that would be much appreciated.

Thanks!

On Jun 7, 2007, at 4:06 PM, dave4c03 wrote:

> > > Here’s some updated code that will work with 0.6. Keep in mind this  
> > > Sean
> > > 
> > > > On 6/5/07, Sean C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > > > 
> > > > > > navigation tags
> > > > > > 
> > > > > > Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)
> > > 
> > > Post: removed\_email\_address@domain.invalid  
> > > 800-722-1492 (phone)  
> > > Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> 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)

* * *

Ryan H.  
Art of Mission, Inc.  
3720 Gattis School Rd #800 PMB 245  
Round Rock, TX 78664

800-722-1492 (phone)

[www.artofmission.com](http://www.artofmission.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![dave4c03](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@dave4c03](https://www.ruby-forum.com/u/dave4c03)\
**Post date:** [June 8, 2007, 6:34am UTC](https://www.ruby-forum.com/t/3-level-deep-navigation-tags/106052/8 "2007-06-08T06:34:22Z")

</div>

> Check back through the mailing-list archives for information about the  
> sitemap snippet. It does most of what you want.
> 
> @Marty H. - would you be willing to share the working code for the  
> if\_ancestor tag? I haven’t looked at it in a while.

Sorry, just saw this. If you guys still want the extension that I  
plugged this into just email me off list.

Cheers,  
Marty
