2011-12-13 7 views
5

voglio accedere al parametro menu_image di un menu in Joomla 1,7joomla 1.7 accesso: menu protetto params

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

e mi dà tutti i parametri come di seguito, ma i dati nell'oggetto params è stata: protetta quindi non posso accedere a $ currentMenuItem-> params-> data: protected-> menu_image perché non posso usare: in un oggetto.

Any1 sa come fare invece?

[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 
       ) 

     ) 

risposta

6

Come @tereško ha sottolineato: estendere la classe e creare un getter. Bene obv Joomla ha giá un getter: quindi ecco qui (Prendi il menu_image protetta per esempio)

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

Grazie mille, ho lottato con questo in 2.5 troppo! –

Problemi correlati