Can not get left menu to show on right page

I try to make a new module and got most going right but I can not get the left menu to show up at the “new” module page it keep showing up at the first page (Home) when I refresh it here is a snip of the $this->menu array:

$this->menu = array(); // List of menus to add
$r=0;
// Add here entries to declare new menus
// Example to declare a new Top Menu entry and its Left menu entry:
/* BEGIN MODULEBUILDER TOPMENU */
$this->menu[$r]=array(‘fk_menu’=>’’, // ‘’ if this is a top menu. For left menu, use ‘fk_mainmenu=xxx’ or ‘fk_mainmenu=xxx,fk_leftmenu=yyy’ where xxx is mainmenucode and yyy is a leftmenucode
‘type’=>‘top’, // This is a Top menu entry
‘titre’=>‘JOB’,
‘mainmenu’=>‘jobs’,
‘leftmenu’=>‘1’,
‘url’=>’/jobs/jobsindex.php’,
‘langs’=>‘jobs@jobs’, // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
‘position’=>1000+$r,
‘enabled’=>‘1’, // Define condition to show or hide menu entry. Use ‘$conf->mymodule->enabled’ if entry must be visible if module is enabled.
‘perms’=>‘1’, // Use ‘perms’=>’$user->rights->mymodule->level1->level2’ if you want your menu with a permission rules
‘target’=>’’,
‘user’=>0); // 0=Menu for internal users, 1=external users, 2=both
/* END MODULEBUILDER TOPMENU */
$r++ ;//1
// Example to declare a Left Menu entry into an existing Top menu entry:
// BEGIN MODULEBUILDER LEFTMENU MYOBJECT
$this->menu[$r]=array(‘fk_menu’=>‘r=0’, // ‘’ if this is a top menu. For left menu, use ‘fk_mainmenu=xxx’ or ‘fk_mainmenu=xxx,fk_leftmenu=yyy’ where xxx is mainmenucode and yyy is a leftmenucode
‘type’=>‘left’, // This is a Left menu entry
‘titre’=>‘New Job’,
‘mainmenu’=>‘jobs’,
//‘leftmenu’=>‘jobsmenu’,
‘url’=>’/jobs/jobs_card.php’,
‘langs’=>‘jobs@jobs’, // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
‘position’=>1000+$r,
‘enabled’=>’$conf->jobs->enabled’, // Define condition to show or hide menu entry. Use ‘$conf->mymodule->enabled’ if entry must be visible if module is enabled. Use ‘$leftmenu==‘system’’ to show if leftmenu system is selected.
‘perms’=>’$user->rights->jobs->create’, // Use ‘perms’=>’$user->rights->mymodule->level1->level2’ if you ant your menu with a permission rules
‘target’=>’’,
‘user’=>0); // 0=Menu for internal users, 1=external users, 2=both
$r++ ;// 2


Any ideer what I’m doing wrong ??

For the left menu part, try:

// Example to declare a Left Menu entry into an existing Top menu entry:
// BEGIN MODULEBUILDER LEFTMENU MYOBJECT

$this->menu[$r]=array('fk_menu'=>'fk_mainmenu=jobs',
'type'=>'left', // This is a Left menu entry
'titre'=>'New Job',
'mainmenu'=>'jobs',
'leftmenu'=>'',
'url'=>'/jobs/jobs_card.php',
'langs'=>'jobs@jobs',
'position'=>100,
'enabled'=>'1',
'perms'=>'$user->rights->jobs->create',
'target'=>'',
'user'=>2);
$r++ ;

Try starting with that and if it shows then make further adjustments. Hope it helps, sorry if it doesn’t.

Hmm… that did not work…
I tried to use the “modulebuilder” and it works !! I now have the right left menu at the right page (new module) !?

I compare the two core/modules/(name).classe.php files and they looks the same but gives different result??
So could it be a DB setup thing ?

Is like the leftmenu part is not loaded at all

well my bad, that is the problem with just cut and past my first module up :whistle:
The proble was I had the line:
if (! ((GETPOST(‘testmenuhider’,‘int’) || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)))
{
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
}

In top of the page !! ANd I do not just it and the note is clear ; "Force hide left menu !! :laugh:
so remove that line or set $conf->dol_hide_leftmenu = 0 make the menu appear.

Thanks, @aljawaid for you fast respond

same problem i’m getting for left menu not appearing after creation new module and have code like

$this->menu[$r++]=array( ‘fk_menu’=>‘fk_mainmenu=bedward’, // ‘’ if this is a top menu. For left menu, use ‘fk_mainmenu=xxx’ or ‘fk_mainmenu=xxx,fk_leftmenu=yyy’ where xxx is mainmenucode and yyy is a leftmenucode
‘type’=>‘left’, // This is a Left menu entry
‘titre’=>‘List MyObject’,
‘mainmenu’=>‘bedward’,
‘leftmenu’=>‘bedward_myobject_list’,
‘url’=>’/bedward/myobject_list.php’,
‘langs’=>‘bedward@bedward’, // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
‘position’=>1000+$r,
‘enabled’=>’$conf->bedward->enabled’, // Define condition to show or hide menu entry. Use ‘$conf->bedward->enabled’ if entry must be visible if module is enabled. Use ‘$leftmenu==‘system’’ to show if leftmenu system is selected.
‘perms’=>’$user->rights->bedward->create’, // Use ‘perms’=>’$user->rights->bedward->level1->level2’ if you want your menu with a permission rules
‘target’=>’’,
‘user’=>2);