I’ve been playing around with codeingiter lately, and it seems to do the work. However, i’ve got a little problem here. I load my view’s like this,
<?php $this->load->view('default_views/header_view') ?>
<?php $this->load->view($main_content); ?>
<?php $this->load->view('default_views/fotter_view') ?>
Doing it this way helps me keep my views clean. But, I’ve got a menu in the header_view with a counter of how many people that are logged in, and how many people that have registered to my site. Is there any easy way too kinda access a model with this information? or do i need to send a variable on all my views to keep track of this? sounds like i need to repeat my self 1000 times if i do it like that?
Any suggestions?
You can call get_instance() from pretty much anywhere.
Should be what you’re after.
Although you can do this straight in your view, you should at the very least create a helper function to make the calls to the model and use that in your view instead. (not best practice, but still better than inline php.) The best thing you could do is rethink your model/controller design and figure out how to bring this information into the view cleanly.
get_instance();