How to make a virtual page like '/page/:id'

While developing my first Radiant site I encountered a problem which
overwhelms me. Also, I’m not a programmer, so its only worse. Please
bear
with me.

First, I tried to make a page “/people” which lists all the people in
the
organization. So, I wrote “People” extension (my first), wrote some
tags,
and now I can enter a person into the database through the admin
interface,
and list every person in the database on the “/people” page. A small
victory. Unfortunately, it doesn’t end here.

Now I need to display everything there is about a person, but I don’t
want
to make a separate child page for each person. I think one page should
be
sufficient for that, so a virtual page is in order, right? Well, I tried
that, and failed miserably. It getting frustrating, since I’ve been
hanging
with Google for more then two days now. Either the examples I found are
too
complex, or my skull is too thick. At the moment, I’m betting on the
latter.

So, hopefully, someone has already been there and can show in a simple
way
how to achieve what I need to.

Thanks.

You’re on the right track. The “/people” page should be of a custom
type that you create so that all child URLs are routed to a single
virtual child page. I did this for the “Syllabi” at KCKCC over a year
ago. Here’s a link to the code:

Look specifically at the “Syllabi Courses Page” and the “Syllabi
Prefixes Page”. The “prefixes” page was used as the parent, the
“courses” page as the virtual child. You can see these in action at:

http://www.kckcc.edu/academics/course-descriptions/

Cheers,

Sean

On Jan 20, 2008 8:01 PM, Sean C. [email protected] wrote:

http://www.kckcc.edu/academics/course-descriptions/

Thanks Sean. To my surprise, somehow I managed to make it work not long
after clicking on the send button. I also found your extension which
helped
somehow, together with the archive extension. Who would say that simply
stearing long enough at the code you don’t really understand could get
you
somewhere. :slight_smile: My head is spinning, but its fun.

Now I need to make use of model associations. I see the syllabi is
associated with courses etc, but haven’t found yet how you use it in the
tags.

Thanks Sean. To my surprise, somehow I managed to make it work not long
after clicking on the send button. I also found your extension which helped
somehow, together with the archive extension. Who would say that simply
stearing long enough at the code you don’t really understand could get you
somewhere. :slight_smile: My head is spinning, but its fun.

Now I need to make use of model associations. I see the syllabi is
associated with courses etc, but haven’t found yet how you use it in the
tags.

Look in lib/syllabi_tags.rb for how the majority of the tags are
defined. Basically, there’s <r:prefix>, <r:courses>, <r:syllabi> tags
and various others below it. All they do is assist in looping over the
associations and emitting attributes, really.

Sean

It sounds like the question was solved, but I just wanted to take a
moment to plug my DataPages extension:

http://code.google.com/p/data-pages-extension/

Provided you had a way to export your people-data into JSON files (or
through a respond_to block in another Rails app’s controller), you
could make a Virtual Data page for your people directory that
templates the external data. (See the examples on the wiki.)

The upside of this would be that you wouldn’t have to co-mingle your
people data with your document data, which is cleaner IMHO. Also, you
wouldn’t have to implement new Radius tags if your data schema ever
changes.

-Andrew