CodeIgniter Forums
Multiple Application - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Multiple Application (/thread-51207.html)



Multiple Application - El Forum - 04-24-2012

[eluser]LittleNinjaCoder[/eluser]
Hello! This is my first post.
I've just download version 2.1.0.
I have the application folder outsite the System. And I need to make a website application and a backoffice application.
I've try to search in this forum, buy all options I found was for other versions.

Thanks!


Multiple Application - El Forum - 04-24-2012

[eluser]Aken[/eluser]
http://ellislab.com/codeigniter/user-guide/general/managing_apps.html


Multiple Application - El Forum - 04-24-2012

[eluser]CroNiX[/eluser]
Generally, I just put the "backoffice" controllers in it's own subdirectory of the controller directory. Having 2 separate apps seems overkill for this kind of thing, especially when a lot of the code is probably shared.


Multiple Application - El Forum - 04-24-2012

[eluser]LittleNinjaCoder[/eluser]
[quote author="Aken" date="1335302341"]http://ellislab.com/codeigniter/user-guide/general/managing_apps.html[/quote]
Thanks Aken. Let me tell you what I did.

1º Rename application for applications
2º Create 2 folders inside:
/applications/backend
/applications/frontend
3º Copy those 6 folders from
/applications/
to
/applications/frontend
and
/applications/backend
(folders: config, controllers, errors, libraries, models and views)
4º Delete from
/applications/
folders: config, controllers, errors, libraries, models and views

5º Edit /index.php
... But here is the problem... I have 2 applications.. what PATH should I put in $application_folder variable?
Because /index.php is for the whole installation, right?




Multiple Application - El Forum - 04-24-2012

[eluser]Aken[/eluser]
Read the very bottom note on that user guide page.


Multiple Application - El Forum - 04-25-2012

[eluser]LittleNinjaCoder[/eluser]
Ok. I did this.

1. Create backoffice folder, create backoffice into backoffice

2. Rename application to frontend

3. Copy all frontend content into backoffice/backoffice

4. Copy index.php into backoffice

5. Change the path in both index.php

now http://site calls /frontend

and http://site/backoffice calls /backoffice/backoffice

I couldn't use backoffice because if I change index.php file name I need to change .htaccess and I dont know how to do it.

Now is like:

RewriteEngine On
RewriteBase /dev/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

So this was the only solution.

Thanks!



Multiple Application - El Forum - 04-25-2012

[eluser]CroNiX[/eluser]
Just creating a backoffice directory in the /application/controllers directory makes this stuff so much easier than all of that. Is there a reason why you actually need 2 separate applications? If they were unrelated it would make sense to me, but it seems your backend deals directly with the frontend (as most do), so they are directly related and not really separate applications.

I'd also read Phils article on creating separate front and back end base controllers.


Multiple Application - El Forum - 04-25-2012

[eluser]LittleNinjaCoder[/eluser]
You're right CroNiX. I'll read the post and I'll try it.
Thanks. Thanks to both!