如果您尝试在 Joomla 中搜索很长的句子,那么很可能您得到的唯一结果如下:
搜索词必须最少 3 个字符,最多 20 个字符。
如果你真的希望人们在你的网站上搜索长句子,那么显然你想改变这个上限。 但是怎么做呢?
好吧,在我们告诉你怎么做之前,我们不得不说,我们第一次尝试增加最大搜索限制时,我们花了很长时间才知道如何 - 这就像一场野鹅追逐:一个文件将你引导到另一个文件到另一个文件! 但是,我们终于发现了:它实际上是一种语言设置! 我们不知道为什么 Joomla 没有在一个明显的地方有这个设置——比如在指向搜索组件的菜单项的设置中。
更复杂的是,不能在 Joomla 的后端更改该设置,而是在语言文件中更改(换句话说,您需要进行一些编码)。 因此,如果您想更改最大搜索限制(并假设您的网站上只有一种语言,即英语),那么您可以这样做:
- 的文件 en-GB.localise.php 位于 /language/en-GB/ 。
-
在函数 getUpperLimitSearchWord 中,您将返回值从 20 更改为 40(例如)。 换句话说,您更改以下代码:
return 20;
到
return 40;
-
您保存文件并上传它!
-
而已!
现在,要提一件事,如果您有其他语言,那么您需要对每种语言执行上述相同的步骤(例如,如果您的网站有法语版本,那么您需要对文件进行上述修改 fr-FR.localise.php 位于 /language/fr-FR/ 目录下)。 如果您没有时间做这项繁琐的工作,那么您可以改为对 Joomla 核心文件进行以下更改,以确保所有语言都具有您选择的相同搜索限制:
- 打开 language.php 位于 library/joomla/language 目录
-
就在这一行之前(第 582 行):
if ($this-&upperLimitSearchWordCallback !== null)
添加以下代码:
return 40;
//其中 40 是您的新搜索限制 -
保存文件并上传回来。
-
而已!
请注意,Joomla 的搜索模块默认将其 20—— 这就是为什么您不能在该模块的搜索字段中输入超过 20 个字符的原因。 但是,好消息是 maxlength 值来自函数 getUpperLimitSearchWord ,这意味着执行上述操作将自动确保将 maxlength 更改为您选择的值(例如,如果您将值更改为 40,那么 maxlength 值将自动 40).
现在,如果上述方法对您不起作用,或者您没有编程经验,那么为什么不 联系我们 呢? 我们会以光速为你解决问题(嗯,慢一点,但你明白了), 我们不会向你收取太多费用 ,而且我们是地球上最友好的程序员——甚至可能是整个太阳系系统!
注意:如果您想增加/减少搜索下限,只需将 upper 替换 lower 上述指南中的 例如,您需要更改函数 getLowerLimitSearchWord 的返回值,而不是更改函数 getUpperLimitSearchWord 的返回值。
原文:
If you have tried to search for a very long sentence in Joomla, then most likely the only result that you got was the following:
Search term must be a minimum of 3 characters and a maximum of 20 characters.
If you really want people to search for long sentences on your website, then obviously you want to change that upper limit. But how to do that?
Well, before we tell you how, we have to say that the first time we tried to increase the maximum search limit it took us ages to find out how – it was like a wild goose chase: a file leading you to another file which leads to another file! But, we finally discovered it: it was actually a language setting! We have no idea why Joomla doesn’t have this setting in a place that is obvious – such as in the settings of the menu item pointing to the search component.
To make things even more complicated, that setting cannot be changed in Joomla’s backend, but rather in the language file (in other words, you’ll need to do some coding). So, if you want to change the maximum search limit (and assuming that you have only one language on your website, which is English), then here’s how you do this:
- You open the file en-GB.localise.php located under the /language/en-GB/ folder.
-
In the function getUpperLimitSearchWord, you change the return value from 20 to 40 (for example). In other words, you change the following code:
return 20;
to
return 40;
-
You save the file and you upload it!
-
That’s it!
Now, one thing to mention, if you have other languages then you need to do the same steps above for each one of them (for example, if your website has a French version, then you will need to do the above modifications to the file fr-FR.localise.php located under the /language/fr-FR/ directory). If you don’t have the time to do this tedious job, then you can instead do the following change to a Joomla core file to make sure that all languages have the same search limit of your choice:
- Open the file language.php which is located under the libraries/joomla/language directory.
-
Just before this line (line 582):
if ($this-&upperLimitSearchWordCallback !== null)
add the following code:
return 40;
//where 40 is your new search limit -
Save the file and upload it back.
-
That’s it!
Note that Joomla’s search module, by default, has its maxlength set to 20 – that’s why you’re not able to enter more than 20 characters in the search field of that module. However, the good news is that the maxlength value comes from the function getUpperLimitSearchWord, which means that doing the above will automatically ensure that maxlength is changed to your value of choice (for example, if you changed the value to 40 then the maxlength value will be automatically 40).
Now, if the above hasn’t worked for you or if you don’t have the programming experience to do it – then why not contact us? We’ll fix the issue for you in the speed of light (well, a bit slower, but you get the point), we won’t charge you much, and we are the friendliest programmers on planet Earth – maybe even the whole solar system!
Note: If you want to increase/decrease the lower search limit, then just replace the word upper with lower in the above guide and you’ll be all set. For example, instead of changing the return value of the function getUpperLimitSearchWord, you will need to change the return value of the function getLowerLimitSearchWord.
到http://joomlacode.org/gf/project/jtranslation1_6/frs/?action=FrsReleaseBrowse&frs_package_id=5695下载最新的简体中文语言安装包
进入扩展管理,上传下载好的安装包(Upload & Install)
进入语言管理,将网站前台和后台的默认语言都设为zh-CN
大功告成
关于版本如何去掉底部版权信息也是比较纠结的,Google了好几下“如何去掉底部版
权信息”都没有搞定,原来自1.5版之后有些文件发生了变化,具体修改底部版权信息方法如下:
打开 /language/zh-CN/zh-CN.mod_footer.ini,在大约第 10 和 11 行,修改以下代码:
程序代码:
FOOTER_LINE1=Copyright?? %date% Open Source Matters.All rights reserved..<br />
FOOTER_LINE2=<a href= http://www></a> is Free Software released under the GNU/GPL License.
如果你的站点使用别的语言,那么选择对应语言的 xx-XX.mod_footer.ini 文件即可。
还有一些是这样的
MOD_FOOTER_LINE1="Copyright © %date% %sitename%. All Rights Reserved."
MOD_FOOTER_LINE2="<a href="/_QQ_" http://www.XX.org"_QQ_">XX!</a> is Free Software released under the <a href="/_QQ_" http://www.XX.org/licenses/gpl-2.0.html"_QQ_">GNU General Public License.</a>"
一般都在Language文件夹底下的ini文件,找到并删除它。
当然我删除的信息在en-GB.tpl_sj_joomla3.ini这个文件里,找到MOD_FOOTER_LINE1 删除即可。
还有一个Designed By XX 的标志老去不了,让我很烦恼,所以就开始找了,一直找到
templates\sj_joomla3\includes\yt_template.class.php这个文件才发现:
<div class="footer1"><?php echo $lineone; ?> Designed by <a target="_blank" title="Visit XX!" href="/ http://www.XX.com/">XX.Com</a></div>
这段代码一直在底部,既然开源嘛,就彻底点,全部删掉remove了。大功告成,整个世界清静了。
————————————————
版权声明:本文为CSDN博主「lllljz」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/lllljz/article/details/8851947