J1.5 稳定版 和 sef 路径
- mio
- Topic Author
- 訪客
- kochin
- Offline
- 白金會員
Less
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
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
- Topic Author
- 訪客