开发者

CodeIgniter, newbie questions

I wan开发者_运维问答t to program in the CodeIgniter few domain 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?

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


/var/www-virtual
    | -- /system  
    |    |-- /cache
    |    |-- ...
    |
    | -- /apps
    |     | -- /one.com
    |     |    | -- /config
    |     |    | -- /controllers
    |     |    | -- ...
    |     | -- /two.com
    |     |    | -- /config
    |     |    | -- /controllers
    |     |    | -- ...
    |
    | -- /public    
    |    | -- /one.com
    |    |    | -- /index.php
    |    |    | -- /css
    |    |    | -- ...
    |    | -- /two.com
    |    |    | -- /index.php
    |    |    | -- /css
    |    |    | -- ...

This is how I rig it. Each virtual host points at /var/www-virtual/public/??.com and in each /var/www-virtual/public/??.com/index.php I have...

$system_folder = "../../system";
$application_folder = "../../apps/??.com";

Hope that makes sense.


If there is just few things in common why you don't install one instance of Codeigniter for each domain?

But if you want to have just one Codeigniter instance, so I recomend that you create one main controller per domain (controller_domain1,...,controller_domainX), and separate the views in subfolders like (domain1,domain2,domain3).

Regards,
Pedro


I would also recommend using a different installation of Codeigniter for each domain. However, if you do want to use just one installtion for different applications then the user guide explains how here:
Managing your applications: CodeIgniter User Guide


This is what you need to do:

  1. Move the "system" folder up one directory.

    old folder structure: www\codeignitor\application\system to: www\codeignitor\system

  2. Change the $system_folder in the index.php = "system"; variable in index.php to point one level up.

Doing this allows you to share the system folder and you can have many application folders.

In config.php

    $system_folder = "system";
    To:
    $system_folder = "../system";

For extra security you may rename the system folder to something else people can't guess or move the system folder two levels up to your home directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜