コード例 #1
0
 public function index()
 {
     // In Kohana, all views are loaded and treated as objects.
     $this->template->content = new View('testimonials');
     $this->template->metaDescription = $this->description;
     $this->template->metaKeywords = $this->keywords;
     $this->template->metaTitle = $this->title;
     // You can assign anything variable to a view by using standard OOP
     // methods. In my welcome view, the $title variable will be assigned
     // the value I give it here.
     $this->template->title = $this->title;
     $db = new Database();
     $resultall = $db->query('SELECT t.* ' . 'FROM testimonials t ' . 'INNER JOIN sites_testimonials st ON t.id = st.testimonial_id ' . 'WHERE st.site_id = ' . self::getCurrentSite()->id . ' ORDER BY t.id DESC');
     $this->template->content->testimonialresults = $resultall;
     // getProducts is a method defined in Product_Model
     $products = new Product_Model();
     $this->template->content->productresults = $products->getProductsForSite(TRUE);
     // getOccasions and getOccasion($id) is a method defined in Occasion_Model
     $occasions = new Occasion_Model();
     $this->template->content->occasionresults = $occasions->getOccasions();
     $this->template->content->message = "";
 }
コード例 #2
0
 public function show()
 {
     // In Kohana, all views are loaded and treated as objects.
     $this->template->content = new View('occasions');
     $occasionarray = Router::$arguments;
     $occasionname = $occasionarray[0];
     // getOccasions and getOccasion($id) is a method defined in Occasion_Model
     $occasions = new Occasion_Model();
     $this->template->content->occasionresults = $occasions->getOccasions();
     $occasion = $occasions->getOccasionByName($occasionname);
     $this->template->content->occasion = $occasion;
     $this->template->metaDescription = $occasion->meta_description;
     $this->template->metaKeywords = $occasion->meta_keywords;
     $this->template->metaTitle = $occasion->meta_title;
     // You can assign anything variable to a view by using standard OOP
     // methods. In my welcome view, the $title variable will be assigned
     // the value I give it here.
     $this->template->title = $occasion->meta_title;
     // getProducts is a method defined in Product_Model
     $products = new Product_Model();
     $this->template->content->productresults = $products->getProductsForSite(TRUE);
 }