I have 2 controller controllers placed in my administration module which are:
modules/administration/controllers/Administration.php
modules/administration/controllers/Customers.php
The problem i have is when i want to display customer details in the admin view via:
echo modules::run('administration/customers/view_all');
I get nothing of course it looks as if codeigniter is looking for a (customers) method inside the administration controller. Has anyone else encountered this issue and knows how to resolve it?
Related
I have admin module (modules/admin) with controller admin (modules/admin/admin).
I need put new controllers of admin to Codeigniter controllers folder (application/controllers/admin/new_controller), but when i go to site.com/admin/new_controller – 404. Why I need it? I want to admin module was every customer the same, but the other controllers must be unique for each project, thats why I need to put new controllers to application/controllers/admin/ folder.
Is it possible to do this?
Codeigniter 3 and Wiredezignz HMVC (https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc)
Ok, I don't know if it's the right decision, but I change name of folder: application/controllers/admin to admin_unique
and add to application/configs/routes.php two lines, example:
$route['admin/(login|logout|index|settings|users)'] = 'admin/admin/$1';
$route['admin/(.*)'] = 'admin_unique/$1';
I'm creating a multi module app. It's a big app that I am porting to Phalcon. It has many different sections, so I am creating a module for each of the main ones.
I do not seem to be able to query a model in one module from a controller in another module. In this example I want to list some members on the home page. The home page is in the main module and the users model is in the users module. I'm using namespaces so in the index controller I have for example,
$this->data['members'] = \App\Users\Models\Members::find();
That produces the following error;
Fatal error: Class 'App\Users\Models\Members' not found in C:\wamp\www\xyz\app\main\controllers\indexController.php on line 12
I've checked and double checked the namespacing is correct. So how can I interact between modules?
So what you need to do is register the namespace of the other module in the Module.php class (or the bootstrap for global availability) for the module you want to query from! Woo hoo - end of head scratching.
I have used the crud generator of yii successfully for a model named Accounts.
It created the files and everything seems right, but when I navigate to page url it says :
Not Found (#404)
Unable to resolve the request "account".
here is the structure:
backend
models
Accounts
controllers
accountController
Views
account
index
_form
_search
create
update
view
the url /floshal2/backend/web/index.php?r=account
Yii is using camel-case naming mostly. accountController should be "AccountController".
However, it should have been generated that way. I'll open a issue on the tracker...
I am new to codeigniter so please excuse my stupidity.
I am building a client portal and I have my admin / client login setup I am currently working on the admin area first so I have my controller for admin setup and it loads a view stored;
views (folder) -> admin (folder) -> admin-view.php
I wanted to keep all my admin panel views in the folder admin within the views folder.
Anyway so I have setup my links to pages in the admin panel like;
Client Companies<br/>
Client List<br/>
Rigs / Platforms<br/>
Now I understand that when you call a url like I have /admin/ is the controller and /company/ is the function which is called.
Now I would like to call a controller for company for this page because I have a lot of code in the company controller which defines what views and what data to pull for the company page of the admin panel.
Right now my function in admin for company looks like;
function company(){
log_message('debug', 'company_view Function Ran');
$data['page_title'] = 'Bomar Client Portal - Admin Area';
$this->load->view('admin/header', $data);
$this->load->view('admin/admin_navigation');
$this->load->view('admin/company_view', $data);
$this->load->view('admin/footer');
}
which I would like to replace just to call the company controller, I have looked into similar questions for calling controllers from controllers and everyone recommends against it.
So if I shouldn't call the controller for company from the admin controller how would I keep the url to point to /admin/company/
I know I could easily point to /company/ and it would render the page using the controller for company but I would like to keep the admin bit in the url if you understand where im coming from? is this a case of "you can't do it stop being so picky!"?
read up on codeigniter URI routing here:
http://ellislab.com/codeigniter/user-guide/general/routing.html
allows you to set up redirects to other controllers
I have been developing with CakePHP and the Alaxos ACL plugin has helped in tremendously.
However, I am facing one issue I am not sure how to fix it?
I added a plugin named 'pages', but I cannot get ACL to see it so it is added to the list of allowed/denied actions.
If I access the plugin thru domain.com/pages/pages I get the following error
DbAcl::check() - Failed ARO/ACO node lookup in permissions check.
When I check thru the ACL plugin display, there is no reference to the pages controller and if I run the ACL build function, it simply says that there is nothing to add.
Is it because this controller is named pages and there is already a pages controller within Cake?
If it is how do I fix it? Is my only option, at this time, adding this manually to the Db? Should I go thru this plugin and rename pages to something else? or is there anything else I should be doing?
Thanks,
I see two things here. First like you suspect, having two classes in your application that share the same name is a bad idea. It will likely give you some problems in one way or another, with the wrong class being instantiated or whatever. As far as Cake does not use namespaces, this is not recommended.
Then, even if you change this name, there will be another problem if the controller you want to manage with ACL is the 'default' controller (a controller that has the same name as the plugin). There was an issue with the ACO nodes retrieval when the path contains twice the same name, which is the case for plugins default controllers.
controllers/Pages/Pages/index
So I decided to just skip the plugins default controllers from the controllers supported by the ACL plugin.
If you are the author of this plugin, you could rename it (because PagesController exists already), and move the actions in some other controller than the default controller.