Welcome Guest, Not a member yet? Register   Sign In
Nested routes not working
#1

I have defined these routes:

PHP Code:
$routes->group('partner-gestione', function ($routes) {

 
$routes->get('/''Home::management_partner');
 
$routes->get('fiscalita''Home::taxation');
 
$routes->get('entrate-patrimoniali''Home::property_income');
 
$routes->get('valorizzazione-patrimonio''Home::heritage');
 
$routes->get('ottimizzazione-viabilita-urbana''Home::urban');
 
$routes->get('gestione-territorio''Home::territory');
 
$routes->get('catasto-ufficio-tecnico''Home::land_registry');
}); 

when I access to example.com/partner-gestione all works well, but when I try to enter in a nested route like: example.com/partner-gestione/fiscalita I get:

Uncaught SyntaxError: Unexpected token '<'

[Image: ur9VuZ6.png]

if I remove these routes from the group "partner-gestione", everything works fine:

PHP Code:
$routes->get('fiscalita''Home::taxation');
$routes->get('entrate-patrimoniali''Home::property_income');
$routes->get('valorizzazione-patrimonio''Home::heritage');
$routes->get('ottimizzazione-viabilita-urbana''Home::urban');
$routes->get('gestione-territorio''Home::territory');
$routes->get('catasto-ufficio-tecnico''Home::land_registry'); 

how's that possible? Using php spark routes I get:

[Image: A0inray.png]
Reply
#2

The problem here is not in routing, but in the wrong paths for loading scripts.
Reply
#3

(04-15-2021, 06:15 PM)iRedds Wrote: The problem here is not in routing, but in the wrong paths for loading scripts.

All the scripts are loading via CDN. The weird thing is that problem appear only on nested routes on the example above..
You can find the full code here https://github.com/agungsugiarto/boilerp.../src/Views
Reply
#4

All your assets look like they have relative paths, so they're loading via the wrong URL and getting 404. Wrap your CSS and JS files in site_url(); or set a <base href="https://yourdomain.com/> tag in your template.
Reply
#5

(04-16-2021, 12:03 AM)ojmichael Wrote: All your assets look like they have relative paths, so they're loading via the wrong URL and getting 404. Wrap your CSS and JS files in site_url(); or set a <base href="https://yourdomain.com/> tag in your template.

yeah, thanks to everyone I fixed using:

PHP Code:
<link rel="stylesheet" type="text/css" href="<?= site_url('assets/template/vendor/tiny-slider/tiny-slider.css') ?>"
Reply




Theme © iAndrew 2016 - Forum software by © MyBB