Submenu

I don’t know if anyone is currently working on or will be adding a kind
of menu functionality to Radiant. The idea being that there are
navigational element necessary to navigate the site’s content areas.

The idea here is that for content, it automatically creates a

    list
    that you can manipulate to your liking.

    So:

    / – root

    • — Home
    • — About Me
      ------- About the Site
    • — Database
      ------- Sub Section One
      --------- Page One
      --------- Page Two
      ------------ Sub Page One
    • — Contact Me

    This would be automatically created inside a tag, possibly something
    like <r:menu /> which would have options to exclude pages and etc and
    style to your liking, so only page relevant to the area show up.

    I hope I am getting my idea across.

Ian G. wrote:

I don’t know if anyone is currently working on or will be adding a kind
of menu functionality to Radiant. The idea being that there are
navigational element necessary to navigate the site’s content areas.

The idea here is that for content, it automatically creates a

    list
    that you can manipulate to your liking.

    So:

    / – root

    • — Home
    • — About Me
      ------- About the Site
    • — Database
      ------- Sub Section One
      --------- Page One
      --------- Page Two
      ------------ Sub Page One
    • — Contact Me

    This would be automatically created inside a tag, possibly something
    like <r:menu /> which would have options to exclude pages and etc and
    style to your liking, so only page relevant to the area show up.

    I hope I am getting my idea across.

I am in need of something very similar to this and will probably be
tackling the problem sometime in the week. Have you looked at the
sitemap howto? That may be a good place to start.

Seancribbs also showed some interest in producing such a tag in IRC the
other day although I’m not sure if anything came from that in the end.

Kev

On Sep 18, 2006, at 11:20 AM, Kevin A. wrote:

Ian G. wrote:

I don’t know if anyone is currently working on or will be adding a
kind
of menu functionality to Radiant. The idea being that there are
navigational element necessary to navigate the site’s content areas.

I am in need of something very similar to this and will probably be
tackling the problem sometime in the week. Have you looked at the
sitemap howto? That may be a good place to start.

I’ve thought about doing something similar, but I just haven’t had
the time to get to it. I was thinking to make a tag very similar to
the <r:navigation /> tag, but instead of giving it a list of titles
and paths, give it a parent page, eg:

<r:menu parent="/root/path" />

and it uses the <r:selected /> and other navigation tags.

Nothing but talk to show for it yet though… :slight_smile:

Bodhi

I think we should get some code posted and people might be more apt to
try and do something. Hmm, code, damn my newbie skills with ruby!

Bodhi wrote:

I’ve thought about doing something similar, but I just haven’t had
the time to get to it. I was thinking to make a tag very similar to
the <r:navigation /> tag, but instead of giving it a list of titles
and paths, give it a parent page, eg:

<r:menu parent="/root/path" />

and it uses the <r:selected /> and other navigation tags.

Hmm, that’s another possibility. I may try to tackle this today if I can
get my head around how to best deal with the multiple levels and
expanding the current section correctly.

Here is an attempt at it.

submenu_behavior.rb

class SubMenuBehavior < Behavior::Base

register “Sub Menu”

description %{
Submenu is the ability for pages to have their parent and children
automatically generated into

    's for users.
    }

    define_tags do
    tag ‘submenu’ do
    ‘Create list’
    end

    tag ‘submenu’ do |tag|
    name = tag.attr[‘exclude’] || ‘array’

    exclude code here

    end

    end

    I don’t even know ruby that well so this is all probably terribly wrong,
    you can laugh if you want :*-(

On our website, I implemented submenus the following way:

  1. Create a submenu snippet:

This renders an unordered list of links to all children of a page. If
some pages are to be excluded, you can do this by adding some
<r:unless_url/> markup.

  1. Create a content part “submenu” on each first levelpage that has
    children:

<r:find url=“page_name”>
<r:snippet name=“submenu”/>
</r:find>

This calls the above snippet with the current page selected so that the
snippet will iterate over its children and render its submenu.

  1. Include the content part in your layout

<r:content part=“submenu” inherit=“true”/>

The “inherit” attribute makes sure the submenu will be used on all child
pages unless overridden.

It’s a quick and rather non-DRY solution because you have to define the
content part on each first level page and to manually enter the page
title there, but from there everything works automatically. Highlighting
etc. can be done with CSS - if you are interested, I can post some code.

Hope you can use it!

Cheers,
Wolfgang

Hi,

I have 2 snippets for my navigation.

  1. Primary Navigation:
  • 8< –
UKTUG

Site Navigation

Masthead Image of a
Lion, the TeX mascot
– 8< –

  1. SecondaryNavigation
    – 8< –

Breadcrumbs

Child Pages

And then this ‘Normal’ Layout:
– 8< –

<r:snippet name=“secondarynavigation” />



-- 8< --

Note the smart way of including page-level CSS by just creating a
‘stylesheet’ Page Part in the Admin Interface, but if no part of that
name exists then the page does now show any signs of it. (Just added
to Receipes on Wiki :slight_smile:

I also want to follow the <r:if_child> to the secondarynavigation so
instead of

Child Pages

I can do

Child Pages

But not had time yet :slight_smile:


Regards,
Dave

On 18/09/06, Dave C. [email protected] wrote:

Hi,

I have 2 snippets for my navigation.

See this in action at http://uk.tug.org :slight_smile:


Regards,
Dave

Dave C. wrote:

On 18/09/06, Dave C. [email protected] wrote:

Hi,

I have 2 snippets for my navigation.

See this in action at http://uk.tug.org :slight_smile:


Regards,
Dave

Thanks Dave I will definately give it a try and see how I can improve on
it, if I can.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs