หน้าเว็บ

วันเสาร์ที่ 8 กันยายน พ.ศ. 2555

แก้ adsmanager joomla 1.0 ไป 1.5

เนื่องจาก แก้ไขของเก่าไปเยอะ ขี้เกียจลงของใหม่แก้ใหม่ แต่ของเก่าสำหรับ Joomla 1.0 หลังจากที่ได้อัพ Joomla เป็น vesrion 1.5 เลยต้องแก้ไข code ทั้งหมด code ของ Joomla 1.0 กับ 1.5 แตกต่างกันเยอะมาก เลย จะ POST คำสั่งสำคัญๆไว้กันลืม Joomla 1.0 code
require_once( $mainframe->getPath( 'front_html' ) );
require_once( $mainframe->getPath( 'class' ) );
$cache =&mosCache::getCache( $option );
$cache =& JFactory::getCache(com_adsmanager);
Joomla 1.5 code
require_once( JApplicationHelper::getPath('class') );
require_once( JApplicationHelper::getPath('front_html') );
$cache =& JFactory::getCache(com_adsmanager); 
$user = &JFactory::getUser();
$userid = $user->get('id');
ใส่ไฟล์ css ช่วง head
$document = JFactory::getDocument();
$document->addStyleSheet("market.css?v=5");
Load css class
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'modules/mod_example/css/mod_example.css');
$style = '#example {
        border-color:#' . $bordercolor . ';
        }';
$document->addStyleDeclaration( $style );
 
ลบแคชไฟล์ แต่แคชไฟล์ของ adsmanager ยังมีปัญหาอยู่มาก
$cache =& JFactory::getCache($option);
$cache->clean($option);
เรียกเปิดหน้าเว็บผ่านแคช
$cache->call( 'show_all',$option,$expand);
หากไม่ต้องการแต่ให้โหลดข้อมูลโดยคำสั่งแสดงหน้าเว็บตรงๆ เปลี่ยนเป็น ด้านล่าง ซึ่งจะเรียกผ่านฟังชั่นก์แทน
show_all($option,$expand,$text_search,$order,$limitstart);
คำสั่งให้แสดง Title, Description และ keyword ของ เพจ
$document =& JFactory::getDocument();
$document->setTitle("ประกาศของท่าน ในเว็บริมน้ำ");
$document->setDescription("ใส่คำอธิบายของหน้าเพจ");
$document->setMetaData("keywords", "คีย์เวิร์ค");
mosRedirect Joomla 1.5 app->redirect เปลี่ยนเป็น
$msg = "ข้อความเปลี่ยนหน้า";
$url = "url สำหรับการเปลี่ยนหน้า";
$app = &JFactory::getApplication();
$app->redirect($url, $msg);
mosHTML cleanText เปลี่ยนเป็น
$row->ad_text = JFilterOutput::cleanText($row->ad_text);
โหลด Java script $mainframe->addCustomHeadTag เปลี่ยนเป็น
$doc =&JFactory::getDocument();
$doc->addScript('file.js');
$doc->addScriptDeclaration('java script code');

ไม่มีความคิดเห็น:

แสดงความคิดเห็น