Click here to Skip to main content
13,592,359 members
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 | Cookies | Terms of Service
Web03-2016 | 2.8.180618.1 | Last Updated 19 Jun 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

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