问题
I want to use underscore in menu alias in joomla. For a menu item called "Residential Storage" I want to use "residential_storage" as alias but when I save this it becomes "residential-storage", so underscore is being replaced by hyphen. How can I use hyphen?
回答1:
Normally the alias should consist of lowercase letters and hyphens (-). No blank spaces or underscores are allowed.But to use underscore check the link below.This method will replace all (-) to (_). http://forum.joomla.org/viewtopic.php?f=618&t=638854
回答2:
Previous answer do not work for me.
And I find easy (and dirty) way.
- Look for \libraries\joomla\filter\output.php
- Just after the line (102), which contains:
$str = trim($str, '-');
- Insert this code:
$str = str_replace('ttt', '_', $str);
- Now in every menu alias, where you type tripple
t
it'll be replaced with (_) symbol. You can use other characters obviously. You can even use (-) here, but I do not recommend it. Let's just say- this method is good help when you change CMS, but do not want to loose positions in search results, because of this_kind_of_links on old site and this-kind-link on new. Just remember- you need to use lowercase character for replacements (because all characters becames lowercase after menu saving).
来源:https://stackoverflow.com/questions/13717253/use-underscore-in-joomla-menu-alias