gpt4 book ai didi

php - joomla 1.7 访问 :protected menu params

转载 作者:可可西里 更新时间:2023-11-01 14:05:10 25 4
gpt4 key购买 nike

我想在 joomla 1.7 中访问菜单的 menu_image 参数

Normally I just use:
$currentMenuItem = JSite::getMenu()->getActive();

它给了我如下所示的所有参数,但是 params 对象中的数据已被 :protected 所以我无法访问 $currentMenuItem->params->data:protected->menu_image 因为我不能在对象中使用 :。

有人知道怎么做吗?

[params] => JRegistry Object
(
[data:protected] => stdClass Object
(
[show_title] =>
[link_titles] =>
[show_intro] =>
[show_category] =>
[link_category] =>
[show_parent_category] =>
[link_parent_category] =>
[show_author] =>
[link_author] =>
[show_create_date] =>
[show_modify_date] =>
[show_publish_date] =>
[show_item_navigation] =>
[show_vote] =>
[show_icons] =>
[show_print_icon] =>
[show_email_icon] =>
[show_hits] =>
[show_noauth] =>
[menu-anchor_title] =>
[menu-anchor_css] =>
[menu_image] => images/joomla_black.gif
[menu_text] => 1
[page_title] =>
[show_page_heading] => 0
[page_heading] =>
[pageclass_sfx] =>
[menu-meta_description] =>
[menu-meta_keywords] =>
[robots] =>
[secure] => 0
)

)

最佳答案

正如@tereško 所指出的:您扩展类并创建一个 getter 。好的 obv joomla allready 有一个 setter/getter :所以这里开始(例如获取 protected menu_image)

$currentMenuItem = JSite::getMenu()->getActive();
$currentMenuItem->params->get('menu_image', 'images/no-image.jpg');

关于php - joomla 1.7 访问 :protected menu params,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8486911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com