Hi

I've used Views to create a page which displays a series of posts (trimmed). How do I set up the automated insertion of a 'read more' link to take users to the full post?

Cheers for any help

Comments

limehouse’s picture

thanks

elvis2’s picture

Hi limehouse, When building a view and block, you should see a checkbox with "[More] Link?" below the "nodes per block" section. Tick that box and clear your cache.

===
Elvis McNeely
Drupal services: http://www.elvisblogs.org/drupal

Jeff Burnz’s picture

I think Limehouse actually wants a "Read More" link for each post, not just a link to the Page view of the View.

So how to do that... read on...

In the list of Fields, look for "Node: View Link", select it and add it to your list of fields.

In the Options box, add the text "Read More..."

And you're done.

limehouse’s picture

Great. That is exactly it.

Do have two more questions though. Can I place this 'read more' link at the end of the post - rather than a new line? And the link seems to have a different style (larger font) than the rest of the node. I had the same issue with text in another CCK field for this node. Is this something people come across or is it just my (Marinelli) CSS?

No problem if you can't answer, you have been a gret help already.

Cheers

Jeff Burnz’s picture

You can style it with CSS, you'll need to hunt through the HTML or use something like Firebug to identify the selector and write a style for it.

The more powerful way is to completely over ride the Views output using the Views Theme Wizard - there plenty of info about that on this site already, and its a fairly self explanatory process anyway. That way you can write your own HTML quite simply in the views template that get generated by the Wizard.

limehouse’s picture

will try and theme Views output...!

cheers

elvis2’s picture

Opps, missed that completely.

===
Elvis McNeely
Drupal services: http://www.elvisblogs.org/drupal

limehouse’s picture

McNeely

binford2k’s picture

That doesn't give you a drupal read more link. It's not styled the same as other read more links and it shows up regardless of whether there's more content or not. Not a good solution.

The only way I can see to do that is to make the row style "Node" but that takes away the ability to alter fields. I don't have a solution for this.

Jeff Burnz’s picture

Yea, it is a good solution for the vast majority of use cases, and say for example, when you're not printing the teaser, but rather a custom summary field instead. The original question did not require the "dont show the read more link if there's nothing more to read" feature of Drupal to be preserved. The solution fits the use case, clearly the user was satisfied with the result.

There's a very easy solution to your problem, don't print fields, print a node view of teasers and theme the output of the teaser in the node template. Simple.

You can style it any way you want - make it 3em and pink if you choose to do so.

Need help with IE?
Learn basic XHTML and CSS first.
Get smart with web specs.

binford2k’s picture

And the point of Views is to reduce the amount of code that goes into your themes.

Simple example, if I want to display post date as Time Ago, I could either check the box in Views and it *works* or I could calculate it in a template for every node that I want listed in that way and then put that template in every single theme affected. Which is more maintainable?

(I mentioned node listing in my post, don't you think that means I investigated that possibility?)

Jeff Burnz’s picture

I'd argue that one line of code in a preprocess function to set a variable and printing that variable in your node tpl is not un-maintainable, but rather best practice.

And the point of Views is to reduce the amount of code that goes into your themes.

Not in my experience. Theming Views usually results in a lot more code in the theme - many more lines in template.php and many templates as well, especially if you want semantic html and/or cleaning up redundant div containers that you don't need, you've got little choice.