Page attribute in Mega Menu package
Permalink
I need to add a "target=""" to the Mega Menu links. I have a few pages in my site I need to open in a new tab.
I have tested this
and it shows if a page has "_self" or "_blank" selected. What I need to do is insert that into the Mega Menu view into this piece..
No matter what I do it breaks the site.
Any help or ideas out there?
I have tested this
<?php $tags = $c->getAttribute('link_new_tab'); if ($tags && count($tags)) { ?> <div class="tags"> <div class="title"><span>Tags</span></div> <ul> <? foreach($tags as $tag) { ?> <li><a href="<?=URL::page($blog, 'tag', strtolower($tag))?>"><?=$tag?></a></li> <? } ?> </ul> </div> <? } ?>
and it shows if a page has "_self" or "_blank" selected. What I need to do is insert that into the Mega Menu view into this piece..
foreach ($navItems as $ni) { echo '<li class="' . $ni->classes . '">'; //opens a nav item if ( $ni->isPageLinked ) { echo '<a href="' . $ni->url . '" target="' . $ni->target . '" class="' . $ni->classes . '" accesskey="'.$ni->accesskey.'">' . $ni->name . '</a>'; } else { echo '<a href="#" class="' . $ni->classes . '" accesskey="'.$ni->accesskey.'">' . $ni->name . '</a>'; } if ( $ni->hasSubmenu ) { echo '<ul class="sub_menu pid-'.$ni->cID.'">'; //opens a dropdown sub-menu } elseif ( in_array($ni->cID, $areaIDs) ) { echo '<ul class="sub_menu pid-'.$ni->cID.'"></ul>'; //opens a dropdown sub-menu } else { echo '</li>'; //closes a nav item echo str_repeat('</ul></li>', $ni->subDepth); //closes dropdown sub-menu(s) and their top-level nav item(s) }
Viewing 15 lines of 16 lines. View entire code block.
No matter what I do it breaks the site.
Any help or ideas out there?
You could try changing it to suit your needs.
I read somewhere that target="new" is valid HTML whilst target="_new" is not valid HTML?