รบกวน เทพ ช่วยดู code ใน joomla 1.5 ให้หน่อยครับ

เริ่มโดย nu_dee, 09 พฤศจิกายน 2009, 21:00:56

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

nu_dee

อยากให้หลังบ้านของ 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 ดู

iSEO

ลองเข้าไปที่ Article Manager แล้ว กตที่ Date ดูสิครับ ว่าเป็นอย่างที่คุณต้องการรึป่าว แล็วก็ด้านล้างสุดนะครับ ต้อง limit จำนวนบทความ ที่เราตอ้งการครับ

ตาม default แล้ว มันจะแสดงหน้าละ 20 บทความครับ ถ้าต้องการเปลี่ยนเป็นอย่างอื่น ต้องไปแก้ที่ Global Configuration ครับ

nu_dee

ลองไปที่  Global Configuration -> Site Settings -> List Length แล้วครับ
ยังไม่ตรงครับ เพราะ ปรับที่ตรงนี้ บทความยังโชว์อยุ่อีก 2 หมื่นกว่าบทความ
ทาง user ก็ยังสามารถกดปุ่ม all เพื่อวิวบทความทั้งหมด(ให้เว็บช้า)ได้อยู่

อยากซ่อนบทความให้เหลือสัก 100 บทความ ครับ
ให้ user จะกดปุ่ม all ก็โชว์บทความแค่ 100 บทความพอ เผื่อเว็บจะทำงานเร็วขึ้น

ขอบคุณครับ

chu2yo

[direct=http://www.myweb-zonehost.com][/direct]
เสื้อผ้า แฟชั่นเกาหลี: [direct=http://www.chu2yo.com]chu2yo เสื้อผ้า แฟชั่นเกาหลี[/direct] [direct=http://www.myweb-zonehost.com/index.php?option=com_content&view=article&id=64&Itemid=95]VPS hosting[/direct] [direct=http://www.myweb-zonehost.com/index.php?option=com_content&view=article&id=53&Itemid=80]โฮส 39 บาทต่อปี[/direct]


iSEO

ต้องมีอะไรผิดพลาดแน่ๆเลยครับ ปกติ มันจะแสดงแค่ 20
ใช้ version อะไรหรอครับ version ล่าสุดรึป่าว