Codeigniter HMVC Need subfolders like superadmin admin employee - codeigniter

Codeigniter HMVC I need Folder like this, can anyone please help me?
Superadmin admin and employee have dashboard modules like as follows as More models with same user roles like SuperAdmin, Admin, and Employee.
Modules
Parent Folder - Dashboard
Superadmin
controllers models views
Admin
controllers models views
Employee
controllers models views`

Related

How to create a subfolder inside controller and view folders in codeigniter?

I wanted to create a folder named 'schoollevel' inside controller and view folder to create a separate module containing login function and profile views to provide another login functionality for some users. The 'schoollevel' contains all the files for login and profile view. Can anyone suggest how to do this ? I want the control to go to the separate folder.
Its Easy to create folder in controller and view in codeigniter.
Folder name : school
1.create a login controller
application->controller->school->Login.php
create a login view
application->view->school->login.php
Now, How to call view file
Inside login controller in the index() function add
this to call login.php view
$this->load->view('school/login');
I hope this help you!

How to call two controllers in one controller folder when using hmvc CodeIgniter?

I have the following folder structure
Modules
--controllers
--User
--Product
How can I call the product controller from user controller from one particular function?
When I run this url http://[::1]/stagingweb/index.php/user/product I get the error 'The page you requested was not found'.
it looks like you have a problem to understand the concept of hmvc here
HMVC stands for Hierarchical model–view–controller, which means in Wiredesignz HMVC there is an additional variation called modules added to the classical MVC pattern used by Codeigniter.
in your case if you have users and products, its probably the best to create 2 modules (users and products).
So your folder structure would look like
modules
- users
- controllers
User.php
- models
- views
- products
- controllers
Product.php
- models
- views
in Wiredesignz HMVC Integration there is a class MX_Controller, so every module controller has to extend from it.
an example
class Product extends MX_Controller{}
And if you want to call another modules controller within your specific controller you simply have to call
$return = modules::run('products/product/your_function');
Though in most cases it's probably a cleaner solution to just call the models from the other modules instead of executing a controllers function...
The entire process is very well documented here

codeigniter structure for models views and controllers

I'm new to codeigniter and I'm creating a blog coded with it for learning, but i have some doubts about the structure.
Right now i have an admin section for login which is working and posts which work too, but i think it can be done better.
The project is in github
Now it is like this:
+Controllers
+admin
- users.php (login, logout)
+posts
- posts.php (index, new_post, delete_post, edit_post)
+Models
+admin
- user.php
+posts
- post.php
+Views
+admin
- login.php
+posts
- post.php
- post_index.php
- edit_post.php
- new_post.php
+components
- header.php
- footer.php
- mainsidebar.php
Is this structure ok or is there a better way of organizing/renaming it?
For the admin area i want to admin posts, should i move the posts views, controller and model to admin folder? or should i have posts in both admin and posts folders?
I'm a little bit lost about where to put the controllers/models/views.
Should i have to edit the routes?
Here my suggestion structure
application
controllers
admin
users.php
posts.php
models
admin
user.php
post.php
views
admin
user.php
post.php

CodeIginiter routes Issues

I want to put all my admin views in admin and want to put all my role specific views in other folders. But When I want to access all these views what should I do for that. please provide me help. I have all my views outside views folder.
$this->load->view('admin/view-name');
$this->load->view('other-folder-name/view-name');
is this what you're looking ??

codeigniter: admin/cms as separate project or part of the same

So I've built a front-end to a website in Codeigniter, it has public and members areas.
Now it's time to build the backend administration where staff can manage some content: http://mysite.com/admin
At first I was going to just create subfolders within my controllers, models,views and resources folders for 'admin'
I'm wondering if I should just be doing a separate installation of CI for the admin? the layouts are different, the auth is different, sure they will share the same MySQL database but the admin will have different models and controllers
Best approach?
This article by Phil will give you a better idea:
http://philsturgeon.co.uk/blog/2009/07/Create-an-Admin-panel-with-CodeIgniter

Resources