Click here to Skip to main content
13,201,050 members (53,956 online)
Rate this:
Please Sign up or sign in to vote.
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 19-Jun-17 9:05am
Updated 19-Jun-17 9:17am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171020.1 | Last Updated 19 Jun 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100