|
สำหรับใครที่ใช้ Adsmanager ทำเว็บประกาศขายของหรือเว็บโฆษณาขายของ และใช้ sh404sef ในการทำ sef ให้กับจุมล่า อันนี้เป็นปลั๊กอินเสริมสำหรับ sh404sef ให้มองเห็นลิ้งก์ ของ Adsmanager เป็นแบบ sef ภาษาไทย วิธีการคือ
สร้างโฟล์เดอร์ใหม่ชื่อ sef_ext ในพาธ /components/com_adsmanager/
จากนั้นสร้างไฟล์ใหม่ที่ชื่อ com_adsmanager.php
นำโค๊ดเหล่านี้ไปไว้ในไฟล์ com_adsmanager.php
<?php
// Security check to ensure this file is being included by a parent file. if (!defined('_VALID_MOS')) die('Direct Access to this location is not allowed.');
// ------------------ standard plugin initialize function - don't change ------------------- global $sh_LANG, $sefConfig ; $shLangName = '';; $shLangIso = ''; $title = array(); $shItemidString = ''; $dosef = shInitializePlugin( $lang, $shLangName, $shLangIso, $option); // ------------------ standard plugin initialize function - don't change -----------------
// remove common URL from GET vars list, so that they don't show up as query string in the URL shRemoveFromGETVarsList('option'); shRemoveFromGETVarsList('lang'); if (!empty($Itemid)) shRemoveFromGETVarsList('Itemid'); if (!empty($limit)) shRemoveFromGETVarsList('limit'); if (isset($limitstart)) shRemoveFromGETVarsList('limitstart');
if (file_exists($GLOBALS['mosConfig_absolute_path'] .'/components/com_adsmanager/lang/lang_' . $GLOBALS['mosConfig_lang'] . '.php')){ include_once($GLOBALS['mosConfig_absolute_path'] .'/components/com_adsmanager/lang/lang_' . $GLOBALS['mosConfig_lang'] . '.php'); } else include_once( $GLOBALS['mosConfig_absolute_path'] .'/components/com_adsmanager/lang/lang_english.php' );
$title[] = ADSMANAGER_SEF_ADS;
if (isset($adid)) { $database->setQuery("SELECT category, ad_headline FROM #__adsmanager_ads WHERE id=$adid"); $rows = $database->loadObjectList(); if ($database->getErrorNum()) { echo $database->stderr(); return false; } $ad_text = substr($rows[0]->ad_headline, 0, 1024)."-".$adid; shRemoveFromGETVarsList('adid'); $catid = $rows[0]->category; } if (isset($catid)) { $database->setQuery("SELECT c.* FROM #__adsmanager_categories as c WHERE c.published = 1 ORDER BY c.parent,c.ordering"); $rows = $database->loadObjectList(); if ($database->getErrorNum()) { echo $database->stderr(); return false; }
// establish the hierarchy of the menu $orderlist = array(); $current_list = array(); // first pass - collect children foreach ($rows as $v ) { $orderlist[$v->id] = $v; }
$current = $catid; while($orderlist[$current]->id != 0) { $current_list[] = $orderlist[$current]->name; $current = $orderlist[$current]->parent; }
for($i = count($current_list)-1; $i>=0; $i--) { $title[] = $current_list[$i]; } shRemoveFromGETVarsList('catid'); } if (isset($ad_text)) { $title[] = $ad_text; }
switch ($page) {
case 'show_profile': $title[] = ADSMANAGER_SEF_PROFILE.$userid."/".ADSMANAGER_SEF_EDIT; break;
case 'save_profile': $title[] = ADSMANAGER_SEF_PROFILE.$userid."/".ADSMANAGER_SEF_SAVE; break;
case 'show_user': if (isset($userid)) $title[] = ADSMANAGER_SEF_USER."-".$userid; else $title[] = ADSMANAGER_SEF_MY_ADS; break;
case 'show_category': break;
case 'show_rules': $title[] = ADSMANAGER_RULES; break;
case 'show_ad': break;
case 'write_ad': if (!isset($adid)) $title[] = ADSMANAGER_SEF_WRITE_AD; else $title[] = ADSMANAGER_SEF_UPDATE; break;
case 'save_ad': if (!isset($adid)) $title[] = ADSMANAGER_SEF_SAVE_AD; else $title[] = ADSMANAGER_SEF_SAVE; break;
case 'delete_ad': if (!isset($adid)) $title[] = ADSMANAGER_SEF_DELETE_AD; else $title[] = ADSMANAGER_SEF_DELETE; break;
case 'show_all': $title[] = ADSMANAGER_SEF_ALL_ADS; break;
case 'show_search': $title[] = ADSMANAGER_SEF_SHOW_SEARCH; break;
case 'show_result': $title[] = ADSMANAGER_SEF_SHOW_RESULT; break;
case 'show_message_form': $title[] = 'Nachricht schreiben'; break;
default: $title[] = $page; break; } shRemoveFromGETVarsList('page');
if (isset($expand) && !$expand) shRemoveFromGETVarsList('expand'); if (isset($order) && !$order) shRemoveFromGETVarsList('order'); if (isset($text_search) && !$text_search) shRemoveFromGETVarsList('text_search');
// ------------------ standard plugin finalize function - don't change ---------------------------
if ($dosef){ $string = shFinalizePlugin( $string, $title, $shAppendString, $shItemidString, (isset($limit) ? @$limit : null), (isset($limitstart) ? @$limitstart : null), (isset($shLangName) ? @$shLangName : null)); } // ------------------ standard plugin finalize function - don't change ---------------------------
?>
จากนั้นทำการ save อัพโหลดไฟล์ com_adsmanager.php ไปไว้ยังพาธ /components/com_adsmanager/sef_ext ที่ได้สร้างไว้ เป็นอันเสร็จเรียร้อยไม่ต้องทำอะไรต่อ ใช้งานได้ อย่าลืมสร้างไฟล์ index.html เปล่า ๆ ขึ้นมาแล้วใส่ ไว้ใน /components/com_adsmanager/sef_ext ด้วยนะครับเพื่อป้องกับการเข้าถึงในพาธนี้
**fix ท่านใดที่โหลดไปแล้ว(ก่อน 27/09/2009) สินค้าที่โพสต์หัวข้อยาว ๆ แล้วเข้าตามลิ้งก์ไม่ได้ ให้แก้บรรทัดที่ 40
$ad_text = substr($rows[0]->ad_headline, 0, 40)."-".$adid;
เปลี่ยนตรงเลข 40 เป็น 1024
ดูตัวอย่างได้ที่ http://www.gtr-computer.com
หรือดาวน์โหลดที่นี่ (เข้าสู่ระบบก่อน)
To view rest of this section, please login or register.. ในการดูส่วนที่เหลือกรุณาเข้าสู่ระบบหรือลงทะเบียน..
ศึกษาการใช้งาน sh404sef for joomla
ศึกษาการใช้งาน AdsManager |