อยากให้หลังบ้านของ joomla ตรงหน้า Article Manager แสดงผลเพียง 100 อันดับบทความหลังสุดเท่านั้น ( เพราะบทความเริ่มเยอะมาก แล้ว database ตอน add ข้อมูลช้า )
file ที่เกี่ยวข้องคือ
"administrator / components / com_content / admin.content.php" <- ตัวแสดงหน้าจอ กับ "administrator / components / com_content / controller.php" <-- ตัวนี้แหละ ตัวปัญหา จะ hack code อย่างไรครับ
$sql = “SELECT * FROM table LIMIT 10″; <- ใช้โค้ด sql ตัวนี้มาดัดแปลงหรือเปล่าครับ ว่าแต่หาบันทัดใน controller.php ที่จะแก้ไม่ได้ อยากให้แสดงเพียง 100 record หลังสุด
รบกวนเทพ sql ,php code ทั้งหมด แก้ controller.php ให้แสดงเพียง 100 reccode ให้หน่อยครับ ผมแก้มาหลาย เพ ลา แล้ว ไม่สำเร็จ
รบกวนๆๆๆๆ
( ของผมเป็น joomla 1.5 12 ครับ แต่ใครจะสอนด้วย joomla ตัวไหนก็ได้นะครับ ) ( ขอไม่ใช้ฟังค์ชั่น Display ตรงมุมล่าง # 100 นะครับ อยากแก้ที่โปรแกรมเลย เพราะ ผมปล่อยให้ user login เข้าไปใช้กันเองนะครับ ทีนี้ ถ้าไม่ lock ไว้ที่โปรแกรม user บางคนเปิด view all แล้ว add ข้อมูลคนเดียว อีก 3 คนที่กด add พร้อมๆ กัน database ก็เริ่มรวน บางทีจอที่หน้า edit ตอน save ก็ค้างไปเฉยๆ บางทีก็ดับเบิ้ลรวดเดียว 3 บทความเลย )
function viewArchive() { global $mainframe;
// Initialize variables $db =& JFactory::getDBO();
$sectionid = JRequest::getVar( 'sectionid', 0, '', 'int' ); $option = JRequest::getCmd( 'option' );
$filter_order = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.filter_order", 'filter_order', 'sectname', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.filter_order_Dir", 'filter_order_Dir', '', 'word'); $catid = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.catid", 'catid', 0, 'int'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.limitstart", 'limitstart', 0, 'int'); $filter_authorid = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.filter_authorid", 'filter_authorid', 0, 'int'); $filter_sectionid = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.filter_sectionid", 'filter_sectionid', 0, 'int'); $search = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.search", 'search', '', 'string'); $search = JString::strtolower($search); $redirect = $sectionid;
// A section id of zero means view all articles [all sections] if ($sectionid == 0) { $where = array ('c.state = -1', 'c.catid = cc.id', 'cc.section = s.id', 's.scope = "content"'); $filter = ' , #__sections AS s WHERE s.id = c.section'; $all = 1; } else { //We are viewing a specific section $where = array ('c.state = -1', 'c.catid = cc.id', 'cc.section = s.id', 's.scope = "content"', 'c.sectionid= '.(int) $sectionid); $filter = ' WHERE section = '.$db->Quote($sectionid); $all = NULL; }
// Section filter if ($filter_sectionid > 0) { $where[] = 'c.sectionid = ' . (int) $filter_sectionid; } // Author filter if ($filter_authorid > 0) { $where[] = 'c.created_by = ' . (int) $filter_authorid; } // Category filter if ($catid > 0) { $where[] = 'c.catid = ' . (int) $catid; } // Keyword filter if ($search) { $where[] = 'LOWER( c.title ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); }
ยังมีอีกนะครับ file นี้ 1480 บันทัด รบกวนเทพ เปิด "administrator / components / com_content / controller.php" ของ joomla ดู
|