วิธีแก้ปัญหา alias ภาษาไทย ใน Joomla 1.5

กฎการใช้บอร์ด
คำถามหมวดนี้ ควรระบุ รายละเอียดของ Server OS, เวอร์ชั่น ของ PHP, CMS ที่ท่านใช้
รวมถึง Hosting หรือ Control Panel Hosting

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: วิธีแก้ปัญหา alias ภาษาไทย ใน Joomla 1.5

Re: วิธีแก้ปัญหา alias ภาษาไทย ใน Joomla 1.5

โดย mindphp » 05/05/2010 5:52 pm

ใช้ได้กับ Joomla 1.5 นะครับ ผมทดสอบ กับ 1.5.17, 1.5.15 แล้ว

Re: วิธีแก้ปัญหา alias ภาษาไทย ใน Joomla 1.5

โดย mindphp » 21/02/2010 8:33 pm

libraries/joomla/filter/filteroutput.php

โค้ด: เลือกทั้งหมด

    function stringURLSafe($string)
    {
        //remove any '-' from the string they will be used as concatonater
        // $str = str_replace('-', ' ', $string);

        /*
        $lang =& JFactory::getLanguage();
        $str = $lang->transliterate($str);

        // remove any duplicate whitespace, and ensure all characters are alphanumeric
        $str = preg_replace(array('/\s+/','/[^A-Za-z0-9\-]/','/[^d]/'), array('-','',''), $str);

        // lowercase and trim
        $str = trim(strtolower($str));
        */
        $str = str_replace(' ', '-', $string);
        $str = mb_strtolower($str);
        $str = trim($str);
        return $str;
    } 

วิธีแก้ปัญหา alias ภาษาไทย ใน Joomla 1.5

โดย mindphp » 21/02/2010 7:59 pm

วิธีแก้ปัญหา alias ภาษาไทย ใน Joomla 1.5
libraries/joomla/utilities/string.php
เพิ่ม function นี้

โค้ด: เลือกทั้งหมด

    function parse_url($url, $component = -1) {
            $regex = '#^(?:(?P<scheme>[a-z]+[a-z0-9]*)://)?(?:(?P<user>\w+):?(?P<pass>\w+)?@)?(?:(?P<host>[a-z0-9-][a-z0-9-\.]*[a-z0-9-]))?(?::(?P<port>\d+))?(?:(?P<path>[^\#?]+))?(?:\?(?P<query>[^\#]+))?(?:\#(?P<fragment>.*?))?$#iu';
            if (preg_match($regex, $url, $match)) {
                if ($component != -1) {
                    switch ($component) {
                        case PHP_URL_SCHEME:
                            return $match['scheme'];
                            break;
                        case PHP_URL_HOST:
                            return $match['host'];
                            break;
                        case PHP_URL_PORT:
                            return $match['port'];
                            break;
                        case PHP_URL_USER:
                            return $match['user'];
                            break;
                        case PHP_URL_PASS:
                            return $match['pass'];
                            break;
                        case PHP_URL_PATH:
                            return $match['path'];
                            break;
                        case PHP_URL_QUERY:
                            return $match['query'];
                            break;
                        case PHP_URL_FRAGMENT:
                            return $path['fragment'];
                            break;
                        default:
                            return false;
                    }
                } else {
                    $return = array();
                    foreach ($match as $key => $value) {
                        if (is_numeric($key) || empty($value)) continue;
                        $return[$key] = $value;
                    }
                    if (isset($return['host']) && !isset($return['scheme']) && !isset($return['user']) && !isset($return['port'])) {
                        if (!isset($return['path'])) $return['path'] = '';
                        $return['path'] = $return['host'] . $return['path'];
                         unset($return['host']);
                    }
                    return $return;
                }
            }
            return false;
        }    
     
libraries/joomla/environment/uri.php

แทน
$parts = @parse_url($uri);
ด้วย
$parts = JString::parse_url($uri);

อันนี้สำหรับส่วนที่เอา alias ภาษาไทยออกมาแสดงนะครับ

ข้างบน