获得“参数"的简单方法从Joomla菜单表中 [英] Easy way to get "params" from Joomla menu table

查看:51
本文介绍了获得“参数"的简单方法从Joomla菜单表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Joomla不太了解,但是我正在尝试在Joomla网站上使用菜单.在数据库中,我可以在菜单表中看到一列名为params的列,其中包含一些我需要的数据. params列包含以下数据:

I don't know too much about Joomla, but I'm trying to work with a Menu on a Joomla site. In the Database I can see a column called params in the menu table, and it has some data I need. The params column has this data:

categories=446
feedLink=1
fusion_item_subtext=
fusion_columns=1
fusion_customimage=
splitmenu_item_subtext=
page_title=
show_page_title=1
pageclass_sfx=
menu_image=-1
secure=0

我知道我可以执行mysql查询,获取该列并使用字符串操作/正则表达式解析值,但这听起来不正确.

I know I can do a mysql query, get that column and parse the value using string manipulation/regex, but that doesn't sound like the right way.

我在Joomla中看到了一些类似以下的代码:

I have seen some code in Joomla that looks like:

$cid = $params->get('secure');

Joomla是否有一种特殊的查询和返回对象的方法,以便可以使用这种类型的语法访问这些参数?

Does Joomla have a special way to query and return objects so that these params are accessible with this type of syntax?

推荐答案

是的,Joomla确实有一种特殊的方法来获取基于JObject的易于访问的对象中的参数.

Yes, Joomla does have special way of getting the parameters in an easily accessible object based on JObject.

您可以使用此菜单获取整个网站菜单

you can get the entire site menu with this

$menu = JFactory::getApplication()->getMenu();
$item = $menu->getActive(); // will get active menu item. can use getItem() instead to get specific item
$item->get('parmName'); 

这不是精确的代码,更像是伪代码.这将使您走上正确的路...

This is not exact code, more like pseudocode. This will get you on the right track...

帮助资料:

  • Joomla Framework API
  • JMenu Documentation

这篇关于获得“参数"的简单方法从Joomla菜单表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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