Welcome Guest, Not a member yet? Register   Sign In
Separating controllers so they can work on their own
#7

(04-22-2019, 10:54 AM)Wouter60 Wrote: Don't  include index.php in the links. CI will take care of that.
Add the site_url() config value to the URL's.
If you use the anchor() function (in the url helper), CI will take care of that too!

To get it working, check this value in config.php:
PHP Code:
$config['index_page'] = 'index.php'

Make sure you have this in autoload.php:
PHP Code:
$autoload['helper'] = 'url'

Then, in your view, generate links like this:
PHP Code:
<?= anchor('register/pass','Register a new membership');?>
This is the same as:
PHP Code:
<?php echo '<a href="' site_url() . 'register/pass' '">Register a new membership</a>';?>


That's all. You don't need a first capital letter in links, although the controller itself is named "Register.php". CI will take care of that.
If you need a redirect in your controller to another controller or method:
PHP Code:
redirect('welcome/hello'); 

Good luck!

BINGO!!
WOOHOOO!!
This is what I was looking for, THANKS A BUNCHES Heart Heart Heart
Reply


Messages In This Thread
RE: Separating controllers so they can work on their own - by Mekaboo - 04-22-2019, 09:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB