Monday, December 14, 2015

ROUTER for friendly URL

Redid a website for a client in Cake 2.X and the current site (made native in PHP) has a BD with friendly URLs, something like: city/typestore/name-of-shop. Obviously the HTACCESS is set to receive and treat URLs and "play" the content accordingly.

In the new application (in CakePHP) what I did was this: stores/show/123. Those who understand Cake know it's the controller/action/parameter. The 123 is the ID that step as a parameter.

In the table of the site I have some columns as friendly Url and shop ID (in the example above would be 123)

How can I link these two information, ie, accessing the friendly URL I play ROUTE in the controller, action, and parameter (ID) correctly, pulling the BD (for ID only)?

NOTE 1: It is noteworthy that the new application does NOT have direct access to the database. It's all Web service/API. I have a method layout where I send the URL and it returns ID. Send ID return URL. I also have the programmer's API willingness to create what it takes to succeed.

NOTE 2: The call to the store have to be stores/show/SHOP_ID

Can someone help me?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: