Re: [Radiant] Routes and Custom Pages Types

2009-08-26 Thread Johannes Fahrenkrug
Hi Sean and Andrew,

thank you guys so much! This is exactly what I was looking for :)

- Johannes

On Tue, Aug 25, 2009 at 3:20 PM, Andrew
Neil wrote:
> On Tue, Aug 25, 2009 at 2:13 PM, Sean Cribbs  wrote:
>
>> Johannes,
>>
>> Your TripPage should override Page#find_by_url and return itself or an
>> appropriate child page for URLs that match your scheme.  Way back in the day
>> we did that for KCKCC's "syllabus" pages - wish I still had that example
>> around.
>
>
> Here is an example of overriding Page#find_by_url:
>
> http://github.com/nelstrom/radiant-audio_player-extension/blob/11e2b3398e4831c3d047ac30276215dd3af15678/app/models/audio_page.rb#L5-17
>
> This should match URLs of the form:
>
> /podcasts
>    [index page]
>
> /podcasts/1-first-episode
> /podcasts/2-second-episode
>    [show pages]
>
> I hope this helps.
>
> Cheers,
> Drew
>
>
>
>>
>>
>> Sean
>>
>>
>> Johannes Fahrenkrug wrote:
>>
>>> Hi,
>>>
>>> I have a custom page type called "TripPage". I want to be able to do
>>> create a new page with the "/trips" slug and then do this:
>>>
>>> /trips/2640024
>>>
>>> to display the trip with the id "2630024". I know I could easily do
>>> /trips?id=2630024 and access that via @request.params[:id], but I want
>>> to make the site SEO friendly and avoid get parameters.
>>>
>>> Would the best practice be to set this up through the routes in the
>>> _extension.rb file?
>>>
>>> Thanks!
>>>
>>> - Johannes Fahrenkrug
>>> ___
>>> Radiant mailing list
>>> Post:   Radiant@radiantcms.org
>>> Search: http://radiantcms.org/mailing-list/search/
>>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>>
>>>
>>>
>>
>> ___
>> Radiant mailing list
>> Post:   Radiant@radiantcms.org
>> Search: http://radiantcms.org/mailing-list/search/
>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>
> ___
> Radiant mailing list
> Post:   Radiant@radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>



-- 
http://blog.springenwerk.com
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Routes and Custom Pages Types

2009-08-25 Thread Andrew Neil
On Tue, Aug 25, 2009 at 2:13 PM, Sean Cribbs  wrote:

> Johannes,
>
> Your TripPage should override Page#find_by_url and return itself or an
> appropriate child page for URLs that match your scheme.  Way back in the day
> we did that for KCKCC's "syllabus" pages - wish I still had that example
> around.


Here is an example of overriding Page#find_by_url:

http://github.com/nelstrom/radiant-audio_player-extension/blob/11e2b3398e4831c3d047ac30276215dd3af15678/app/models/audio_page.rb#L5-17

This should match URLs of the form:

/podcasts
[index page]

/podcasts/1-first-episode
/podcasts/2-second-episode
[show pages]

I hope this helps.

Cheers,
Drew



>
>
> Sean
>
>
> Johannes Fahrenkrug wrote:
>
>> Hi,
>>
>> I have a custom page type called "TripPage". I want to be able to do
>> create a new page with the "/trips" slug and then do this:
>>
>> /trips/2640024
>>
>> to display the trip with the id "2630024". I know I could easily do
>> /trips?id=2630024 and access that via @request.params[:id], but I want
>> to make the site SEO friendly and avoid get parameters.
>>
>> Would the best practice be to set this up through the routes in the
>> _extension.rb file?
>>
>> Thanks!
>>
>> - Johannes Fahrenkrug
>> ___
>> Radiant mailing list
>> Post:   Radiant@radiantcms.org
>> Search: http://radiantcms.org/mailing-list/search/
>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>
>>
>>
>
> ___
> Radiant mailing list
> Post:   Radiant@radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Routes and Custom Pages Types

2009-08-25 Thread Sean Cribbs

Johannes,

Your TripPage should override Page#find_by_url and return itself or an 
appropriate child page for URLs that match your scheme.  Way back in the 
day we did that for KCKCC's "syllabus" pages - wish I still had that 
example around.


Sean

Johannes Fahrenkrug wrote:

Hi,

I have a custom page type called "TripPage". I want to be able to do
create a new page with the "/trips" slug and then do this:

/trips/2640024

to display the trip with the id "2630024". I know I could easily do
/trips?id=2630024 and access that via @request.params[:id], but I want
to make the site SEO friendly and avoid get parameters.

Would the best practice be to set this up through the routes in the
_extension.rb file?

Thanks!

- Johannes Fahrenkrug
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

  


___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant