Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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}" ?>
Posted
Updated 19-Jun-17 9:17am

1 solution

<a> - HTML | MDN[^]
See _blank value for target attribute...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900