Here is the case.
I have a node-type containing a long title, short title and a text.

what I want in my views is the following:

overview:
- short title *anchor to long title*
- short title *anchor to long title*

- long title
-text

- long title
-text

to output those lists is no issue, but how do I manage to link short title one to long title one with an anchor?

Thanks in advance!

Comments

coreyp_1’s picture

One of my favorite things to remind people of in web design is that it is all smoke and mirrors.

What you basically need are 2 views (or, rather, 1 view display attached to another).

You will have to write the anchor tags yourself (as in the html), but use Views to your advantage (you may also need the Token module).

Basically, include a unique ID (such as the node id) in both views, then exclude it so that it is not printed. Add another field for the title. You can rewrite the output of this field to include both the title and the custom anchor tag. Use the node id token that is available to create the unique identifier.

In the second view (or display), do the same thing, rewriting the title field to include the correct (matching) name in an anchor tag.

I know this is difficult to follow using only text, but hopefully it will point you in the right direction.

Levdbas’s picture

Thank you so much, was wondering for a long time how to achieve this but it works now, thanks to you!

Ives’s picture

Just as a note: the field with a unique ID should be placed before the other fields, to be able to use it for rewriting

JoeKalucki’s picture

I have a similar issue, wondering if you could assist?

This is my staging site: http://staging.corpsite.alexanderstreet.com/products/nursing-education-video

On the right panel, you see some buttons for content, "Download PDF, Go to Product, etc."

I am now using a third party marketing tool to create forms, it comes with their own iframe code. The form is at the bottom of the aforementioned page.

A user won't stumble upon that form down there. My hope is to have a similar button on the right panel that will say "request a trial to this collection" and it will shoot a user down to the bottom of the page where the form is.

The form code can be the same across all product pages, it just has to live on the product page. When the form is filled out, it tells the sales rep which page it was filled out on, so they know which product the user was interested in.

Not really sure of my options here. In short, my goal is to have an easy call to action for requesting a trial, and the form lives on the product page. How can I achieve this?

I have the block created under "Download PDF". How do I get that to link to the bottom of the page where the form is? Is there a way to link to a field? the form is it's own field on this particular content type.

codemode01’s picture

... and many thanks for that tip.

Of course! Create an nid field in each view, hide it, then rewrite the titles with the appropriate anchor tags and the nid token.

This works well when targeting things like blog titles on a long blog page. Just create a blog-view-page to display all posts and then a blog-view-block to list their linking titles.

Great post.

ptocco’s picture

I'm trying to create pages of personnel listings by department. Each department has a View, and its own page. At the top should be a list of the personnel on that page. The instructions above sound perfect for me, except it's not entirely clear how to do it.

I have inserted a nid field into the view, made it hidden, and checked "link to content". From there the next step is to "rewrite titles with the appropriate anchor tags and nid token." How do I rewrite titles and add in the hidden nid token??

And from there, once the page is done, I could create a separate block of a view that listed just the title and nid fileds. Awesome indeed.

I wonder if this would be overwhelming to do using the Blocks page, or if I should use Context. Or may Panelizer.

Thanks in advance!