Welcome Guest, Not a member yet? Register   Sign In
Best way to implement dynamic site-wide menu?
#5

Thanks ...

... So, taking your idea, I could create a Mycontroller, create the html in the construct function (thereby only running it once) and then rather than using the code I have in my controllers now:

PHP Code:
$this->data['title'] = '';
 
$this->data['images'] = $images
 
$this->data['data'] = $output;
 
$this->data['view'] = 'v_home';
 
$this->load->view('v_template'$this->data); 

Simply have a simple render function like this in My_Controller:

PHP Code:
function _render($data = []) {
 
   $data['nav']=$this->html// $this->html created in construct function
 
   $this->load->view('v_template, $data);
  } 

and call it from my controller like:

PHP Code:
$this->data['title'] = '';
 
$this->data['images'] = $images
 
$this->data['data'] = $output;
 
$this->data['view'] = 'v_home';
_render($this->data

As I said I'm VERY rusty with this stuff so thanks for any help!!
Reply


Messages In This Thread
RE: Best way to implement dynamic site-wide menu? - by blackbulldog - 06-04-2018, 04:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB