0

Possible Duplicate:
How do I access this object property?

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] => [urls_position] => [menu-anchor_title] => [menu-anchor_css] => [menu_image] => [menu_text] => 1 [page_title] => [show_page_heading] => 0 [page_heading] => [pageclass_sfx] => [menu-meta_description] => [menu-meta_keywords] => [robots] => [secure] => 0 )

That is the output of items after json-decode using print_r I would like to access the property menu-anchor_css but I can't do something like this

$items=json_decode($item->params);
$class = $items->menu-anchor_css ? 'class="'.$items->anchor_css.'" ' : '';
$title = $items->menu-anchor_title ? 'title="'.$items->anchor_title.'" ' : '';

As it always displays me error message that menu is not defined. (The hyphen and underbar seem problematic here)

Thank you alot

Community
  • 1
  • 1
Yabooo Yakhoo
  • 27
  • 1
  • 1
  • 5

0 Answers0