Joomla 在我的组件内编码我的链接目标 [英] Joomla encodes my link targets inside my component

查看:14
本文介绍了Joomla 在我的组件内编码我的链接目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

搜索了一段时间.我正在使用最新的 Joomla 版本 3.3.6(带龙门框架),并试图为它创建一个自己的组件.我遇到的问题是:我需要使用包含空格等特殊字符的链接.Joomla 似乎对这些链接进行了编码或重写,并用 HTML 代码替换了特殊字符.

Searched for a while now. I'm using newest Joomla Version 3.3.6 (with Gantry Framework) and am trying to create an own component for it. The problem I have is: I need to use links that contain special characters like spaces. Joomla seems to encode or rewrite these links and replaces the special characters with HTML code.

我的组件视图文件中的示例(硬编码):

Example out of my components view file (hard coded):

<a href="index.html#test like" title="test like">test like</a>

在前端打开时变为:

<a href="index.html#test%20like" title="test like">test like</a>

我现在正在寻找执行此技巧"以解决此行为的函数,但还找不到.希望有人能帮助我.

I'm now looking for the function that does this "trick" to hack this behaviour out of it, but can't find it yet. Hope someone can help me.

推荐答案

空格是 URL/URI 中的不安全字符,因此需要进行编码.这是因为在某些用途(尤其是多个空格)中可能会丢失重要的空格序列.

Spaces are unsafe characters in URLs/URIs and therefore need to be encoded. This is because significant sequences of spaces may be lost in some uses (especially multiple spaces).

当一个空格被编码时,它会变成十六进制的 %20.这是正确的行为,您不应尝试更改,因为这会使您的 URL/URI 不安全.

When a space is encoded it becomes %20 in hex. This is behaviour that is correct and you should not try to change as it will make your URL/URI unsafe.

有关不安全和保留字符的更多信息,请查看以下链接.

For more information about unsafe and reserved characters check out the following links.

http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

http://perishablepress.com/stop-using-unsafe-characters-in-urls/

这篇关于Joomla 在我的组件内编码我的链接目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆