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 对于知识的学以致用的解释
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败