CMENU HTML5 OUTPUT

Hello,

First time using Yii and I’ve watched about 3 hours of videos on it so far but none of them have touched upon customizing widgets etc. Is it possible to have CMenu output just links without the list item tag so that is just works with the html5 <nav></nav> tags? I would prefer not to modify the framework is there an override?

nav tag don’t comes instead of ul and li…

it comes instead of the div that warps the menu

I don’t understand, I believe you mean it should be

<nav>

<ul>

<li><a href="#">Something</a></li>

</ul>

</nav> ?

That’s not so, the nav tag can position the links inline with just:

<nav>

<a href="#">Something</a>

</nav>

Here are references:

w3schools. com/html5/tag_nav.asp

Source: dev.w3. org/html5/spec/Overview.html#the-nav-element

:rolleyes:

You will need to override CMenu methods: renderMenu(), renderMenuRecursive(), probably renderMenuItem()… You can just copy CMenu source code and modify lines like:




echo CHtml::openTag('li', $options);



Or you can catch an output and preg_replace ul/li tags, but it will be a very ugly way :lol:

Thanks andy_s I looked up Rendermenu on Google and found this: how-to-customize-cmenu-output!! shows how to do it perfectly.