averyvery / Freebie

EE 2.0 extension for ignoring specific segments when routing
57 stars 8 forks source link

Request: If segment is number #4

Closed stinhambo closed 14 years ago

stinhambo commented 14 years ago

I can ignore numbers in the URL but how can I check to see if the URL contains numbers in the template?

With Freebie, Structure isn't respecting the Channel listing template (the detail page) so I have to create a list of conditionals in the main template.

averyvery commented 14 years ago

The more people use Freebie the more reports I hear about various plugins and modules not working with this feature....numbers are just too prevalent as URI segments for it to work well.

Do you have a suggested idea for how this could work, or would it make more sense for me to just remove the "ignore numbers" checkbox?

stinhambo commented 14 years ago

Well I guess a parameter to test against numbers would be useful. At the moment I am using conditionals to test against everything else which can get cumbersome.

averyvery commented 14 years ago

So something like {exp:freebie:is_number segment="3"}, that returns true or false, would work?

stinhambo commented 14 years ago

I think so :) Would this work in a conditional too?

averyvery commented 14 years ago

Yep, you'd write {if "{exp:freebie:is_number segment="3"}" == "true" && segment_3 != "sandwiches"}

averyvery commented 14 years ago

This is in! Take a look.

stinhambo commented 14 years ago

Works perfectly! Where can I contribute to your retirement fund?

averyvery commented 14 years ago

Closing!