title: Codeigniter helper with model data
body: <p>Instead of repetitive data pasting into my controllers, I am looking to create a helper called "navigation" this will be used for every controller and load in the navigation subviews.</p>
  
  <p>Currently, in EVERY controller I am adding the following code.</p>
  
  <pre><code>// Get Subcategories
  $subcat1 = $this-&gt;Categories_model-&gt;get_artstyles();
  $subcat2 = $this-&gt;Categories_model-&gt;get_artsubjects();
  $subcat3 = $this-&gt;Categories_model-&gt;get_media();
  $subcat4 = $this-&gt;Categories_model-&gt;get_photography();
  
  $this-&gt;view_data['sub_cat1'] = $subcat1-&gt;result();
  $this-&gt;view_data['sub_cat2'] = $subcat2-&gt;result();
  $this-&gt;view_data['sub_cat3'] = $subcat3-&gt;result();
  $this-&gt;view_data['sub_cat4'] = $subcat4-&gt;result();
  </code></pre>
  
  <p>So what I would like to do is trim this down and load that data as a helper. So ultimately all I do in each controller is load the helper.</p>
  
  <p>If you feel this is the wrong way to do it, please advise as I'm still a little unsure on CI and its ways. </p>
  
  <p>Those 4 subcat variables are all wanting to be global variables.</p>