• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating common controllers

#1
[eluser]patilshailesh[/eluser]
Dear All

I need to create a common controllers (kind of repositories) which access their models and use in different application.
For eg: I have 1 main set of controllers and models.

controller1.php: I have method which returns user_id


In my app 1: I will use same controller1.php but, with different behavior. it will return user_id, Contact full name
In my app 2: I will use same controller1.php but, in this case, it will return user_id, contact_id, contact name and date of birth as well.

So, base class and database interaction may remain same, but i need to extend the controllers and models.

How can i achieve this?
thank you in advance

#2
[eluser]patilshailesh[/eluser]
any help please.
or if i am in wrong direction, plz correct me.
thanks

#3
[eluser]a_h_abid[/eluser]
Maybe this will help you...
CodeIgniter-Base-Classes-Keeping-it-DRY

#4
[eluser]patilshailesh[/eluser]
Dear
thanks for your reply. Very much near to what i am trying to acheive.
My goal is to have common controller.

My folder structure will be:
Project
MainCI
application
controllers
user.php
models
userm.php

App1
application
controllers
user.php
models
userm.php

App2
application
controllers
user.php
models
userm.php

I want App1 user controller should be inherited from MainCI user controller.
Functionality will be almost same. In case i need more, i can add in App1 or App2 controller function.
Is it possible? how it can be done?

#5
[eluser]a_h_abid[/eluser]
Well not possible with current way.

However there is an extension to share common controllers and stuffs throughout applications. XHMVC cross modular extension
https://bitbucket.org/xperez/codeigniter...ions-xhmvc

I've never tried it so can't say if it works or not.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.