Welcome Guest, Not a member yet? Register   Sign In
Working with 2 applications
#1
Question 
(This post was last modified: 12-27-2015, 05:07 AM by lama.)

Hello,

I'm trying to redevelop my ecommerce with CI3 but I was already blocked with my two applications folder Undecided

I have this folders :
  • applications/frontend/
  • applications/backend/

What I set :

index.php (root)
PHP Code:
$application_folder 'applications/frontend'

applications/frontend/index.php
PHP Code:
$application_folder '../frontend';
$system_path '../system'

applications/frontend/config/config.php
PHP Code:
$config['base_url'] = 'http://localhost/eshop/frontend/'

applications/backend/index.php
PHP Code:
$application_folder '../backend';
$system_path '../system'

applications/backend/config/config.php
PHP Code:
$config['base_url'] = 'http://localhost/eshop/backend/'


Using REQUEST_URI and no index_page blank, all .htaccess are set like this :
PHP Code:
RewriteEngine On
RewriteCond 
%{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteRule 
^(.*)$ index.php/$[L

I'm well redirected on the frontend default controller when I go to localhost/eshop but when I type localhost/eshop/backend I have the 404 default error page.

Any idea ?

Thanks Smile
Reply
#2

(This post was last modified: 12-28-2015, 11:34 PM by wolfgang1983.)

I would look into HMVC https://bitbucket.org/wiredesignz/codeig...sions-hmvc

You might be best to create a second application folder called backend
  • backend
  • backend > application
  • backend > application > all folders that belong in app
  • backend > index.php
On that backend index.php just then make one change
 
Code:
$system_path = '../system';

  • backend
  • frontend
  • frontend > all folders that belong in app
  • index.php <-- for front end
  • system folder
On the main index.php you can rename application folder to frontend.

PHP Code:
$application_folder 'frontend'
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#3

I don't understand... Why this is so complicated to get two applications ?

I followed the user guide : https://ellislab.com/codeigniter/user-gu..._apps.html but there isn't instructions about htaccess...
Reply
#4

(01-06-2016, 01:40 PM)lama Wrote: I don't understand... Why this is so complicated to get two applications ?

I followed the user guide : https://ellislab.com/codeigniter/user-gu..._apps.html but there isn't instructions about htaccess...

Use HMVC
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#5

I can't rewrite all my project in HMVC there is too much controllers, views and model. I only want to migrate my 2 applications folder of CI2 to CI3...
Reply
#6

Instead of giving yourself a hard time,why not just do it simple as this?
One single app with multiple areas.
application/controllers/backend -> all backend controllers go in here.
application/views/backend -> all backend views go in here.
application/controllers -> all frontend controllers go in here.
application/views/frontend -> all frontend views gn in here.
Then in your application/core/MY_Controller.php , create two classes extending to CI_Controller: frontend(disable debug and anything you don't want users to see), backend(enable debug). Then back to your controllers: in application/controllers/{file}.php -> class {file} extends frontend{} , application/controllers/backend/{file}.php -> class {file} extends backend{}.
Now you get http://localhost/eshop and http://localhost/eshop/backend working.
Be Simple Angel
Reply




Theme © iAndrew 2016 - Forum software by © MyBB