[typo] new blog / routes.rb Q

Michael Purvis mike at uwmike.com
Mon Sep 26 20:15:54 EDT 2005


This looks like arbitrary-depth sub-categories, and I wouldn't know how 
to do that purely with routing.rb, unless you wanted a whole pile of 
really awkward rules.

What's needed is a rule where the entire path after point X gets passed 
to the action as an array, and then the action can go about crunching it.

Of course, if you want something extraordinarly goofy, you could put a 
mod_rewrite rule directly in your .htaccess which just converts all 
slashes to underscores, so that your mega-path:
http://leisurelearning.com.au/f/Buki+Toys/Developmental+Products/Near+And+Far/688

Looks to Rails like:
http://leisurelearning.com.au/f/Buki+Toys_Developmental+Products_Near+And+Far/688

However, I'm sure someone here would have a better solution. (And of 
course, remember that Typo is a blog engine, not a CMS. I don't know of 
any particularly interesting rails-CMS projects at the moment, outside 
of Amy Hoy's one... but that hasn't seen a release yet, just a screenshot)

Mike


Ian Holsman wrote:

>on this note, is it possible for typo/rails to ignore part of the path?
>
>for example
>http://leisurelearning.com.au/f/Buki+Toys/Developmental+Products/Near+And+Far/product_id=688
>
>I'd like rails/typo to be able to ignore the parts between 'f/' and 
>'/product_id'.
>
>from what the example you give below it seems like I can.
>
>regards
>Ian.
>
>
>Mike Purvis wrote:
>  
>
>>Looks nice. A similar look to what I was trying to acheive 
>>(http://uwmike.com), but I think you did a much better job.
>>
>>
>>By the way, if you don't like the /pages/x URLs, it's a reasonably easy 
>>hack on /typo/config/routes.rb to make them... something else. Around 
>>like 80, you'll see:
>>
>>map.connect 'pages/*name',:controller => 'articles', :action => 'view_page'
>>
>>Now, it's an easy thing to make "pages" something else, but you can also 
>>just add a rule like
>>
>>map.connect 'bio',:controller => 'articles', :action => 'view_page', 
>>:name='bio'
>>
>>That way "/pages/bio" and "/bio" will both be the same resource... 
>>Anyhow, not a big deal, but it's kind of cool. (The 
>>http://uwmike.com/about page on my site is like this...)
>>
>>Cheers.
>>
>>Mike
>>
>>    
>>


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.7/112 - Release Date: 26/09/2005



More information about the Typo-list mailing list