Welcome Guest, Not a member yet? Register   Sign In
Using model of another application
#1

[eluser]lalay[/eluser]
Is there a way for me to use a model of another application?
i want to use the model of my frontend app in the backend app.
#2

[eluser]Aken[/eluser]
How is your app structured? What makes the front/back end separated?
#3

[eluser]lalay[/eluser]
.
#4

[eluser]lalay[/eluser]
I'm just on a localhost. I'm using xampp. and everything is in my htdocs folder.

htdocs/frontend
htdocs/backend
#5

[eluser]weboap[/eluser]
follow @InsiteFX file structure:
http://ellislab.com/forums/viewthread/217657/

then under your controllers folder you can do

/application/controllers/controller1.php
/application/controllers/controller2.php
/application/controllers/controller3.php
....
been your frontend controllers
then

/application/controllers/backend/controller1.php
/application/controllers/backend/controller2.php
/application/controllers/backend/controller3.php
.....
your backend been a sub folder containing your backend controllers


the models in application/models/
support sub folders too the same way.
using this file structure
you can load models the same way from both frontend and backend the same way from the same place almost
eg:
from : application/models/front/ (front been a subfolder)
front : $this->load->model('font/my_front_model1.php')


from : application/models/back/ (back been a subfolder)
back : $this->load->model('back/my_back_model1.php')



from : application/models/common/ (common been a subfolder)
common : $this->load->model('common/my_common_model1.php')

this calls to load models can be from back or front ...
hope it help.
#6

[eluser]lalay[/eluser]
so i will have to put my backend files in the frontend folder, too? :|
#7

[eluser]lalay[/eluser]
is there a way where i can use the model in the frontent app without having to combine the folders?




Theme © iAndrew 2016 - Forum software by © MyBB