• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
myth: links in views are displayed wrong

#1
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.
Reply

#2
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?
Reply

#3
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'?>
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#4
OK, then is Myth missing the routes?
Reply

#5
What version of CodeIgniter are you using?
Support Development  • Practical CodeIgniter 3  •
Myth:AuthVulcan - CLI Tools for CI4
Reply

#6
(03-12-2020, 01:41 PM)kilishan Wrote: What version of CodeIgniter are you using?
I'm using 4.0.2
Reply

#7
(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
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.