dongyunshan4066 2013-10-28 21:41
浏览 47
已采纳

从插件的配置文件访问CI的配置文件

I am trying to centralize all deployment specific changes into CI's main config file and then have "lesser" config files (like a plugin's) read it from here.

In this specific instance:

I have CKEditor/CKFinder as plugins to my Codeigniter app. I would like to read values from CI's main config file from CKFinder's config file so that I can get at the baseURL.

In order to tell CKFinder where to look for images, you need to specify a baseURL in its config.php file. I would rather it read the baseURL from my main config file and append an image directory to this instead of modifying CKFinder's file directly.

I tried the following in CKFinder's config.php file to no avail:

$baseUrl=$this->$config['base_url'].'assets/my_images/';

Please lead me to the light!

Mmiz

  • 写回答

2条回答 默认 最新

  • douao1959 2013-10-28 21:46
    关注

    if you wanna read base_url you can do something like this:

    $baseUrl = base_url().'assets/my_images/';
    

    Instead if you wanna reach a config-item, you can do this.

    $this->config->item('your_constant'); 
    

    and in the config file something like:

    $config['your_constant'] = "your string"; 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制