Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have a view with no fields but a special format (An openlayer map). I would like to wrap the whole output (a map) with a static link. Typically I would like something like:

<div class="view-content">
    <a href="some static url">
        /*the map*/
    </a>
</div>

Is this achievable?

EDIT My view doesn't use fields, so I can't use custom texts fields. format

share|improve this question
add comment

1 Answer 1

There might be a couple of method to do this.

Using Views: you can add a "Custom Text" global field and add view content to it and wrap it on the link or you can "Rewrite results" on the same file and output the field as a link.

Using a template file: view let you have a custom template file for your view, so you can use it to wrap your view content with the link.

Using jQuery: you can do something like this:

$('div.VIEW-CLASS').click(function(){document.location.href='URL.COM';});

And that will wrap the view on a link.

See the images below to see how to add a "Custom text" field and how to make it a link:

Select custom text field

Select custom text

Add views fields into the custom text field and make it all a link

Add views fields into the custom text field

share|improve this answer
    
I cannot add a view to a custom text. I could add a view area to the header/footer, but not rewrite results. I also have tried to add the following snippet in the header/footer but it didn't work: <script language='Javascript'>$('div.openlayers-views-map').click(function(){document.lo‌​cation.href='/somedir';});</script> . Is that the correct way to insert it? Thank you! –  NathanZ Sep 3 '12 at 14:59
    
I updated the answer with images. Please take a look. –  redhatlab Sep 3 '12 at 20:58
    
Thank you Redhatlab, my view doesn't use fields and I cannot transform it in fields as it's a map... –  NathanZ Sep 4 '12 at 0:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.