CodeIgniter index.php 404 - php

I am using CodeIgniter for both frontend and backend. My backend isn't really that complex so it didn't warrant a different installation of CI. What I have now is a sub directory in controllers cms where I have all my backend controllers including a backend Index which extends MY_Backend core. Now I'm working on getting my front end up and running and have come across a problem if I have an Index file in the main controllers directory that extends MY_Frontend core. And try to access it via localhost or localhost/index I get a 404 page. If I change the name and subsequently the class name to Homepage I can access it via localhost/homepage.
Is this possibly due to having an Index file in the cms sub-directory? Otherwise, what is the issue? Here is my directory structure:

As at the base of it all controllers extend CI_Controller, there are 3 naming restrictions in place for controllers:
CI_Controller
Index
Default
Using any of these would cause a problem in some shape or form. I'd suspect this would be why your controller works fine named as Homepage, but not as Index.
Source: https://www.codeigniter.com/user_guide/general/reserved_names.html

Related

how to create module inside module in codeigniter

I have implemented HMVC for creating modules in codeigniter . Now I want to create modules inside module but unfortunately I am getting 404 page.
My current directory structure
modules/api/v1
when I am putting controller inside api/controller folder then it's working fine but when I put a controller file under api/v1/controller folder then it showing me 404 error. I want this because after implementing this all the version of my api will be inside a single folder
Please give me your suggestion how can I do This

How to get Parameter names in ZF2 site's Index Controller?

Hi currently i am doing project in ZF2. In my project there are lot of folders in public directory. when any of visitor enter www.domain.com/folder-name it should redirect to that folder in public directory. in scenario how can i get that name of the folder name into one variable in site IndexController
Your question is not very clear to me. When you call a sub-folder within /public, then depending on your ReWrite-Rules, you'll either get 403 Forbidden or you'll get the DirectoryIndex. If you call a file, you'll see the file.
Either way, ZF2 isn't even running at that time.
What kind of variable do you want to have in your Controllers and for what purpose? Do you want to create something like a DirectoryListing?

How to configure internal url's content on Symfony

I am new to Symfony and I am trying to understand how a Symfony project works. Right now I am trying to change the content of an internal url. For example, in the layout.php file, I can put a sentence like:
Suecia
This works fine, when I press 'Suecia' "Button" it changes the content, and it adds viajesDeusto/new to the url. My question is, where can I change the content that the "viajesDeusto/new' url displays?
Thanks a lot
If you split the url in your url_for() function it breaks out to MODULE/ACTION
So go into your app (%SF_ROOT_DIR%/apps/%APP_NAME%)
inside that folder you have a modules folder
inside that you have the module name
inside that you have an actions folder and a templates folder
the actions folder is where your code to retrieve/process data resides
the templates folder is where the presentation code resides
For instance, if your app is called frontend the location of the code is:
%SF_ROOT_DIR%/apps/frontend/modules/viajesDeusto/actions
%SF_ROOT_DIR%/apps/frontend/modules/viajesDeusto/templates
This is the standard setup for syfony 1.x apps

How to Use Module Controllers in Kohana 3?

For the following application directory structure under / in Kohana 3:
application
classes
controller
controller1.php
modules
admin
classes
controller
controller2.php
And the urls be: /controller1 and /admin/controller2?
I seem to be missing something though because I keep getting a 404 error with the /admin/controller. What am I doing incorrectly?
The exact error is:
HTTP_Exception_404 [ 404 ]: The requested URL admin/borrowers was not found on this server.
And I don't have any custom routes setup. This is a very vanilla K3 install at this point.
The directory structure seems to be a little of.
Using a module doesn't automatically means you have a subdirectory. The default route defines the following url structure:
/[controller]/[action]
So for the directory structure that you have given, you get the following:
/controller2/
The action can be left out, but it will default to index.
If you want a special admin subdirectory, you would first have to create that subdirectory in you modules classes directory like this:
/admin/classes/admin/controller2.php
Then you would have to add another route that handles the subdirectory. You can find more information about that in the userguide

Are there codeigniter controller sub-directory limits?

Greetings,
I've encountered a seemingly bizarre issue, and was wondering if anyone is able to shed a light.
I created a simple controller two levels down from the traditional /application/controllers/ directory and I'm seeing a CI-generated 404 when hitting said controller.
To elaborate, my directory structure is as follows:
/ci/application/controllers/dir1/dir2/myfile.php
The file itself has a simple function with an echo statement. When I move said file up one level such that it is located in:
/ci/application/controllers/dir1/myfile.php
It works.
I've tried changing the name of the "dir2" directory in the example above, the name of the controller, the names of the functions within the controller -- to no avail. I'm able to hit the same php file without going through the Code Igniter framework, and I'm on a Windows machine working normally so I can't imagine this to be a permissions-related issue.
I'm led to think that CI simply isn't willing to go into the controllers directory more than one level. Is this possible, or am I missing something?
Try this out: http://glennpratama.wordpress.com/2009/10/20/multi-level-subfolder-for-controller-in-codeigniter/
Basically, you need to override the default codeigniter router with your own MY_Router class
"Out of the box", Codeigniter only supports a single level directory structure for Controllers.
There are ways to extend the default Router class to enable this feature.

Categories