Codeigniter - dots in a controller folder name - codeigniter

I'm using the latest version of Codeigniter and I try to achieve specific controller folders structure.
I'm would like to create a controller folder for each of my webapp version:
/controllers/1.0.0/login (where login is the name of the controller)
/controllers/2.0.0/login (where login is the name of the controller)
the problem: it seems Codeigniter working great with controller folders but not working with controller folders that contain dot :(
Like this working good (without dots):
/controllers/100/login (where login is the name of the controller)
/controllers/200/login (where login is the name of the controller)
Is there a way to make Codeigniter work with dots on controller folders?
Thanks
Shai

I also getting the same issue.
You can use like this in your route
config/route.php
$route['Controller/1.0.0/login'] = 'Controller/100/login';
$route['Controller/2.0.0/login'] = 'Controller/200/login';
This is working fine for me

Related

controllers inside subfolder gives blank page

im having a small web app developed using Codeigniter and in my controller folder i have a separate folder which has the controllers related to the admin.
for an example when i try to access my site http://example.com/panel/index.php?/admin/dashboard/home i get a blank page. It happens with all the controllers inside the subfolder.
It works on my localhost but when i upload it to my hosting on Godaddy all i get is a blank page. No errors nothing.
Below is my folder structure
controller
----- admin
----------Login.php
----------Dashboard.php
----------Settings.php
------ user
----------Login.php
----------Dashboard.php
----------Settings.php
Can someone tell me what might be causing this?
The issue it with controller name
http://example.com/panel/index.php?/admin/Dashboard/home
Changed filenaming convention (class file names now must be Ucfirst and
everything else in lowercase).
So you controllers and files name should be
My_controller (only M upper case rest lower case)

Encrypt URL with PHP Codeigniter

I have developed a website with PHP Codeigniter. It consists of many controllers and views. I want to encrypt the URL of the site to hide the controller and function name. Currently, the URL looks like this :
www.sitename.com/controller_name/function_name
I don't want the users to see the controller and function names. Is it possible to do this now because the site is almost complete. Is there any shortcut of doing this? Please Help
You can use codeigniter URI Routing to remove your controller name from URL.
$route['url_name'] = 'controller_name/function_name';
This `www.sitename.com/url_name` will look go to `www.sitename.com/controller_name/function_name`
$route['url_name/(:any)'] = 'controller_name/$1';
This will only change your controller name.. `controller_name` to `url_name`

Codeigniter working directory inside another working directory

Hi I am working on codeigniter for a while now and have met with an issue.
I use "localhost/controller/function" which is how codeigniter works.
Where controller classes are in controller folder in application.
I have a new codeigniter setup in root folder names "big" with its own controller, view, models etc. How can I run files in "big" like I do for my the original application.
I tried "localhost/big/controller/function", which obviously didn't work.
Please help, I am completely new with codeigniter.
just go to index.php of your application (big)
change/add line:
$application_folder = "applications/big";

web API versioning using namespace

I am trying to implement ASP.net web API versioning using URL(namespace) techniques.
I have existing controller say Roles controller. I am able to access it via route .../ API/roles.
Now I have added one more controller with same name Roles but in different folder say V1.
I added route for this new controller and I am able to access it via .../API/V1/roles.
But now when I am trying to access my old route I.e. .../API/roles. I am getting error as multiple controller found. One controller in folder V1 and another in folder controllers.
Can anyone help me in figuring out this issue. How to fallback the existing routes.
If I add another folder v2 and try to access roles controller over there its working fine.
But for existing controller which is placed directly in Controllers folder its not working.
Any help is appreciated.
Thanks.

CodeIgniter controller in subfolder

I have a controller in a subfolder. CodeIgniter is giving a 404 page not found.
The controller works fine in the root controller folder. The controller also works fine in the 1st level subfolder. The controller breaks in the 2nd level subfolder.
Why would CodeIgniter not want you to user multiple subfolders?
Example:
Works: controllers/pages/HomeController.php
Broken: controllers/pages/users/HomeController.php
My Routes are like this:
Works: $route['default_controller'] = "pages/HomeController";
Broken: $route['default_controller'] = "pages/users/HomeController";
I wrote about this before, you just need to read the CI manual, but here is a quick blog entry I did which should get you back on track:
http://blog.biernacki.ca/2011/12/codeigniter-uri-routing-issue-with-controller-folders/
Example:
$route['account/manage/(:num)/(:any)'] = "account/manage/index/$1/$2";
CodeIgniter does not inherently allow for multiple controller folders. It may or may not work, but it is an undocumented quirk. Using the routes.php file you can virtualize any folder or controller structure you want, just take care to map your routes back to a controller and method in the Controllers folder.

Resources