[eluser]tomitzel[/eluser]
Hello,
I've build this function that gets 5 random products, but I get this error message:
Code:
Fatal error: Call to undefined function _getfiverandomproducts() in /home1/nbxhostc/public_html/tomitzel/application/controllers/main.php on line 24
But here is my controller with the function defined:
Code:
<?php
class Main extends Controller{
function Main(){
parent::Controller();
$categories = $this->category_model->GetCategories();
$this->template->set('categories_list', $categories);
}
function _getFiveRandomProducts($count){
$products = $this->product_model->GetProducts();
$random_products = array();
$counter = 0;
for($i = 0; $i < $count; $i++){
$random_products[$counter++] = $products[rand(0, count($products))];
}
return $random_products;
}
function index(){
$data = array(
'title' => 'Colon Free Zone',
'random_products' => _getFiveRandomProducts(5)
);
$this->template->load('template', 'homepage', $data);
}
}
Any suggestion what is wrong here, I think i'm missing here something very obvious