• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

#2
[eluser]diasansley[/eluser]
i really cant understand y i am facing the problem its a simple database select code.

#3
[eluser]Bart Mebane[/eluser]
Please post the rest of your m_coupons model code, and post the exact error message you are seeing.

#4
[eluser]diasansley[/eluser]
i fixed that can u tell me why i get a "authorisation error" from codeigniter website when i register from my other pc?


thanks

#5
[eluser]Bart Mebane[/eluser]
Do you have cookies disabled on your other pc?

#6
[eluser]diasansley[/eluser]
no.. i register on other sites!! that works fine!

#7
[eluser]Bart Mebane[/eluser]
I don't know anything about how the forum authorization works. My only guess is that you can only be logged in from one pc at one time, and you are already logged in on another computer.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.