Welcome Guest, Not a member yet? Register   Sign In
Please help me with multi-applications management.
#1

[eluser]BnoL[/eluser]
Hi all,

I’m currently managing multi applications with CI:

just like: application/prj1 , application/prj2 ...

and I have written some new classes (base on CI core classes) and put them in “libraries” folder of each application, ex: “application/prj1/libraries/MY_Controller.php” ...

But if I do so, I have to copy my classes to all of my prjs’ folders (prj2,prj3,...), and it’s not good for maintenancing or updating…

So I want to put them in a new place so that all prjs can use 1 “libraries”, “helpers”... folder, for example: “application/libraries”, “application/helpers”...

My question is: if I do so, what’s the best way to config the core to make it works?
or is there any better solutions ?

Thanks in advance and sry for my bad English Smile
#2

[eluser]bretticus[/eluser]
Just trying to understand how all this works together. Are you dynamically changing the application path in one index file? Why multiple applications?
#3

[eluser]BnoL[/eluser]
Are you dynamically changing the application path in one index file?
No. I'm not. Now, each proj has its own index file. So I have more than 1 index file.
Is it possible to dynamically changing the application path in one index file? And how?

Why multiple applications?
Because I have different projs on 1 site so I want them to use the same CI system.


Looking into "Loader.php" => function _ci_load_class, CI use APPPATH to include the file.
Code:
$subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.EXT;

The APPPATH which is defined in the index page is the path to the application. ex: "application/prj1".
So I think of defining a new variable to "application" folder only (w/o the proj's name).

But I wonder is there any better way to do it? Or anyone has done this before please share your solution. Thanks Big Grin
#4

[eluser]bretticus[/eluser]
Oh I see...

We just do this different. I prefer to have application folders and index files together in their own folders with the system folder in an adjacent folder further up the tree. For example:

Code:
.
|-- host1
|   |-- application
|   |   |-- config
|   |   |-- controllers
|   |   |-- errors
|   |   |-- helpers
|   |   |-- hooks
|   |   |-- language
|   |   |   `-- english
|   |   |-- libraries
|   |   |-- models
|   |   `-- views
|   `-- index.php
|-- host2
|   |-- application
|   |   |-- config
|   |   |-- controllers
|   |   |-- errors
|   |   |-- helpers
|   |   |-- hooks
|   |   |-- language
|   |   |   `-- english
|   |   |-- libraries
|   |   |-- models
|   |   `-- views
|   `-- index.php
`-- system
    |-- cache
    |-- codeigniter
    |-- database
    |   `-- drivers
    |       |-- mssql
    |       |-- mysql
    |       |-- mysqli
    |       |-- oci8
    |       |-- odbc
    |       |-- postgre
    |       `-- sqlite
    |-- fonts
    |-- helpers
    |-- language
    |   `-- english
    |-- libraries
    |-- logs
    |-- plugins
    `-- scaffolding
        |-- images
        `-- views


Then I change my system_folder variables in my index pages and set my virtual paths to the individual host folders. I know this doesn't solve your dilemma so much though Smile

Why not just make your app library folders a symlink that they can all share?




Theme © iAndrew 2016 - Forum software by © MyBB