open new window

Permalink
Hi this should be simple.

Ive placed an image block on a page and want the link to open a new window.

I cant see the way to do this with the block properties.

Any ideas? I suppose I could place the image in a content window and put a target blank in the html.

Is there a better way?

Nige

nige
 
Mnkras replied on at Permalink Reply
Mnkras
you can make a custom template basically the exact same code but changing a few lines. but that should be in the core
samuelbarney replied on at Permalink Reply
samuelbarney
I know some people have had issues with this if you open controller.php in image block file from ftp edit close to the bottom and add the code below only the target section but i added everything around it so you see it in use. If anyone needs any help with this or can't get it to work email me and I'll do my best to help... sam.barney@live.com


if($this->externalLink != ""){
            $img = "<a href=\"{$this->externalLink}\" \"target = '_blank'\">" . $img ."</a>";
         }
         return $img;
dpfels replied on at Permalink Reply
I had the same problem. However, I wanted to preserve the ability to use the 'image on' state (roll over image).

In the end, I created an image block with the two images. I then exited the edited page and looked at the source code for the page. I cut the HTML for the image block (with its rollover state) and pasted it into an HTML block (with the addition of the 'target=' statement).

Works perfectly.

The HTML looks (approximately) like this:
<a href="OUTLINK HERE" target="_blank"><img border="0" class="ccm-image-block" alt="ALT NAME" src="DEFAULT IMAGE NAME" width="XX" height="YY"  onmouseover="this.src = 'ROLLOVER IMAGE NAME'"  onmouseout="this.src = 'DEFAULT IMAGE NAME'" /></a>


Replace all of the CAPS with your information.
Hope this helps.
nige replied on at Permalink Reply
nige
Great support thanks guys

Nige
cursal replied on at Permalink Reply
cursal
Did this ever make it into the core?

Anyway to make it work in older versions..say 4.2.1

around line 97 of the controller for the Image Block I modified the code adding the blank tag:

if($this->externalLink != ""){
$img = "<a href=\{$this>externalLink}\" target=\"_blank\">" . $img ."</a>";
         }
         return $img;


but does NOT work..

have same question in this thread:
http://www.concrete5.org/community/forums/customizing_c5/how-to-hav...
Shotster replied on at Permalink Reply
Shotster
I just noticed there's no double quote after the href - i.e. no beginning double quote to enclose the URL. I wonder if that could be the problem.

-Steve