如何获取用于 url 的后缀(在代码中)?
Magento 可以添加用户定义的后缀以附加到 url 上。我想从我的代码中获取该后缀。有谁知道一个简单的方法来做到这一点?
Magento can add a suffix that is defined by the user to append onto urls. I want to get that suffix from my code. Does anyone know an easy way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果它存储在配置区域中,则可以像访问任何其他配置值一样访问它,方法是使用定义了
$config_path
的Mage::getStoreConfig($config_path)
在定义它的模块的system.xml
中。如果您不确定
$config_path
,那么我通常会作弊并检查配置部分中的文本框/下拉列表,查看 id,例如dev_log_file
,并将其翻译为dev/log/file
。当有多个_
时,您需要使用一些智能:)If it's stored in the configuration area, then you access it just as you would any other configuration value, by using
Mage::getStoreConfig($config_path)
where$config_path
is defined in thesystem.xml
of the module that defines it.If you're not sure of the
$config_path
, then I usually cheat and inspect the textbox/dropdown in the configuration section, take a look at the id, e.g.dev_log_file
, and translate it todev/log/file
. You'll need to use some intelligence when there are multiple_
though :)尼克的回答很好,但这个问题的实际答案是:
Nick's answer is good but the actual answer to this question is:
如果我没记错的话,这是代码(因为我不明白您想要的URL想要什么)
If I am not mistaken, here is the code ( because I don't understand what you want with URL )
完整产品网址:
complete product url: