Welcome Guest, Not a member yet? Register   Sign In
When to use a library within the view (maybe?)
#4

[eluser]John_Betong_002[/eluser]
I sort-of solved a similar problem by calling a model function from the common MY_Controller->constructor(). The array loaded from the model function is passed to the sidebar view like this:


Code:
// MY_Controller
function __construct()
{
  parent::__construct();

  // update top-10 today
  $this->today = $this->m_lib->today_hits_get_links();    
  ...
  ...
  ...




// sidebar view
  if(isset($this->today) && count($this->today) >= 2)
  {
    echo heading('Most popular hits last 24 hours',5);
    echo ol($this->today, $attributes);

}else{
  // the "best laid plans of mice and men often go awry
  ...
  ...
  ...
}
 
edit:
Unfortunately; introducing database caching has opened up a whole can of worms and the bl**dy list does not get updated Sad
 
 


Messages In This Thread
When to use a library within the view (maybe?) - by El Forum - 04-20-2011, 11:24 AM
When to use a library within the view (maybe?) - by El Forum - 04-20-2011, 12:05 PM
When to use a library within the view (maybe?) - by El Forum - 04-20-2011, 03:32 PM
When to use a library within the view (maybe?) - by El Forum - 04-20-2011, 04:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB