在新标签/窗口中打开我的链接 [英] Make my links open in a new tab/window
问题描述
我有一个需要修改的CMS。我希望外部链接在新窗口中打开target =_ blank
下面是代码:
<?php foreach($ this->菜单为$ menu){?>
< a href =<?php echo $ menu-> type =='外部'?$ menu->链接:/ Index / Content / Id / {$ menu-> id}?>>
< b>我尝试了什么:
<?php echo($ menu-> type =='External')? {$ menu-> link} target = _blank:/ Index / Content / Id / {$ menu-> id}?>
I have a CMS that I need to modify. I want the external links to open in a new window target="_blank"
Heres the code:
<?php foreach ($this->menus as $menu) { ?>
<a href="<?php echo $menu->type == 'External' ? $menu->link : "/Index/Content/Id/{$menu->id}" ?>">
What I have tried:
<?php echo ($menu->type == 'External') ? "{$menu->link} target=_blank" : "/Index/Content/Id/{$menu->id}" ?>
推荐答案
this->菜单为
this->menus as
菜单){?>
< a href =<?php echo
menu) { ?>
<a href="<?php echo
>
menu-> type =='External'?
menu->type == 'External' ?
这篇关于在新标签/窗口中打开我的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!