Table of contents snippet help

I’ve been trying to make a simple Table of Contents snippet that would
create a table of contents for a FAQ system where questions fall into
categories and each category and question is a page in the admin
interface (though the individual questions would all be listed in full
on the category page).

What I have so far is:
<r:parent>

“<r:title/>”:<r:url/>
<r:children:each>

  • “<r:title/>”:<r:url/>

    <r:children:each>
    ** “<r:title/>”:<r:url/>
    </r:children:each>

</r:children:each>

Category pages look like:
<r:children:each>

        <h2><r:title/></h2>

        <r:content/>
      </r:children:each>

The only trouble I am having is that I want the second level contents
(the children of the child listed) to only be listed if that child is
currently active. Its simple to have the children (questions) of all
categories visible, but I only want the children of the active category
to be visible.

So if my directory structure is:
-FAQ
–why
—why am i so lame?
—why do i always need help?
–how
—how will i find help?
—how will this all end up?

…and my currently active page is the “how” category page then I want
my table of contents to read:

  • why
  • how
    –how will i find help?
    –how will this all end up?

So the table of contents is hiding the children of the other sections.

Any advice on how to do this with the current tags or with a custom tag
would be appreciated.

Thanks!

This is what I came up with. Its not ideal because its less automated
than I wanted. I have to add an extra if_url section for every category
I create.

<r:if_url matches="./*faq/$">

h2. Table of Contents:

  • "":: ()

</r:if_url>

<r:if_url matches="./*faq/category-1/$">

h2. Table of Contents:

  • "":: ()
    • "":#
  • "":: ()

h2. Table of Contents:

  • "":: ()
    • "":#
  • "":: ()

h2. Table of Contents:

  • "":: ()
    • "":#
  • "":: ()

h2. Table of Contents:

  • "":: ()
    • "":#
  • "":: ()

Any ideas on how to have it automatically cycle through each of the
categories rather than my having to create it manually?

Hi,

I’ve set up a radiant site and it works fine on Firefox and Epiphany,
however when on Internet Explorer 6-7 the site doesn’t render instead it
forces a save as prompt for the main html page.

The problem persists running the site with Webrick, Mongrel, and Apache
FCGI.

I’ve another radiant site running Webbrick and it renders fine on IE.
What
could be the problem then? I’ve reinstalled radiant and nothing. How
could
I figure out what’s wrong?

Jose.

Can you just create a FAQ controller (and behaviour) and have the url
encode
the arguments? Even though your solution works, it violates DRY…BIG
TIME!

Ruben D. Orduz wrote:

Can you just create a FAQ controller (and behaviour) and have the url
encode
the arguments? Even though your solution works, it violates DRY…BIG
TIME!

I’m a css/html guy, don’t know any rails. I was hoping someone could
point me in the right direction though.

Hi,

Ok. When I remove the utf-8 declaration from the Normal layout More
Content-Type tab the page does display in Internet Explorer 5.0, 5.5,
and
6.0. However, the page’s layout appears very distorted. At least now
it’s
a matter of css.

Has anybody experienced similar problems?

jose.