Forum: Radiant CMS extension question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bill Rowell (Guest)
on 2007-05-25 10:15
(Received via mailing list)
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.
Keith B. (Guest)
on 2007-05-25 10:29
(Received via mailing list)
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/
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. Both
the posts and the galleries are based on it.

Keith B.
Tel: +49-7731-79838380
removed_email_address@domain.invalid
http://keithbingman.com
Andrew O'Brien (Guest)
on 2007-05-25 19:06
(Received via mailing list)
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) 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?
Keith B. (Guest)
on 2007-05-25 19:19
(Received via mailing list)
>
> 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/

Let me know if that doesn't work.


Keith B.
Tel: +49-7731-79838380
removed_email_address@domain.invalid
http://keithbingman.com
Loren J. (Guest)
on 2007-05-27 02:35
(Received via mailing list)
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 (or more concretely 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.
www.hellovenado.com
Sean C. (Guest)
on 2007-05-27 19:51
(Received via mailing list)
Looking forward to your extension, Loren.

Sean
This topic is locked and can not be replied to.