• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Link Forum > links open in new window

Jeremy

Well-known member
#8
You don't need to be a coder to learn a basic understanding of HTML. The link I provided explains the anchor tag, its attributes (including target) and even has an example that utilizes it. You posted a screenshot surrounding the correct code, so I'm treating this as a perfect opportunity for you to learn and I have provided all of the resources you need to experiment and get the link working the way you want.
 

Echelon

Active member
#9
You don't need to be a coder to learn a basic understanding of HTML. The link I provided explains the anchor tag, its attributes (including target) and even has an example that utilizes it. You posted a screenshot surrounding the correct code, so I'm treating this as a perfect opportunity for you to learn and I have provided all of the resource you need to experiment and get the link working the way you want.
Ok. I will figure it out. thanks for your help
 

Morgain

Well-known member
#10
I do know how to add target="_blank" in ordinary html.
But how to add this to a Link Forum?

The field for the URL is then subjected to a script, which surrounds it with the html a href etc, including the quote marks around the actual URL.
So just adding target="_blank" on the end of the URL line does not work (I tried just in case).
Other attempts like inserting the quote marks around the URL to make it more complete, unsurprisingly throw an error.

Above on this thread Jeremy clearly knows this can be done. How please?
 

Jeremy

Well-known member
#11
I do know how to add target="_blank" in ordinary html.
But how to add this to a Link Forum?

The field for the URL is then subjected to a script, which surrounds it with the html a href etc, including the quote marks around the actual URL.
So just adding target="_blank" on the end of the URL line does not work (I tried just in case).
Other attempts like inserting the quote marks around the URL to make it more complete, unsurprisingly throw an error.

Above on this thread Jeremy clearly knows this can be done. How please?
Mike explained it in the second post:
You would need to modify the templates that link to these forums (node_link_level_*).
 

Morgain

Well-known member
#12
Thanks Jeremy. I got there.
For anyone else not confident on this here's the code:

Go to template node_link_level_2
Count 8 lines down, and insert the blue bit of code where it's shown below.

Code:
<div class="nodeInfo linkNodeInfo">
        <span class="nodeIcon"></span>

        <div class="nodeText">
            <h3 class="nodeTitle"><a href="{xen:link link-forums, $link}" target="_blank" data-description-x="#nodeDescription-{$link.node_id}">{$link.title}</a></h3>
            <xen:if is="{$link.description}"><blockquote class="nodeDescription muted baseHtml" id="nodeDescription-{$link.node_id}">{xen:raw $link.description}</blockquote></xen:if>
        </div>      
    </div>
The only drawback is this means that ALL link forums will open the link in a new page.
 

51463

Well-known member
#14
Hello. This works if the link forum is in the node tree but not for the Navigation Bar.

I disabled the link forum and kept it just in the Nav Bar.

Where exactly do i modifiy it? I cant find the correct template for the nav bar links.
 
#17
Hi Guys,
I followed the process and it works, HOWEVER when the link is clicked from the main page it still opens in the same page instead of opening in a new tab