CodeIgniter Forums

Full Version: myth: links in views are displayed wrong
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to get familiar with myth/auth. I have installed it and when I visit the login page, the links in that view are missing my project's name in the url: Register goes to 'localhost/register' instead of 'localhost/my-project/register'.

I guess the problem is my setup.
In app.php I have set 
Code:
public $baseURL = 'http://localhost/my-project/';
public $indexPage = '';
I've also moved index and .htaccess to the root. In index.php I 've set:
Code:
$pathsPath = FCPATH . 'app/Config/Paths.php';
In the view the link holds a route_to() method. About there I am lost.
Update: I run the project above on my Apache server. If I instead run it on PHP's built in server from the root of my project (c:xampp/localhost/htdocs/my-project) I get rid of the subfolder problem and route_to() is working without being rapped in base_url().

Still, shouldn't route_to() use baseURL from config?
The route_to uses a named route.

See my route for dashboard below, ['as' => 'dashboard']

PHP Code:
$routes->get('dashboard''Admin::dashboard', ['as' => 'dashboard']); 

So my route_to would be in html like below.

PHP Code:
<?= route_to('dashboard'?>
OK, then is Myth missing the routes?
What version of CodeIgniter are you using?
(03-12-2020, 01:41 PM)kilishan Wrote: [ -> ]What version of CodeIgniter are you using?
I'm using 4.0.2
(03-12-2020, 05:07 AM)InsiteFX Wrote: [ -> ]The route_to uses a named route.

See my route for dashboard below, ['as' => 'dashboard']

PHP Code:
$routes->get('dashboard''Admin::dashboard', ['as' => 'dashboard']); 

So my route_to would be in html like below.

PHP Code:
<?= route_to('dashboard'?>
Yes, Lonnie has routes like:

Code:
$routes->get('register', 'AuthController::register', ['as' => 'register']);
The problem is that  when you have the project installed in subfolder (like localhost/my_project) the part "my-project" isn't included in the URI. Even if I have "http://localhost/my-project" it in my baseURL in config/app.php