I can be a little confusing at first, but for the basics of virtual pages, I'd check out the ArchivePage types. The pages themselves are in vendor/app/models/archive*.rb but probably the most important part is is the module in vendor/radiant/lib/archive_index_tag which is included in all of the virtual archive pages.
The easiest way to do what you're trying to do would be to make two new page types: one that's the parent of the virtual page which acts as an index (RecipeListPage) and another that's the actual virtual page (RecipePage). In RecipeListPage, you may want to override child_url and find_by_url as in ArchivePage. In RecipePage, you can override find_by_url to query for the recipe record and save it as an instance variable which will be available later. You'll also want to override render to handle the Recipe objects instead of rendering the PageParts like normal. You'll also want to override virtual? to return true and probably do something with title as well. Sorry if this wasn't too detailed. I'd recommend maybe stepping through the URL matching and render code with ruby-debug if you want to get a better idea of how things work. Here's a good tutorial on ruby-debug: http://www.datanoise.com/articles/2006/07/12/tutorial-on-ruby-debug -Andrew On 11/9/07, Chris Parrish <[EMAIL PROTECTED]> wrote: > I'm about to start work on an extension where I need to create my own > virtual page type. I'm more than a little confused about them and am > not sure where to start. (As I leave charted waters, my map just reads: > "There be dragons here"). > > Anybody able to point me to some documentation or some good sample code > that might give me a leg up in this area? > > Specifically, what I'm looking to do is allow the user to create a > virtual page that renders a list view (say, '/recipes') based on dynamic > data in the db. But I also want this page to automatically have it's > own virtual children rendering as an item view (like, > '/recipes/apple-pie' & '/recipes/chicken-gumbo'). > > -Chris > > _______________________________________________ > Radiant mailing list > Post: [email protected] > Search: http://radiantcms.org/mailing-list/search/ > Site: http://lists.radiantcms.org/mailman/listinfo/radiant > _______________________________________________ Radiant mailing list Post: [email protected] Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
