CI_Config::slash_item PHP Method

slash_item() public method

Fetch a config file item with slash appended (if not empty)
public slash_item ( string $item ) : string | null
$item string Config item name
return string | null The configuration item or NULL if the item doesn't exist
    public function slash_item($item)
    {
        if (!isset($this->config[$item])) {
            return NULL;
        } elseif (trim($this->config[$item]) === '') {
            return '';
        }
        return rtrim($this->config[$item], '/') . '/';
    }

Usage Example

 /**
  * Fetch a config item and add a slash after it
  *
  * This is installer aware and will always return the correct path in the
  * ExpressionEngine install
  *
  * @param  string $item the config item
  * @return string       the config value
  */
 public function slash_item($item)
 {
     $pref = parent::slash_item($item);
     if (defined('EE_APPPATH')) {
         $pref = str_replace(APPPATH, EE_APPPATH, $pref);
     }
     return $pref;
 }