Welcome Guest, Not a member yet? Register   Sign In
Routing with variables
#11

(This post was last modified: 11-18-2021, 03:59 AM by chakycool.)

with "(:num)" I get a 404 error.

404 - File Not Found
Controller or its method is not found: \App\Controllers\Admin::index

if I use it as ":num" the page loads but "$1" is passed as the variable but not what's in the URL
Reply
#12

(This post was last modified: 11-18-2021, 08:18 AM by captain-sensible. Edit Reason: extra )

yes @InsiteFX i pointed that out in #2 then forgot in #6 i guess i have a short term memory problem developing ?

whats the base url set to in app/Config/App.php ?

mine on local dev is ;:
Code:
public $baseURL = 'http://127.0.0.2/';

you see that forward slash on the end .

None of my routes have a "/" at beginning


A route should be setting up url on left then determining on right what class and method to use , so surely Class::method is all thats needed ?
CMS CI4     I use Arch Linux by the way 

Reply
#13

My local URL

'http://xx.localhost/'

'Admin/Reports/' is the path to the file (controller).

'Brands' is the controller

'stores' is the function.

PHP Code:
$routes->get('/admin/reports/stores/:num''Admin/Reports/Brands::stores/$1'); 
Reply
#14

Stop/.using/slash/instead/of/backslash/in/namespace
Reply
#15

Cry Cry  feel very stupid now. 'InsiteFX' gave the right code and I still didn't follow it. 
thank you 'iRedds'  Big Grin Big Grin
Reply




Theme © iAndrew 2016 - Forum software by © MyBB