[typo] Article Types / Templates

Ryan Abrams ryanabrams at gmail.com
Tue Aug 23 09:45:25 EDT 2005


I'm looking to have various article types render differently. For
example, a "review" could render the "extended" field as part of an
image tag, thus allowing me to have a star based ranking and different
layout on the review. That sort of thing.

To do this, I think i'll need to implement two things:

1) a "type" attribute on articles. Is this as simple as creating a
types table with a has_one :type kinda structure on the article? I
guess I can muck through this.

2) a way to evaluate the type and call a different render partial by
type. I imagine i can just call render partial with the types name,
and expect that the appropriate rhtml file will exist. At least for a
first go... longer term it would be expected that creating a type
would duplicate the default rhtml file to avoid errors.

Is this the right approach to take? Is there an easier way to do this
already, or to implement it? Is this something others would want, or
should I just have a go at it for my personal site only?

Thanks,

Ryan



More information about the Typo-list mailing list