• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling 2 controllers?

#11
[eluser]xwero[/eluser]
check this templating helper for the header/footer including problem. Every view you load that extends the masterpage will have the same header and footer.

For the query i wonder if it needs to be executed on every page? As I don't see any variable I don't think so. You could make a view file with content that gets generated when there are changes in the backend. Then the footer could be something like this
Code:
// close some open divs from the content
</div></div></div>

// include the menu
&lt;?php $this->load->view('menu'); ?&gt;

// end the page completely
&lt;/body&gt;
&lt;/html&gt;


you say
Quote: I’m looking for the ‘good’ way to do something like this, but it shouldn’t be more code than this, because that would be kind of stupid
If you want to do it the 'good' way there is going to be more code because what you have now is not segmented code.

#12
[eluser]Seppo[/eluser]
mysql_query ? mysql_num_rows?? Oh, no... That's definetly not ci-style

Why don't you add your model to the autoload config file, and inside the model constructor you call the method you need and assing those vars to the view?

Code:
class Menu extends Model {
  function Menu()
  {
    parent::Model();
    $data['menu'] = $this->getSomeData();
    $CI =& get_instance(); // not sure if necesary, but I think otherwise you mioght have problems with php 4
    $CI->load->vars($data);
  }
}


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.