Welcome Guest, Not a member yet? Register   Sign In
Help With Product View issue with Template Library
#1

[eluser]JayArias[/eluser]
Ok, so I finall got around to understanding the template library. But i've still got some problems with my code.

Code:
class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->template->set_template('default');
        $this->template->write('title', "Default");
        $this->template->render();
    }
}

to show
Code:
$this->catalog->getLatest();
I have to place it in the view file or template.php file.

what I want to do is the following.
Code:
class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->template->set_template('default');
        $this->template->write('title', "Default");
                $this->template->write('content', $this->catalog->getLatest());
        $this->template->render();
    }
}
Yes, the code works but it doesn't appear in the correct spot it appears uptop before any of the code.

Here is my Model "Catalog"
Code:
<?php
Class catalog extends Model{
    function catalog()
    {
        parent::Model();
        $this->load->database('default');
    }
    function getLatest()
    {
        $query = $this->db->query("SELECT * FROM `products` WHERE `aprooved` = '1'");
        foreach($query->result() as $product)
        {
            echo "<ul>";
            echo "<li><a >category."/".$product->product_title."'><strong>".$product->product_title."</strong></a><br>";
            echo "<small>&nbsp;Submitted&nbsp;by&nbsp;<a >author."'>".$product->author."</a></small><br>";
            echo "<a >category."/".$product->product_title."'><img >product_thumbnail."'><a/></li>";
            echo "</ul>";
        }
    }
}

Please help.


Messages In This Thread
Help With Product View issue with Template Library - by El Forum - 07-08-2009, 04:42 PM
Help With Product View issue with Template Library - by El Forum - 07-08-2009, 06:01 PM
Help With Product View issue with Template Library - by El Forum - 07-08-2009, 08:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB