简体   繁体   English

如何将目标=“空白”添加到此PHP代码

[英]How to add target=“blank” to this php code

I have a link in code that looks like this: 我在代码中有一个看起来像这样的链接:

$tlink = JRoute::_( '/terms-and-conditions' );

Can somebody help me please, I want to add a target="_blank" attribute to this link... I tried different things I found on web like adding: 有人可以帮我吗,我想在此链接中添加target =“ _ blank”属性...我尝试了在网络上发现的其他事情,例如添加:

,array('target' => '_blank')

to the JRoute::_() but nothing changes... 到JRoute :: __()但没有任何变化...

Can somebody give me a hand please. 请有人帮我一下。 Thank you 谢谢


Here is how this link is further used: 这是进一步使用此链接的方法:

$terms = array ();
$terms [] = JHTML::_ ( 'select.option', 1, JText::sprintf ( 'I_AGREE', $tlink ), 'value', 'text' );

$lists ['terms'] = GHelper::checkbox ( $terms, 'terms_n_condtions', 'class="inputbox required" size="1"', 'value', 'text', 0 );

Is it not as simple as, 它不是那么简单吗?

<a target="_blank" href="/<?php echo JRoute::_('/terms-and-conditions'); ?>">LINK</a>


OR enclosing the link tag in a variable like, 将链接标记括在变量中,例如

$link = "<a target='_blank' href='".JRoute::_('/terms-and-conditions')."'>LINK</a>";

echo $link;  // will give you the markup of the link

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM