Image Block - External Link

Permalink
Hi,
I'm using the Image Block to utlisize the Image on State function and have linked the image to an external file but I want to have it opening in a new browser window. How can I add the target="_blank" to this?

THanks.

anete
 
enlil replied on at Permalink Reply
enlil
in the last few lines of the image block controller.php file you will see something like:

$img = "<a href=\"{$linkURL}\">" . $img ."</a>";

change it to:

$img = "<a target="_blank" href=\"{$linkURL}\">" . $img ."</a>";
anete replied on at Permalink Reply
anete
Thanks Enlil,

I downloaded the file into my directory, but the controller.php doesn't have any code it it, just this:

<?php
defined('C5_EXECUTE') or die("Access Denied.");
class ImageBlockController extends Concrete5_Controller_Block_Image {


}

Any other ideas?

Annette
A3020 replied on at Permalink Best Answer Reply
A3020
You can also create a template file in /blocks/image/templates/link_blank.php or in /blocks/image/view.php

with the following contents:
<?php
defined('C5_EXECUTE') or die("Access Denied.");
echo str_replace('<a href', '<a target="_blank" href', $controller->getContentAndGenerate());
anete replied on at Permalink Reply
anete
Thanks akodde, that worked!

Kind regards...Annette