I'm trying to change the URL to another using the routing class in Kohana.
Here's my link:
<a class="btn" target="_self" href="<?php echo URL::base(). $current_channel->name;?>/materials/28" title="Materials Download">
<div class="txt">MATERIALS</div>
</a>
Which gives me the link: localhost:8081/channel/materials/28
, since I'm running at a local server using php -S localhost:8081
Here are the specifications of my routes:
Route::set('c_materials', '<channel_name>/materials(/<id>)', array('channel_name' => $channel_names))
->defaults(array(
'controller' => 'materials',
'action' => 'brands',
));
Route::set('materials', 'materials(/<id>)')
->defaults(array(
'controller' => 'materials',
'action' => 'brands',
));
But for some odd reason that I can't figure out, Kohana can't find the link in the routes.php
file and throws this error:
ErrorException [ Warning ]: preg_match(): Compilation failed: unmatched parentheses at offset 50
Looking at the error log, here are the arguments that are passed to preg_match
in Routes.php
:
It's my first time using Kohana so I have no clue as to why it is using this weird pattern to match my URL. This is happening in other pages too, same pattern for different URLs, which keeps breaking my system.
I've tried changing the route name, forcing the route to only accept the URL at materials/28
but nothing works because of this pattern that it uses to compare against my URL. How can I change it?
EDIT: sorry for wasting your time, the Route to the update product page was wrong. I commented that part of the code and it worked flawlessly.