Dynamic Menu

Hi, I think I’m doing this the right way, but can’t get it going. I’m
building a menu from the values in a mySQL table, and want to build it
on the fly. This is something that should be working but only works
halfway:

<% @pages = Page.find(:all, :conditions => [‘site_id = 4’]) %>
<% @pages.each do |p| %>
xyz
<%p.id%>
<% end %>

I know there are two page objects in the array, and the literal in the
loop indeed paints twice, but I can’t get p.id to paint anything at all
though.

Joe C. wrote:

Hi, I think I’m doing this the right way, but can’t get it going. I’m
building a menu from the values in a mySQL table, and want to build it
on the fly. This is something that should be working but only works
halfway:

<% @pages = Page.find(:all, :conditions => [‘site_id = 4’]) %>
<% @pages.each do |p| %>
xyz
<%p.id%>
<% end %>

I know there are two page objects in the array, and the literal in the
loop indeed paints twice, but I can’t get p.id to paint anything at all
though.

You need an = in Rails tags you want displayed. :slight_smile:

i.e. <%= p.id %>

Adam B. wrote:

Joe C. wrote:

Hi, I think I’m doing this the right way, but can’t get it going. I’m
building a menu from the values in a mySQL table, and want to build it
on the fly. This is something that should be working but only works
halfway:

<% @pages = Page.find(:all, :conditions => [‘site_id = 4’]) %>
<% @pages.each do |p| %>
xyz
<%p.id%>
<% end %>

I know there are two page objects in the array, and the literal in the
loop indeed paints twice, but I can’t get p.id to paint anything at all
though.

You need an = in Rails tags you want displayed. :slight_smile:

i.e. <%= p.id %>

Ok thanks, that worked! Sorry for the stupid question, but I’m up to my
nose in learning curve.

You need an = in Rails tags you want displayed. :slight_smile:

i.e. <%= p.id %>

Ok thanks, that worked! Sorry for the stupid question, but I’m up to my
nose in learning curve.

It’s only stupid the first few times you do it.

By the time you’ve done it as many times as me, it’s
bang-your-head-against-a-wall-dumb.

:smiley:

-Adam

Mauricio D. wrote:

hello, any one know how to make dynamic menu with radiant

what do you mean dynamic menu?

Cheers,
Mohit.
5/28/2009 | 11:47 PM.

Funny, I have a problem of having to change my <%= to <% not the orther
way around, lot eaiser to find the problem :stuck_out_tongue:

Mauricio,

What kind of dynamic menu are you looking to create? There are lots of
examples out there, some on the wiki:
http://wiki.github.com/radiant/radiant

Sean

if it is possible to create menus that I create content

example

<< Home>>
<< News>CAT1> CAT2Cat2.1>
<>

Mauricio -

This is pretty typical problem. I would structure your site like so:

Home
± News
| ± CAT1
| ± CAT2
| ± Cat2.1
± Contact

To generate that navigation menu, you would essentially loop through the
children of “Home”, and their children, and so on until you’ve reached
the maximum depth you want to display.

Sean

OK Seab

thanks LOL
El 28/05/2009, a las 13:22, Sean C.
escribió:

Mauricio -