madphp
madphp

Reputation: 1764

grab variable from url for routing

I want to grab a variable from an url for redirects in my cakephp app ie

example.com/value -> example.com/controller/this:value

obviously, the rest of the routing should remain intact. Is this possible with routing in cakephp?

Im using cakephp 1.3

I want to check the URL first against a field in a database table, if it doesnt exist, then pass it through routing. I'm assuming this will be in the beforeFilter of the app controller.

Upvotes: 0

Views: 66

Answers (1)

Dave
Dave

Reputation: 29121

AFAIK, you cannot access the database prior to the routes.php.

Just as you assumed, the alternative would be to build your logic into the beforeFilter of the AppController, which should be fine.

Probably something you'll want to cache though, since it will hit on EVERY page load.

Upvotes: 1

Related Questions