Slide Show Block Link Options

Permalink
Hi guys,

I'm using the slide show option to display several client logos. I would like to add links to their homepages, but I want them to target "_blank"
Would it be possible to add this as a general option to the block. I'm potentially not the only one facing this problem.

Is there an "easy" way to achieve this jsut right now?

Thanks
- Karl

 
JohntheFish replied on at Permalink Reply
JohntheFish
You can create a custom template from the view of the block. See
http://www.concrete5.org/documentation/how-tos/developers/change-th...

The only change you need to make is where the HTML for the link is inserted, where you can add 'target="_blank"' into the HTML.

Then back in C5 you just select the new template for the block.
KarlWecker replied on at Permalink Reply
Hi John,

actually I tried that. It didn't really work. I inserted the 'target="_blank"' into the HTML, but as a result the picture started to move down everytime the slide changed.

(Which to my opinion is totally stange behaviour)

I guess I'll live without that feature for now.

My question was more like "Why is there no option available in the basic block, shiped with the default concrete 5" , or in other words "WISH: Add the option, please"

When I was looking around the forum, I saw many people with similar requests. And as soon as I would like to have the "target="_blank" behaviour for only certain images, the "easy fix" gets a little more complicated.

I'm very much a friend of the possibility to overwrite, but I would really like to do that very rarely.

Thanks
- Karl
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
The slideshow block includes an empty javascript call attached to the click event of each slide. The javascript handler is by default empty, so the 'a' link tag should have taken priority.

(EDIT, I have cut a mistake I made out from here)

/root/blocks/slideshow/yourcustomview/view.php

As I said, I would have expected adding the target attribute in view.php to be all you needed and to leave the js alone.

Nevertheless, if you are on for a little experiemnt, you can try creating a custom view with the js modified (this time leave the php alone!)

In the override copy find amongst the js:
imgClick:function(linkURL){
  //override for custom behavior
},


And replace it with:
imgClick:function(linkURL){
  window.open(linkURL);
  return false;
},


PS. Yes, it could make a useful option for some. Many times when designing a block, the developer is faced with a balance between giving the user a complex set of options vs giving a simple set of options. Trying to give lots of flexibility, while keeping it all within the understanding of the typical user of the block.
KarlWecker replied on at Permalink Reply
Hi John,

well, that works great.

The trouble I've had before with the pictures appearing slightly underneath of each other ALSO happen, though.
The root of that problem is with the overwriting though.
If I upload only the view.php file, the error occurs

If I copy the whole block and overwrite all fiels of the entire block (by leaving the files unchanged but the view.php) the problem is gone.

- Karl
JohntheFish replied on at Permalink Reply
JohntheFish
Personally, if I was writing the slideshow block from scratch, I wouldn't have don it that way. I suspect that these days no-one from C5 would either.