Hi wanze,
I am trying to use the MenuBuilder module for the past one week along with smarty template..
The below is used in header.tpl (smarty template)
<nav class="menu">
{$menu = $modules->get("MarkupMenuBuilder")}
{$menu->render('testmenu')}
</nav>
I am able to generate the menu but without being able provide css class for the submenus,
however as soon i add $options as mentioned in MenuBuilder docs like below
<nav class="menu">
{$options = array(
'wrapper_list_type' => 'ul',
'list_type' => 'li',
'menu_css_class' => 'type-1',
'submenu_css_class' => 'dropmenu',
'current_class' => 'active',
'default_title' => 0,
'include_children' => 4,
'm_max_level' => 1,
'current_class_level' => 1,
)}
{$menu = $modules->get("MarkupMenuBuilder")}
{$menu->render('testmenu', $options)}
</nav>
i get this error
Notice: Trying to get property of non-object in D:\xampp\htdocs\pw\site\modules\TemplateEngineSmarty\TemplateEngineSmarty.module on line 145
Fatal error: Exception: Syntax error in template "D:\xampp\htdocs\pw\site\templates\views\partials\header.tpl" on line 16 "'wrapper_list_type' => 'ul'," - Unexpected " => ", expected one of: "","" , ")" (in D:\xampp\htdocs\pw\site\modules\TemplateEngineSmarty\TemplateEngineSmarty.module line 109) #0 D:\xampp\htdocs\pw\site\modules\TemplateEngineFactory\TemplateEngineFactory.module(100): TemplateEngineSmarty->render() #1 D:\xampp\htdocs\pw\wire\core\Wire.php(459): TemplateEngineFactory->hookRender(Object(HookEvent)) #2 D:\xampp\htdocs\pw\wire\core\Wire.php(333): Wire->runHooks('render', Array) #3 D:\xampp\htdocs\pw\wire\modules\Process\ProcessPageView.module(187): Wire->__call('render', Array) #4 D:\xampp\htdocs\pw\wire\modules\Process\ProcessPageView.module(187): Page->render() #5 [internal function]: ProcessPageView->___execute(true) #6 D:\xampp\htdocs\pw\wire\core\Wire.php(398): call_user_func_array(Array, Array) #7 D:\xampp\htdocs\pw\wire\core\Wire.php(333): Wire->runHooks('execute', Array) #8 D:\xampp\htdocs\pw\ind in D:\xampp\htdocs\pw\index.php on line 248
Error: Exception: Syntax error in template "D:\xampp\htdocs\pw\site\templates\views\partials\header.tpl" on line 16 "'wrapper_list_type' => 'ul'," - Unexpected " => ", expected one of: "","" , ")" (in D:\xampp\htdocs\pw\site\modules\TemplateEngineSmarty\TemplateEngineSmarty.module line 109)
#0 D:\xampp\htdocs\pw\site\modules\TemplateEngineFactory\TemplateEngineFactory.module(100): TemplateEngineSmarty->render()
#1 D:\xampp\htdocs\pw\wire\core\Wire.php(459): TemplateEngineFactory->hookRender(Object(HookEvent))
#2 D:\xampp\htdocs\pw\wire\core\Wire.php(333): Wire->runHooks('render', Array)
#3 D:\xampp\htdocs\pw\wire\modules\Process\ProcessPageView.module(187): Wire->__call('render', Array)
#4 D:\xampp\htdocs\pw\wire\modules\Process\ProcessPageView.module(187): Page->render()
#5 [internal function]: ProcessPageView->___execute(true)
#6 D:\xampp\htdocs\pw\wire\core\Wire.php(398): call_user_func_array(Array, Array)
#7 D:\xampp\htdocs\pw\wire\core\Wire.php(333): Wire->runHooks('execute', Array)
#8 D:\xampp\htdocs\pw\ind
This error message was shown because site is in debug mode ($config->debug = true; in /site/config.php). Error has been logged.
I am not sure what i am doing wrong here ??
The errors seems to be about how i am calling the options using the smarty tags