# Extension question

**URL:** <https://www.ruby-forum.com/t/extension-question/105045>\
**Category:** Radiant CMS\
**Created:** [May 25, 2007, 8:15am UTC](https://www.ruby-forum.com/t/extension-question/105045 "2007-05-25T08:15:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bill\_Rowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d07c76/32.png) [@Bill\_Rowell](https://www.ruby-forum.com/u/Bill_Rowell)\
**Post date:** [May 25, 2007, 8:15am UTC](https://www.ruby-forum.com/t/extension-question/105045/1 "2007-05-25T08:15:12Z")

</div>

I’m developing another radiant extension that I basically want to be  
able to  
display a catalog of categories, sub-categories, and items with. I  
don’t  
want to have to create a page for every one of those, I want it to be  
dynamic based on what someone can set up through an admin interface. I  
also  
don’t want to lose the power of radiant and its tagging system (like not  
being able to use r:title, r:snippet, r:content etc. etc.) by having the  
extension be its own application outside of the CMS. Another  
requirement is  
the ability to have pretty urls like /catalog/department/shoes/ instead  
of  
having query string variables muddying things up.

Has anyone tried to do something like this and had some success that  
they  
could share? I’ve given this a bit of thought and haven’t really come  
up  
with a solution I like.

---

<div class="post-metadata">

**Author:** ![Bill\_Rowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d07c76/32.png) [@Bill\_Rowell](https://www.ruby-forum.com/u/Bill_Rowell)\
**Post date:** [May 25, 2007, 8:29am UTC](https://www.ruby-forum.com/t/extension-question/105045/2 "2007-05-25T08:29:41Z")

</div>

I did a tagging extension that works like this. Basically, you set up  
virtual pages with the slug as the name for your category. A regex in  
the page type grabs the slug from the url and then displays whatever  
it is you need. You just need to make some specific tags to display  
your categories and their attributes, but you can still use the basic  
Radiant tags. I set it up with two virtual pages, a listing page, and  
a display page. Listing shows all categories and links to them,  
display shows each category.

You can check out my extension at [http://svn.bitchkittyracing.com/](http://svn.bitchkittyracing.com/)  
extensions/metatagging. You may need to check out the assets  
extension to make it work, but I hope to change that in a few days,  
but I have been pretty busy for the last few days.

Let me know if you have any questions.

I have an example of this working at [http://keithbingman.com](http://keithbingman.com). Both  
the posts and the galleries are based on it.

Keith B.  
Tel: +49-7731-79838380  
removed\_email\_address@domain.invalid  
[http://keithbingman.com](http://keithbingman.com)

---

<div class="post-metadata">

**Author:** ![Bill\_Rowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d07c76/32.png) [@Bill\_Rowell](https://www.ruby-forum.com/u/Bill_Rowell)\
**Post date:** [May 25, 2007, 5:06pm UTC](https://www.ruby-forum.com/t/extension-question/105045/3 "2007-05-25T17:06:09Z")

</div>

I think I’m looking to do much the same thing – I have a bunch of  
database records that I want to output in a uniform way, 1 per page,  
all linked under a parent page that lists them.

What I’d come up with recently was to use a combination of the  
RecordTags extension  
([http://dev.radiantcms.org/radiant/wiki/RecordTags](http://dev.radiantcms.org/radiant/wiki/RecordTags)) and virtual pages.  
I haven’t implemented this yet, so I can’t give you much practical  
advice – it’s just the strategy I’m planning on using. The author of  
RecordTags admits that it’s pretty alpha, so beware.

Keith: Trying to browse your SVN, I get a login box. Do you have some  
kind of read only access you wouldn’t mind giving out to the list?

---

<div class="post-metadata">

**Author:** ![Bill\_Rowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d07c76/32.png) [@Bill\_Rowell](https://www.ruby-forum.com/u/Bill_Rowell)\
**Post date:** [May 25, 2007, 5:19pm UTC](https://www.ruby-forum.com/t/extension-question/105045/4 "2007-05-25T17:19:12Z")

</div>

> Keith: Trying to browse your SVN, I get a login box. Do you have some  
> kind of read only access you wouldn’t mind giving out to the list?

Whoops, I had the wrong address. There should be a “projects” folder,  
first. Not all folders are one, but that one is:

[http://svn.bitchkittyracing.com/projects/extensions/](http://svn.bitchkittyracing.com/projects/extensions/)

Let me know if that doesn’t work.

Keith B.  
Tel: +49-7731-79838380  
removed\_email\_address@domain.invalid  
[http://keithbingman.com](http://keithbingman.com)

---

<div class="post-metadata">

**Author:** ![Bill\_Rowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d07c76/32.png) [@Bill\_Rowell](https://www.ruby-forum.com/u/Bill_Rowell)\
**Post date:** [May 27, 2007, 12:35am UTC](https://www.ruby-forum.com/t/extension-question/105045/5 "2007-05-27T00:35:58Z")

</div>

Bill,

I’ve written a Event Calendar extension which pulls events from an  
ical subscription and populates them into calendars which each have  
an associated “category” and “slug”. I then access the different  
calendars through a virtual page root node like this: http://  
[yoursite.com/calendar/category/slug](http://yoursite.com/calendar/category/slug) (or more concretely http://  
[yoursite.com/main/youth](http://yoursite.com/main/youth)).

This is very similar to how the ArchivePage behavior in the core code  
works. Take a look at that if you haven’t already.

I’m releasing a tidied-up version of this EventCalendar extension  
here on the list within a day or two so you can use it as another  
example then… Actually though, pretty much everything you need is  
here between the EventCalendar page type which overrides find\_by\_url  
to, essentially shutting-down further Radiant processing of child  
pages, and the \<r:calendar… tag which processes the query path  
parameters:

class EventCalendar \< Page

LOGGER = ActionController::Base.logger

description %{ Create a series of calendar pages. }

def cache?  
false  
end

def virtual?  
true  
end

def find\_by\_url(url, live = true, clean = false)  
self  
end

end

AND

tag “calendar” do |tag|  
event\_search = EventSearch.new  
event\_search.category = tag.attr[‘category’] ||  
(@request.parameters[:url][1] if self.class == EventCalendar) ||  
“master”  
event\_search.slugs = tag.attr[‘slugs’] || (@request.path\_parameters  
[:url][2] if self.class == EventCalendar) || “all”  
event\_search.period.name = tag.attr[‘period’] ||  
(@request.path\_parameters[:url][3] if self.class == EventCalendar) ||  
“month”  
# … note the @request.parameters[:url][1] and [2] references  
end

Hope that helps,

Loren J.

> **[Resume - Loren Johnson](https://docs.google.com/document/d/1WfJomBItrSA281MMFbYpavEKLMkQAfG9pz0or0X5lBU/edit?usp=sharing)**
>
> LOREN JOHNSON 575-779-9996 | lorenjohnson@gmail.com | github.com/lorenjohnson | linkedin.com/in/johnsonloren EXPERIENCE Senior Software Engineer	April 2020 - Current Hylo.com – Terrans Collective Working full stack in Node, GraphQL, React, and...

---

<div class="post-metadata">

**Author:** ![Bill\_Rowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d07c76/32.png) [@Bill\_Rowell](https://www.ruby-forum.com/u/Bill_Rowell)\
**Post date:** [May 27, 2007, 5:51pm UTC](https://www.ruby-forum.com/t/extension-question/105045/6 "2007-05-27T17:51:31Z")

</div>

Looking forward to your extension, Loren.

Sean
