There is sub-directory sub in controllers directory with controller Lang:
/controllers/crm/languages/lang.php
When I try to call this controller from URL I get 404 error:
My routing is:
`$route["crm/languages"] = "crm/languages/lang/index";`
use CodeIgniter HMVC Modules: https://github.com/jenssegers/codeigniter-hmvc-modules
Related
I have set 404_override in route.php so that when there is no correspondent controller it will redirect to my error page
But my question is if there is no function inside the controller it is not redirecting properly
example: http:example.com/search/function_name
here search controller is there but the function_name not exist, how I can redirect to error page in this scenario ?
Your help will be really appreciate!
If you have set up the 404_override properly it will work as intended. You need to pass the controller method in which you are showing your custom 404 page else it would not work.
Create 'index' function in your error controller. Then you do not have to mention the function name in 404_override.
I want the following to happen
The url something.com/why-us to go to content controller
The url something.com/nepal to go to location controller
How to manage the above in CI routes
Apply the below coding in routes.php in config folder
$route['why-us'] = "content_controller";
$route['nepal'] = "location_controller";
use your desire controller
Instead of default controller how can I call directly one controller? My requirement is: I need to call one controller separately for loading my view file. When I try the standard way of calling it I get redirecting.
open the file in the config folder name route.php and replace
$route['default_controller'] = 'Welcome';
to
$route['default_controller'] = 'your controller';
for more read this
http://w3code.in/2015/10/codeigniter-installation-beginner-guide/
I am working in netbeans
I've controller named Cms with a function signup in which I load the view as
$this -> load -> view('cms/signup');
and view is on the followoing location
D:\xampp\htdocs\CMS\application\views\cms
in the routes.php I've defined the following route to access this view
$route['aaa'] = 'cms/signup';
when I type the following URL http://roz.com/cms/aaa it says CI error message "page not found" yesterday it was working. default controller is working fine without index.php with following URL 'http://roz.com/cms'
please advice where the problem lies actually. I am working on localhost
I new with hmvc and I want to ask about folder structure in codeigniter with hmvc extension.
I used to arrange application controller folder for admin and public like this:
Application
--Controllers/
----admin/
------login.php
------dashboard.php
----blog.php
----about.php
----contact.php
So that page could be access with {base_url}/admin/login, {base_url}/admin/dashboard for Admin and for Public is {base_url}/blog , {base_url}/about etc.
With hmvc extension, how to achive url like that? for now i make my filename with admin_something.php, but that is look messy for me.
Application/
--Modules/
----admin_dashboard/
------Controllers/
--------admin_dashboard.php
------Models/
------Views/
----home/
------Controllers/
--------home.php
------Models/
------Views/
Thank you
You can have multiple controllers in your module. So make a folder admin with admin controller in your module's controller folder.
mymodule
- controller
- home.php
- admin/admin_dashboard.php
- model
- model.php
- view
- home_view.php
- admin/admin_view.php
To access the modules
echo Modules::run('mymodule/home/methodname');
echo Modules::run('mymodule/admin/admin_dashboard/methodname');