sc_appmenu_add_item Parameters

I can’t seem to find an example on parameters. I can “hard code” them but can’t seem to dynamically generate them based on data in an array. Perhaps just poor coding on my part! Probably so. Here’s my code.

sc_appmenu_reset(‘kb_tree’);
sc_appmenu_create(‘kb_tree’);

sc_appmenu_add_item(‘kb_tree’,‘home’, ,‘Home’, , , , , );
sc_appmenu_add_item(‘kb_tree’,‘search’, ,‘Search’,‘article_grid’, , , , );
sc_appmenu_add_item(‘kb_tree’,‘faq’, ,‘FAQs’,‘article_grid_view’,‘locale=3’, , , ); //hardcoded
sc_appmenu_add_item(‘kb_tree’,‘faq2’, ,‘FAQ2’,‘article_grid_view’,‘locale=1’, , , ); //hardcoded

sc_lookup(dsmenu,"
select
taxonomy_id,
parent,
description
from
article_taxonomy
order by
parent,
node_order");

foreach ({dsmenu} as $arr_menu) {
$id_item = ‘item_’.$arr_menu[0];

if($arr_menu[1] == 0){
	$id_parent = '';
}else{
	$id_parent = 'item_'.$arr_menu[1];	
}

$description = $arr_menu[2];
$params = ‘locale=’.$arr_menu[0];

sc_appmenu_add_item(‘kb_tree’,$id_item,$id_parent,$description,‘article_grid_view’,$params, , , );

}

It is dying at the $params insertion into the sc_appmenu_add_item that is dynamically built. Notice the FAQ at the top. These work properly. So, I can’t see what’s wrong. Any suggestions would be great.

-Tim

Re: sc_appmenu_add_item Parameters

I figure it out, just simple PHP. No sc_appmenu_add_item bugs here.

sc_appmenu_add_item(‘kb_tree’,$id_item,$id_parent,$description,‘article_grid_view’,‘locale=$arr_menu[0]’, , , );

Re: sc_appmenu_add_item Parameters

Hello,

You have some mistake in the parameters, for example the second parameter is a parent id and it usually is item_0, item_1 an so on.

look this video to have an idea
http://downloads.netmake.com.br/siteen/videos/videos_es/dynamic_menu/dynamic_menu.html