• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to access smarty functions in template using CodeIgniter?

#1
[eluser]rochellecanale14[/eluser]
Hello guys just need a little help here.
I have a difficulty in accessing smarty function in my template. Here's my sample code.

Controller:
Code:
class Category_Controller extends CI_Controller{
     
     public function __construct(){
      parent::__Construct();
     }
     
     public function index(){
     
      $title = "Welcome to my page!";
      $category = $this->category_model->getAllCategory();
      $category_data = $category->result_array();
     
      $this->smartylib->assign('category',$category_data);
      $this->smartylib->assign('title',$title);
      $this->smartylib->display('index.tpl');

     }
   
    }
My Template 



Code:
<html>
    <head>
     <title>{$title}</title>
    </head>
    <body>
     <table>
      <tr>
       <td>SALES CATEGORY ID</td>
       <td>SALES CATEGORY NAME</td>
       <td>SALES CATEGORY DESCRIPTION</td>
       <td>COUNT</td>
      </tr>
      <tr>
       {assign var = x value = ''}
       {assign var = y value = ''}
       {foreach $category as $x}
        <tr>
         <td>{$x['salescatid']}</td>
         <td>{$x['salescatname']}</td>
         <td>{$x['salescatdesc']}</td>
         <td>{$x['salescatname'] | count_characters}</td>
        </tr>
       {/foreach}
      </tr>
     </table>
     {$smarty.now |date_format:'%Y-%m-%d %H:%M:%S'}
    &lt;/body&gt;
   &lt;/html&gt;


I have a smarty error in the output. In my code I need to count the salescatname and display the output in the table also. And below. I need to post the date. But how can I access functions?

That's all thanks in advance.



Songsinh.

-------
giup viec nha uy tin giúp việc nhà | giúp việc nhà chuyen nghiep nhat  giup viec nha hieu qua nhat tim nguoi giup viec cong nhan nhat tìm người giúp việc duoc thanh cong nhat son epoxy that la bai phuc thi cong son epoxy ket qua cao nhat dich vu ve sinh thanh qua cao nhat dịch vụ vệ sinh thang nay gioi vay giup viec ngay tet chung ta nen doan ket giup viec ngay tet ngay hom nay la ngay may giúp việc ngày tết chung ta toi noi roi rem cua hieu qua cua chung minh rèm cửa cong nhan ngay ay son sua nha chung no that la dep dang tin rao vat phai that la ne phuc đăng tin rao vặt
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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