Welcome Guest, Not a member yet? Register   Sign In
problem with passing data from model to view
#1

[eluser]diasansley[/eluser]
the below is the _front_content_box.php which is the file from where i have given an anchor tag to show all coupons.

Code:
<li>
            <p id="coupon_list_header">Exclusiv f&uuml;r Sie</p>
             &lt;?php foreach($coupons as $coupon): ?&gt;
                <div class="coupon_container">
                    <h3 id="coupon_text_&lt;?=$coupon['coupon_id'];?&gt;" class="coupon_content">&lt;?=$coupon['name'];?&gt;
                    <br />&lt;?=$coupon['text'];?&gt;
                    </h3>
                    <p class="coupon_valid_text">G&uuml;ltig vom  &lt;?=$coupon['from'];?&gt; bis &lt;?=$coupon['to'];?&gt;
                    </p>
                    <p>&lt;?=anchor('coupons/showCouponDetail/'.$coupon['coupon_id'], 'zu den Details', array('class' => 'coupon_link'));?&gt;</p>
                </div>
                
              &lt;?php endforeach;?&gt;
              
              <p>&lt;?=anchor('coupons/showallcoupons','alle coupons',array('class' => 'colum_bottom_text'));?&gt;      </p>
    </li>

the one below is the coupons/showallcoupons this is the controller file

Code:
function showallcoupons()
            {
        $this-> content['title'] = "all coupons";
        $brands = $this->m_brands->selectAllOrderBy('name','ASC');
        $products = $this->m_products->selectAllOrderBy('name','ASC');
        $entries = $this->m_entries->selectAllOrderBy('name','ASC');
        $coupons = $this ->m_coupons->selectAllOrderBy('name','ASC');
        $this->content['content'] = $this->_renderFrontendOutput('home/_front_image_box.php',array('error' =>''));
        $this->content['content'] .= $this->_renderFrontendOutput('home/_front_entries_search_box.php', array('entries'=>$entries,'brands'=>$brands,'products'=>$products));
        $this->content['content'] .= $this->_renderFrontendOutput('coupons/_show_coupon_list.php',array('coupons' =>$coupons) );      
        $this->renderTemplate();
             }


here is the model
Code:
class m_coupons extends WC_Model
{
    function __construct()
    {
        parent::__construct();
        $this->table = 'coupons';
    }



this is the view file
Code:
<div id="coupons_detail_container">
     <h3>&lt;?=$coupons['name']?&gt;</h3>
     <p id="coupon_description">&lt;?=$coupons['text']?&gt;</p>
     <p id="coupon_description">&lt;?=$coupons['from']?&gt;</p>
     <p id="coupon_description">&lt;?=$coupons['to']?&gt;</p>
</div>

where text 'from' and 'to' are supposed to be database fields which i want to display. But i get an error for those feilds as undefined


Messages In This Thread
problem with passing data from model to view - by El Forum - 11-30-2010, 01:28 AM
problem with passing data from model to view - by El Forum - 11-30-2010, 01:59 AM
problem with passing data from model to view - by El Forum - 11-30-2010, 06:03 AM
problem with passing data from model to view - by El Forum - 11-30-2010, 06:05 AM
problem with passing data from model to view - by El Forum - 11-30-2010, 06:07 AM
problem with passing data from model to view - by El Forum - 11-30-2010, 06:19 AM
problem with passing data from model to view - by El Forum - 11-30-2010, 06:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB