Welcome Guest, Not a member yet? Register   Sign In
I can not figure out how to call the function
#1

[eluser]seobot[/eluser]
HellO!

Problem exists, there is the private function "delivery", which must have a value that comes into it.

Code:
class Catalog extends CI_Controller {

    public function __construct() {

        parent::__construct();

            $this->load->model('mCatalog');

    }

    public function index() {

        redirect(base_url(), 'location', 301);

    }

    public function id($catId = NULL, $num = 0) {

        $data['catalog'] = $this->mCatalog->getCatalog($catId);
     //   $data['deliver'] = $this->delivery($num);
        if ($data['catalog']  == FALSE) {
            $data['error'] = "Category not found";
        }
            $this->load->view("vCatalog", $data);

    }

private function delivery($num) {

        if($num > 0) {
            return $num."%";
        } else {
            return "Free!";
        }

}

It input parameter must be passed out of the array, which is obtained through the model database. In viewer this parameter is obtained from

Code:
<?php foreach ($catalog as $row): ?>

            <td>&lt;?=$row['delivery']?&gt;</td>

&lt;?endforeach?&gt;

Here it's the problem, can not figure out how to make that "delivery" in the viewer took the $num. Thank you!


Messages In This Thread
I can not figure out how to call the function - by El Forum - 10-15-2012, 02:53 AM
I can not figure out how to call the function - by El Forum - 10-15-2012, 03:26 AM
I can not figure out how to call the function - by El Forum - 10-15-2012, 07:08 AM
I can not figure out how to call the function - by El Forum - 10-15-2012, 07:23 AM
I can not figure out how to call the function - by El Forum - 10-15-2012, 07:33 AM
I can not figure out how to call the function - by El Forum - 10-15-2012, 07:46 AM
I can not figure out how to call the function - by El Forum - 10-15-2012, 08:02 AM
I can not figure out how to call the function - by El Forum - 10-15-2012, 08:23 AM
I can not figure out how to call the function - by El Forum - 10-15-2012, 08:32 AM
I can not figure out how to call the function - by El Forum - 10-15-2012, 08:42 AM
I can not figure out how to call the function - by El Forum - 10-15-2012, 08:53 AM
I can not figure out how to call the function - by El Forum - 10-15-2012, 09:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB