Copy link to clipboard
Copied
Question:
Is it possible to add a target attribute to a link that appears in a BC dynamic menu? I'm adding a few things to external sites and want a new tab / window opened ("_blank") rather than the default ("_self" ) behavior. Can this be done?
Answer:
If you go to Site Settings -> Menu -> select a menu and then click on the menu item you want to open in a new window, you'll find a Target Frame field on that page. You need to place _blank into that field and it will be rendered on the frontend as a target="_blank" attribute.
Copy link to clipboard
Copied
Hi Mario,
I have my two links in my menu that need to open in a new window and in the Target frame field I have placed _blank but it still opens in the same window, any idea on what may be causing it?
my site: clawmoney.businesscatalyst.com
the two menu items that need to open in a new window: "BLOGUE" and "CLAWFEE TALK"
Copy link to clipboard
Copied
Hey there..
Couple of questions..
- Did you use the Version 2 menu module?
- You using the menu module at all?
The way that menu is html and javascript is does not appear to be using the BC menu module. When you change a link or text in the admin is your menu updating?
If it is the Version 2 you need to update the menu layout to include that.
Copy link to clipboard
Copied
Hi Liam,
Thank you for the quick reply, I'm not sure what version of the menu module I'm using, I attached a picture of what it looks like below
I entered _blank in the target frame field for the menu item that I want to open in a new window and it shows as saved. How do I update the Version 2 menu?
Copy link to clipboard
Copied
Hey, I mean in terms of your HTML Templates.
I am guessing your not using that at all and its manually entered into the html.
If you do not see something along the lines of {module_menu} but just html with a <div id="nav">and a ul li element with menu items in it then its just static.
You would have to update the templates with the correct menu module tag which has the right ID for the menu and then you would need to update the CSS and javascript too so it all works.
If it turns out the module is in there but has a bit like version="2" I can then show you what you need to update there.
Have a look in your templates around where the menu is in the HTML, what do you see?
Copy link to clipboard
Copied
I looked into the html of my page template and here's what I found:
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal helvetica; color: #777777;"><span style="line-height: 12px; font-family: helvetica, arial, sans-serif; color: #000000;">{module_menu, version="2", menuId="906940", moduleTemplateGroup="Default"}</span></p>
Copy link to clipboard
Copied
I know this is old, but in case someone else needs to know how to fix this...
In the "Develop" tab or FTP, navigate to:
- ModuleTemplates
- Menu
- Default
- childitem.html
and add this to the <a> tag:
target="{tag_menuitemtargetframe}"
Copy link to clipboard
Copied
Very helpful fix to this bug!
Copy link to clipboard
Copied
No bug. That is not valid XHTML so if you use the V2 menu option you choose to include it or not.
Copy link to clipboard
Copied
Thanks! This helped me a lot.
Copy link to clipboard
Copied
Thanks psteil,
It works
Copy link to clipboard
Copied
psteil,
This is what my code looks like:
<li {tag_menuitemidname_withid} {tag_menuitemcssclass_withclass}><a href="{tag_menuitemurl}">{tag_menuitemlabel}</a>{tag_menugroup}</li>
Can you explain where exactly the target="{tag_menuitemtargetframe}" should be inserted? I tried and couldn't get it to work.
Thank you.
Copy link to clipboard
Copied
Just thought I'd share our childitem.html so you can see where to put the target="{tag_menuitemtargetframe}" which needs to be placed within the <a> tag. Hope this helps T Kellen :]
<li {tag_menuitemidname_withid} {tag_menuitemcssclass_withclass}><a href="{tag_menuitemurl}" target="{tag_menuitemtargetframe}">{tag_menuitemlabel}</a><ul class="dropdown">{tag_menugroup}</ul></li>
Copy link to clipboard
Copied
that code screwed up my entire menu
Copy link to clipboard
Copied
Great fix PSteil - thanks very much :]
Copy link to clipboard
Copied
Thank you! I always forget the fix and glad you posted it here!
Copy link to clipboard
Copied
Things are very different these days as you have liquid markup, none of the issues or limitations in this thread apply any more. This thread is from 2012.