Lỗi component, thành khẩn xin giúp đỡ gấp

Moderator: hungkhanggl

Forum rules
Locked
thanhtungtnt
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Fri Jul 03, 2009 4:44 pm

Lỗi component, thành khẩn xin giúp đỡ gấp

Post by thanhtungtnt » Fri Dec 11, 2009 4:57 am

Component mình đang viết là com_reviews

Mình đang học thiết kế component qua tài liệu. Mình gõ không sót 1 chữ nào nhưng vẫn bị lỗi. :(

Đây là toàn bộ trang web và database để các bạn xem dùm :
http://www.mediafire.com/download.php?mwdm4jdvgtz

Làm ơn xem dùm mình code của component "Restaurant Reviews" bên trong thư mục com_reviews trong thư mục administrator/components/ (vì mình đang thiết kế phần back-end thôi chưa qua phần front-end). File lỗi nằm theo đường dẫn này "...joomla 1.5.15\administrator\components\com_reviewsadmin.review.php" (Hàm lỗi là saveReview()).

Xin hãy giúp mình. :(

Cấu trúc thư mục :
Phần Back-end :
administrator
|***** Manual signatures are NOT allowed *****__com_reviews
.................|***** Manual signatures are NOT allowed *****__tables
..................................|____review.php
.................|***** Manual signatures are NOT allowed *****__admin.reviews.html.php
.................|***** Manual signatures are NOT allowed *****__admin.reviews.php
.................|***** Manual signatures are NOT allowed *****__toolbar.reviews.html.php
.................|***** Manual signatures are NOT allowed *****__toolbar.reviews.php

Hiện giờ mình chỉ làm phần back-end còn chưa quan tâm tới phần front-end :
Mình bị lỗi ở hàm saveReview() . Nằm trong file admin.reviews.php

Hàm saveReview()

Code: Select all

function saveReview($option)
	{
		global $mainframe;
		$row =& JTable::getInstance('review', 'Table');
		if (!$row->bind(JRequest::get('post')))
		{
			return JError::raiseWarning( 500, $row->getError() );
		}
		$row->quicktake = JRequest::getVar('quicktake', '', 'post', 'string', JREQUEST_ALLOWRAW);
		$row->review = JRequest::getVar('review', '', 'post', 'string', JREQUEST_ALLOWRAW);
		if(!$row->review_date)
			$row->review_date=date('Y-m-d H:i:s');
		if(!$row->store())
		{
			JError::raiseError(500, $row->getError() );
		}
		switch($task)
		{
			case 'apply':
				$msg='Changes to Review saved';
				$link='index.php?option='.$option.'&task=edit&cid[]='.$row->id;
				break;
			case 'save':
			default:
				$msg='Review saved';
				$link='index.php?option='.$option;
				break;				
		}
		$mainframe->redirect($link, $msg);
	}
Cấu trúc bảng : nằm trong file "tables\review.php"

Code: Select all

<?php
	defined('_JEXEC') or die('Restricted access');
	class TableReview extends JTable
	{
		var $id=null;
		var $name=null;
		var $address=null;
		var $reservations=null;
		var $quicktake=null;
		var $review=null;
		var $notes=null;
		var $smoking=null;
		var $credit_cards=null;
		var $cuisine=null;
		var $avg_dinner_price=null;
		var $review_date=null;
		var $published=null;
		function __construct(&$db)
		{
			parent::__construct('#_reviews', 'id', $db);
		}
	}
?>
Còn đây là hình struct trong mysql :
Image

uenb
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Jul 06, 2010 2:30 am

Re: Lỗi component, thành khẩn xin giúp đỡ gấp

Post by uenb » Fri Jul 09, 2010 9:32 am

bạn xem tài liệu nào vậy ? Component cho Joomla 1.5 hay Joomla 1.6 ??? Mình viết cho 1.5 thi okie, nhưng áp dụng cho 1.6 thì bị lỗi.
Bạn nào có gi hay xin góp ý với ! Thanks nhiều lắm !


Locked

Return to “Thành phần mở rộng cho Joomla!”