# |
Mar 11th 2018, 05:48 |
savant |
lets not use the word retard |
# |
Mar 11th 2018, 05:47 |
joddit |
Just coudln't find it in the docs |
# |
Mar 11th 2018, 05:46 |
joddit |
I feel like a retard when such seemingly simple questions stump me |
# |
Mar 11th 2018, 05:46 |
joddit |
Indeed |
# |
Mar 11th 2018, 05:46 |
joddit |
Yeah I try to do everything without going outside the scope of Cake in general, only when I must lol |
# |
Mar 11th 2018, 05:46 |
ricksaccous |
it starts getting evil if you make more than a few of those |
# |
Mar 11th 2018, 05:46 |
ricksaccous |
and route them based on those but ugh |
# |
Mar 11th 2018, 05:45 |
ricksaccous |
you could even add regex rules to the params |
# |
Mar 11th 2018, 05:45 |
joddit |
Didn't mean that smiley lol |
# |
Mar 11th 2018, 05:45 |
joddit |
^^ trying now |
# |
Mar 11th 2018, 05:45 |
savant |
yes |
# |
Mar 11th 2018, 05:45 |
joddit |
And you think that will allow me to use the Html helper |
# |
Mar 11th 2018, 05:45 |
ricksaccous |
i remember doing that, haha |
# |
Mar 11th 2018, 05:45 |
ricksaccous |
yeah there you go, that's similar to cakephp2 |
# |
Mar 11th 2018, 05:45 |
joddit |
Roger that |
# |
Mar 11th 2018, 05:45 |
savant |
$routes->connect('/articles/:category/:slug', ['controller' => 'Articles', 'action' => 'view'], ['pass' => ['category', 'slug']]); |
# |
Mar 11th 2018, 05:45 |
joddit |
::ears perk up!!:: |
# |
Mar 11th 2018, 05:44 |
savant |
change the route to the following |
# |
Mar 11th 2018, 05:44 |
joddit |
https://gist.github.com/anonymous/8fd56b9884ccb05d7ba9cd08cf1f146e |
# |
Mar 11th 2018, 05:42 |
joddit |
It's a VERY simple project. The routes file isn't much different than stock, will put it up there now |
# |
Mar 11th 2018, 05:42 |
ricksaccous |
i have to reread the section every time i start routing again |
# |
Mar 11th 2018, 05:42 |
ricksaccous |
i forgot a lot about routing, lol |
# |
Mar 11th 2018, 05:41 |
joddit |
Just going for brevity |
# |
Mar 11th 2018, 05:41 |
ricksaccous |
i think you have to do something with passed params for the routes |
# |
Mar 11th 2018, 05:41 |
savant |
~tell joddit about gist |
# |
Mar 11th 2018, 05:41 |
savant |
can you gist your entire routes.php file? |
# |
Mar 11th 2018, 05:41 |
joddit |
I mean there's nothing directly bad about having it in there |
# |
Mar 11th 2018, 05:40 |
ricksaccous |
oh i see |
# |
Mar 11th 2018, 05:40 |
savant |
thats interesting |
# |
Mar 11th 2018, 05:40 |
joddit |
I don't want the action name in the URL |
# |
Mar 11th 2018, 05:40 |
ricksaccous |
nice |
# |
Mar 11th 2018, 05:40 |
joddit |
When I did what savant suggested, it created a link like /articles/view/(category_name)/(article_slug) |
# |
Mar 11th 2018, 05:40 |
ricksaccous |
['controller'=>'Articles', 'action' => 'view', 'category-slug', 'article-slug'] |
# |
Mar 11th 2018, 05:39 |
ricksaccous |
or you could just have the action take in two params, and pass those params in |
# |
Mar 11th 2018, 05:39 |
joddit |
Thanks ill read about that |
# |
Mar 11th 2018, 05:39 |
savant |
which will return the above sort of stuff |
# |
Mar 11th 2018, 05:39 |
joddit |
Ok and thats what I figured, but it put view in the url |
# |
Mar 11th 2018, 05:39 |
savant |
I generally add a getRoute() method to my entity |
# |
Mar 11th 2018, 05:38 |
savant |
['controller' =>'Articles', 'action' => 'view', 'category' => 'your-category', 'slug' => 'your-slug'] |
# |
Mar 11th 2018, 05:38 |
joddit |
For this particular site, categories are only one level deep, no categories withint categories |
# |
Mar 11th 2018, 05:38 |
savant |
The route array for Html::link() would be |