Welcome Guest, Not a member yet? Register   Sign In
Alternative $this->config>set_item($item, $value)
#2

(This post was last modified: 12-01-2019, 06:42 PM by dave friend.)

All the config files are classes where all the properties are public. That means that once you create an instance of a config you can modify the properties however you see fit.

PHP Code:
<?php namespace App\Controllers;

use 
Config;

class 
Home extends BaseController
{
    public function index()
    {
       $viewConfig = new Config\View();
       $viewConfig->saveData false;
       // do stuff
      }


You can dynamically add properties to the class

PHP Code:
$config = new Config\App();
$config->adHoc = ["Hello ""World""!"];
foreach (
$viewConfig->adHoc as $value)
{
    echo 
$value;  // Hello World!

Reply


Messages In This Thread
RE: Alternative $this->config>set_item($item, $value) - by dave friend - 12-01-2019, 06:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB