Demo

討論

保持飢餓,保持愚笨 (Stay hungry, stay foolish)。 史蒂夫·賈伯斯

公告

本網站已取消討論區的討論方式,如果您有問題請至LINE群行動條碼圖片網址,或Facebook社團

J1.5 稳定版 和 sef 路径

  • mio
  • mio 的個人頭像 Topic Author
  • 訪客
  • 訪客
2008-01-26 19:55 #9197 來自 mio
mio created the topic: J1.5 稳定版 和 sef 路径
hi guys,

i tried J1.5RC3 a few months ago,

PHP Version 4.4.7, chinese utf-8, when i enabled sef with mod write on and suffix off, it looks excellent, path is like:

Please 登入 to join the conversation.

More
2008-01-28 12:22 #9217 來自 kochin
kochin replied the topic: J1.5 稳定版 和 sef 路径
Very interesting problem. Well, it's not really a problem but a behavior by design. I spent an afternoon tracking down the cause of this behavior. Here is what I found out.

The links that Joomla! serves out are actually the Alias fields. However the Alias field is not what you filled in or a direct copy from Title field, it is a result of some transformations under the hood.

When you save a article, section, category or menu, Joomla! takes the Alias field and runs it through JFilterOutput::stringURLSafe(). The stringURLSafe() function in turn feeds the string to JLanguage::transliterate(). There, the function utf8_decode() is applied to it, then htmlentities(). Next, all strange characters in the string are replaced with something normal. Chinese or Japanese characters won't survive those tortures. But, that's not all.

Back to stringURLSafe(), all the whitespaces and non-alphanumeric characters are replaced with dashes or removed. Any Chinese or Japanese characters are gone from the string. And, it's not done.

Because it's more than likely the string only has dashes in it or is empty after all abuses, the function check() (happens in several places) that calls stringURLSafe() finally replaces the string with a time stamp if it's empty or only dashes left.

So how to solve this problem? First, replace the function stringURLSafe() in libraries/joomla/filter/filteroutput.php with this

Please 登入 to join the conversation.

  • mio
  • mio 的個人頭像 Topic Author
  • 訪客
  • 訪客
2008-01-28 14:26 #9220 來自 mio
mio replied the topic: J1.5 稳定版 和 sef 路径
kochin

Please 登入 to join the conversation.