title: Object of class error in Codeigniter with loading function in array
body: <p>On my Welcome controller I have a function called <code>content_top</code> which loads function <code>$this-&gt;$part[0]($setting_info);</code> in this case <code>$this-&gt;slideshow($setting_info);</code> Then it should display that slideshow functions view in that data array.</p>
  
  <p>When I have refreshed my page I get a error </p>
  
  <pre><code>A PHP Error was encountered
  Severity: 4096
  Message: Object of class CI_Loader could not be converted to string
  Filename: common/content_top.php
  Line Number: 7
  Backtrace:
  File: C:\wamp\www\cms\application\views\common\content_top.php
  Line: 7
  Function: _error_handler
  File: C:\wamp\www\cms\application\controllers\Welcome.php
  Line: 51
  Function: view
  File: C:\wamp\www\cms\application\controllers\Welcome.php
  Line: 19
  Function: content_top
  File: C:\wamp\www\cms\index.php
  Line: 292
  Function: require_once
  </code></pre>
  
  <p><strong>And</strong></p>
  
  <pre><code>A PHP Error was encountered
  Severity: 4096
  Message: Object of class CI_Loader could not be converted to string
  Filename: common/welcome_message.php
  Line Number: 3
  Backtrace:
  File: C:\wamp\www\cms\application\views\common\welcome_message.php
  Line: 3
  Function: _error_handler
  File: C:\wamp\www\cms\application\controllers\Welcome.php
  Line: 20
  Function: view
  File: C:\wamp\www\cms\index.php
  Line: 292
  Function: require_once
  </code></pre>
  
  <p>Question Is there any way to when I have a function in array to be able to make it display the view with out throwing error.</p>
  
  <pre><code>&lt;?php
  
  class Welcome extends CI_Controller {
  
      public $data = array();
  
      public function __construct() {
          parent::__construct();
          $this-&gt;load-&gt;model('design/model_layout');
          $this-&gt;load-&gt;model('extension/model_module');
          $this-&gt;load-&gt;model('design/model_banner');
          $this-&gt;load-&gt;model('tool/model_image');
  
          $this-&gt;load-&gt;library('image_lib');
      }
  
      public function index() {
          $this-&gt;load-&gt;view('common/header');
          $data['content_top'] = $this-&gt;content_top();
          $this-&gt;load-&gt;view('common/welcome_message', $data);
          $this-&gt;load-&gt;view('common/footer');
      }
  
      public function content_top() {
          if ($this-&gt;uri-&gt;segment(1)) {
              $route = $this-&gt;uri-&gt;segment(1) .'/'. $this-&gt;uri-&gt;segment(2);
          } else {
              $route = 'common/home';
          }
  
          $layout_id = $this-&gt;model_layout-&gt;get_layout($route);
  
          $data['modules'] = array();
  
          $modules = $this-&gt;model_layout-&gt;get_layout_modules($layout_id, 'content_top');
  
          foreach ($modules as $module) {
              $part = explode('.', $module['code']);
  
              if (isset($part[1])) {
                  $setting_info = $this-&gt;model_module-&gt;get_module($part[1]);
  
                  if ($setting_info) {
                      $data['modules'][] = $this-&gt;$part[0]($setting_info);
  
                  }
              }
          }
  
  
          return $this-&gt;load-&gt;view('common/content_top', $data);
      }
  
      public function slideshow($setting_info) {
          static $module = 0;
  
          $data['banners'] = array();
  
          $results = $this-&gt;model_banner-&gt;get_banner($setting_info['banner_id']);
  
          foreach ($results as $result) {
              $data['banners'][] = array(
                  'banner_image' =&gt; $this-&gt;model_image-&gt;resize($result['banner_image'], $setting_info['width'], $setting_info['height'])
              );
          }
  
          $data['module'] = $module++;
  
          $data['resize_errors'] = $this-&gt;image_lib-&gt;display_errors();
  
          return $this-&gt;load-&gt;view('module/slideshow', $data);
      }
  }
  </code></pre>