By cabplan on
I have slideshow and a link field that I can add a URL to but I am having a hard time wrapping the link around the image. I added both fields (Link and Slider Image) to the View but not sure how to link the slider image to the link field. I tried to hard code in the Rewrite Result but not sure how to use the correct drupal code.
I would like to use the "Link Image to" option but all I get to choose from is Content or File, I want to be able to click the URL field I created, how would I do that?
Please help
Comments
Assuming you are using Views Slideshow…
Assuming you are using Views Slideshow, you can put your link first in the Views display, set it to "exclude from display" and "URL as plain text" as the format. Then you should be able to add the image (after it in the Views display fields) and set it to be "output as a link" with the link path set to the token for the first field's link URL (or alternatively rewrite the image field with an
<a>tagset withhref="[your_link_url]"wrapped around the token to display the image.Anyway, it's not that hard and you should have at least a couple ways to do it.
See you at the Drupalcon!
Hi LoMo, I have tried to
Hi LoMo, I have tried to follow your instructions but the link is still not being added around my image, I have my Link field first which is listed first in my fields and outputting as URL as plain text. I have set my image field to Output as a Link and put this code in the field:
<a href="[field_link]">[field_slider_image]</a>, does this look right? I check the code and nothing gets added, I have flushed the cache but still nothing. Let me know if I am missing anything.It looks like you are
It looks like you are combining the two methods I suggested.
1) output as link with [field_link] (provided that has been modified to be just the URL part) as the destination of the link
2) rewrite output (something like what you had)
Hope that helps get you sorted out. :-)
Save the View, get it on a page, and if it's not working as you want, inspect the HTML and figure out why not, and then tweak the View as necessary.
See you at the Drupalcon!
So I have tried your process
So I have tried your process but I still cannot wrap my slider image in the
<a href>tag. I have tried changing the Link Formatter to "URL as plain text" and "Title as plain text" but every time I add [field_link] to the Overwrite Results on the Slider Image it automatically adds the<a href>around the link and I do not know how to get the [field_image] inside the<a href>that automatically gets added. Am I explaining this fully. In the Slider_Image rewrite results box I put this in:[field_link][field_slider_image]
but when I view the preview I see the link as a
<a href>already but I want to put the [field_slider_image] inside the [field_link] somehow, I tried to use HTML entities but since the<a href>already outputs it messes everything up.It sounds like you are still combining the two approaches
1) You can put the link URL in as the destination for "output as link" (used on the image field).
OR
2) NO "output as link" and simply "rewrite output for this field" and use the tokens for the link URL and image to wrap the image in a link.
From what you describe now, it sounds like you are still somehow combining these two approaches, which would mean you have a double link, and that won't work.
Right now I don't have my dev machine available (guest sleeping in our home office), and we are going on day trips for the rest of the week, but next Monday, if you are still stuck on this, I'll create a Views slideshow with Drupal 7 and work with a use case similar to yours to illustrate the link building process.
Best of luck and I do hope this helps! :-)
See you at the Drupalcon!
Wow LoMo, after you wrote it
Wow LoMo, after you wrote it out again, I think I finally got it work, all I needed to do was list the Link field first then the Slider Image and then in the slider image settings change it to "Output as link" and put [field-link] in that field. I apologize for not catching on to your instructions soon. Thanks again for all your help, you are a god send.
Glad it finally works for
Glad it finally works for you. I'm happy to have helped and I know it can be a bit tricky coming to grips with Views, so no "apologies" necessary. :-)
See you at the Drupalcon!
Hi again LoMo, so I am trying
Hi again LoMo, so I am trying to accomplish something similar but it's not working. I have a photo gallery and I want the image title to be the link. I took the same approach and I did rewrite results with the [field_photo-title] but it does not work. It is using the Colorbox effect so I am putting this rewrite rule on Colorbox image formatter. Here my original Drupal post:
http://drupal.org/node/1567564
Do you think can help me with this as well?
I've responded to your new
I've responded to your new topic and I think it's different enough that we should keep discussion off of this thread, unless you are actually using Views slideshow.
See you at the Drupalcon!
Links
So When I follow the instructions above, I can have all the images go to one URL. Is there a way to make it so that each picture can go to a different URL?
=-=
Is there a link field associated with each image?
link field
I have learned recently about the need for a link field with each image. I was able to make a link in the caption of each image to different URLs, but not images. How would I do this under the views tab?
Thanks!
=-=
as explained earlier in this thread by utilizing views rewrite output and tokens.
linked slideshow
I have just wanted to link the slider like the image below. It w