getNumberFromEndOfUrl() pulling number from middle of a URL?

3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 24, 2010   (RSS)

By dougdrury - May 24, 2010 - edited: May 24, 2010

CMSB 2.03
I have a URL '/projects.php?project_category=BMS%2FDDC+Controls'

I want this URL to NOT match with any numbers to show a set of records, but this url could also look like this '/projects.php?project_category=BMS%2FDDC+Controls&num-123' and I want CMSB to find the record 123.

I have tried to use getNumberFromEndOfUrl() to just look at the end of the URL to see if it has a number, and it ALWAYS pulls the number 2 from the %2 in the URL if there is no num-1234 at the end. Am I doing something wrong? I have tried getNumberFromEndOfUrl(1) as well.

I want it to see if there is an alpha at the end, return 0 and if there is a numeric at the end of the url, return that number.

Thanks,
Doug

Re: [Dave] getNumberFromEndOfUrl() pulling number from middle of a URL?

By dougdrury - May 24, 2010

Dave,
Thanks for the clarification! I will try the preg_match(). Great idea! Thank you!!

Doug