Welcome Guest, Not a member yet? Register   Sign In
Newbie question - folder structure
#1

[eluser]fatnjazzy[/eluser]
Hi and thanks for your time!

I want to program in CodeIgniter few domains and 2 admins under a linux machine.

one.com
two.com
three.com ....com

and in addition to i need two backend systems.

reports
cms

only few things are similar between the domains and can be shared.
what is the best folder structures for that? (I'd like to have mvc foreach domain).

after you suggest your structure, how do i do it in the router and in the index.php.
i read some articles but none of them explain it so it can be doable for a newbie.


thanks
#2

[eluser]Phil Sturgeon[/eluser]
Put CodeIgniter in a shared folder.

Quote:Eg: /usr/local/codeigniter (that is your system folder)

Point all index.php $system_folder's to "/usr/local/codeigniter".

Then your $application_folder can just be "." and place /home/one/public_html/controllers, /home/one/public_html/models, etc.

The shared libraries and models can be put into /usr/local/codeigniter and will be accessible to all sites.
#3

[eluser]fatnjazzy[/eluser]
Hi,
This is what i did:
lets say that now im under windows.
the folders are now
c:\wamp\www
a.com
b.com
codeigniter

inside a.com i have a the MVC folers + index.php

$system_folder = "C:/wamp/www/codeigniter/system";
$application_folder = "C:/wamp/www/codeigniter/system/application";

then, the a.com looks at the MVC inside C:/wamp/www/codeigniter/system/application and not in c:\wamp\www\a.com\

if I put $application_folder = "."; as you suggested, i need to copy the entire CI folder because the constants.php cannot be found,

i need a separated MVC structure foreach domain.

Thanks!!!
#4

[eluser]Phil Sturgeon[/eluser]
Ahh ok "." will not be helpful as it will look for the current folder within system. >.<

Instead give application folder a full path to your a.com public_html root and it should work fine.
#5

[eluser]fatnjazzy[/eluser]
i already did that but the problem is that i cant put my MVC folders inside the a.com domain.
this is how i want it to look like

ci
All of CI subfolders (excluding MVC)
a.com
M
V
C
b.com
M
V
C
thnaks
#6

[eluser]Phil Sturgeon[/eluser]
Of course you can!

Each site is an application. Each application has its own index.php.

All index.php system_folders contain a full path to a shared codeigniter install.

All index.php application_folders contain a full path to the web root of the specific site (this could even be made easier with $application_folder = $_SERVER['DOCUMENT_ROOT']; then you just put your controller and model folders in the publc_html root of each site.

I can't really explain this any easier without pictures.
#7

[eluser]fatnjazzy[/eluser]
I think im loosing you.
Please look at the small (5KB) folder attached.
the problem is that instead of getting a.com welcome, im getting CI welcome.
this is how i am accessing to the folder http://localhost/a.com
Please advise, or change the code so i learn from you,

Thanks again!
#8

[eluser]rogierb[/eluser]
you havnt set the application path in a.com
Code:
$application_folder = "C:/wamp/www/codeigniter/system/application";

It should be
Code:
$application_folder = "C:/wamp/www/a.com";

And you don't need a index.php in the codeigniter folder since you have one in a.com
#9

[eluser]fatnjazzy[/eluser]
thanks but i tried that already and this is what i get:

Warning: require(C:/wamp/www/a.com/config/constants.php) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\codeigniter\system\codeigniter\CodeIgniter.php on line 52

Fatal error: require() [function.require]: Failed opening required 'C:/wamp/www/a.com/config/constants.php' (include_path='.;C:\php5\pear') in C:\wamp\www\codeigniter\system\codeigniter\CodeIgniter.php on line 52

this way, it means that i need to duplicate the applocation folder per domain
not good probably
#10

[eluser]rogierb[/eluser]
Your application folder is a.com. There is no easy way around it.

If you want to move config and other thing from a.com you have to hack CI or use symlinks.




Theme © iAndrew 2016 - Forum software by © MyBB