CodeIgniter Forums
Problem with Route_To - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Problem with Route_To (/thread-78992.html)



Problem with Route_To - krummyjack - 04-05-2021

I have programmed the following route which works correctly, it uses a regex

Code:
$routes->addPlaceholder('slug_alfa', '[a-z0-9]+[\-]?[a-z0-9]+([\-][a-z0-9]+)*');
$routes->get('(:slug_alfa)/sitios-interes', 'Web_Empresa::sitio_interes/$1',["as"=>"web_empresa_servicios_interes"]);


But when using route_to function it fails, for example
PHP Code:
route_to("web_empresa_servicios_interes",'slug'


preg_match(): Compilation failed: missing closing parenthesis at offset 41
SYSTEMPATH/Router/RouteCollection.php at line 1351


RE: Problem with Route_To - InsiteFX - 04-06-2021

Did you try installing the develop version of CodeIgniter 4 any bugs may have been fixed.

CodeIgniter 4 develop version


RE: Problem with Route_To - krummyjack - 04-06-2021

(04-06-2021, 01:39 AM)InsiteFX Wrote: Did you try installing the develop version of CodeIgniter 4 any bugs may have been fixed.

CodeIgniter 4 develop version


I have copied the system folder from the link you provide. I have not modified the App folder because I already have enough code programmed.

It all comes from the error that occurs in route_to, but how can I update Codeigniter 4 without it giving me problems? I have 4.0.4 version

Now he tells me:
CodeIgniter \ Exceptions \ FrameworkException
The xml extension is not loaded

SYSTEMPATH/CodeIgniter.php at line 234

SYSTEMPATH/CodeIgniter.php : 234   —  CodeIgniter\Exceptions\FrameworkException::forMissingExtension ()





RE: Problem with Route_To - InsiteFX - 04-07-2021

SYSTEMPATH/CodeIgniter.php : 234   —  CodeIgniter\Exceptions\FrameworkException::forMissingExtension ()

That error means your missing the intl php extension in your php.ini file you need to edit it and
add the extension.

Also if your upgrading from 4.0.4 then there were also changes made to the app folder Config/app.php etc;
So you would need to also replace the app folder.

try this some times fixes the problem.


PHP Code:
route_to(base_url('your_url')); 



RE: Problem with Route_To - krummyjack - 04-07-2021

(04-07-2021, 01:43 AM)InsiteFX Wrote: SYSTEMPATH/CodeIgniter.php : 234   —  CodeIgniter\Exceptions\FrameworkException::forMissingExtension ()

That error means your missing the intl php extension in your php.ini file you need to edit it and
add the extension.

Also if your upgrading from 4.0.4 then there were also changes made to the app folder Config/app.php etc;
So you would need to also replace the app folder.

try this some times fixes the problem.


PHP Code:
route_to(base_url('your_url')); 


It does not solve the problem for me, but I will have to give you a bad solution.

I see badly that to update the version I have to update the app folder where I have all the code, that is not feasible. That does not help to always be updated.

Thanks for your time and for your help.