After upgrading drupal from 5.x to 6.x including views 2 and ed_readmore, the "read more ... " is'nt shon anymore in custumised views. Is there a trick to get it work even with those new created views?

Or is there an other way to in views 2 to get a "read more ..." link inline at the end?

Comments

vm’s picture

Title: Does er_readmore works with custumised views 2 in drupal 6.x? » Does ed_readmore works with custumised views 2 in drupal 6.x?
stattler’s picture

In Drupal 6 and views 2, you could just add a field "Node:link" and then edit the configuration form the way you like.

Configure field Node: Link
You can add
Label:
Text to display:

It works. It can be placed inline by setting the Row Style as "inline".

todd nienkerk’s picture

Title: Does ed_readmore works with custumised views 2 in drupal 6.x? » Does Read More work with customized Views 2 in 6.x?
Rob T’s picture

Thanks for the nifty tip.

kdebaas’s picture

Status: Active » Fixed

The module works as expected in Views 2. However, be sure to select, in the Views basic settings: "Row style: Node", and then Build format: teasers, instead of "Row style: Fields".

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jeffschuler’s picture

Status: Closed (fixed) » Active

It would be nice to have consistent Read More functionality when using Views with fields.

Couldn't ed_readmore append the Read More link in the Teaser field when using Row Style: Fields?

Or if ed_readmore can't modify that field, maybe it could add a Views field called Teaser with Read More link?

roborracle’s picture

kdebaas - This worked perfectly for what I'm trying to do - thanks for the tip!

momper’s picture

@7 yes good idea

mpotter’s picture

Subscribed. I would also like to see #7 added. I'm getting really annoyed that Views doesn't already have an option for handling the Read More link properly and only displaying it when the teaser and body are different. Since Views is not going to get "fixed" for D6, adding this feature to the Read More module would be a *great* solution for me.

rickupdegrove’s picture

I wanted a "Read more..." link in some views feeds I just created.

After trying a lot of things, like this module. I found out I didn't need it.

Output this field as a link
and I used [view_node] in the "Link path:"

It was invalid XHTML because of the issue here http://drupal.org/node/501692

(I also tried all the suggestions on that page to get a proper "Read more..." link)

Several hours later I remembered a site I built a year ago has this feature

When I use Views in D6, In Fields this is what I do...

Add "Node: Link"
In "Text to display:" I use
Read more...

That is *all* I have to do to get SEO friendly "Read More" links in "Views".

held69’s picture

I believe this solution can work but what if the read more link is optional.
Some content published by users might be within the maximum amount of characters that is set for "teaser length".
Then a read more link wouldn't be of any use.

Isn't there a more dynamic solution?

hedac’s picture

#12 I think we should have to use some php to compare teaser with body.. and if the are different.. then print the read more. But that would be using views templates... and then.. what is the purpose of read more module then? I think this module should have to take care of that.. providing a views field called read more.

todd nienkerk’s picture

Status: Active » Postponed

Views has pretty robust tools for creating "read more" links, so I'm not sure it's worth the effort of creating a views handler for this module to supply something Views does out of the box.

I'm marking this "postponed" until someone can supply a use case in which this isn't a feasible solution.

dkingofpa’s picture

Category: support » feature

Restating as a feature request:
Would like to have a "read more" link inline with the teaser for both nodes and views. If the node body content is less than the maximum teaser length, the "read more" should not display.

@Todd Nienkerk
Could you point out where Views does the inline optional read more link "out of the box"?

If I'm missing something, please let me know.

nonzero’s picture

Version: 6.x-3.0 » 6.x-5.0-rc7
Component: Miscellaneous » Code
Status: Postponed » Active

#2 suggests adding a Node: link field and set it to display inline. This doesn't work if the teaser contains a <p> tag, as it just pushes the link down where the next paragraph would start.

Thus, Views does not provide a way to inline the read more link immediately after the teaser.

If someone can point out where in the code Views retrieves a teaser, I can try to fix this.

Desertgirl’s picture

I am having the exact same issue. I have a view where some articles are long and others are very short. The "node:link" option in views provides a "read more" link for every item in the content type, whether needed or not.

The solution in #5 above might have worked except that I have fields on my content type that I wish to keep from displaying. So that does not work either.

Any suggestions would be much appreciated.

sc0tt30’s picture

I agree with others that using the approach in #5 doesn't satisfy some needs. I had fields set up to display a document category above the title, but that doesn't work in Node formatting. And having a more link on all teasers isn't satisfactory because some entries are short enough there is no "more". But these I recognize as limitations with what is a very useful module, so I can live with that.

More significantly, I don't see anything about that in any of the documentation about views. It seems like an important thing to note--if you use fields, you won't get a "more" link on a teaser. I've searched for something like this thread for days, without putting together just the right search terms to get me here. For a while I didn't even realize that Views was responsible for missing 'more' links, and ed_readmore didn't help. So maybe there is something I can do to add a little more to the Views docs (although being new to drupal I'm not sure how to go about it).

kendouglass’s picture

The module works as expected in Views 2

I would argue that, since most people use the fields row style, this limitation is not what they expect.

I too would love it if this module could also work in "Row style: Fields." I hope you look into adding this capability.

jeni_dc’s picture

When using views fields, if you're using a custom template for your row style you can add a read more link manually that will not drop down if you have a closing p tag as mentioned in #16.

Here's an example of a views setup with fields: Add your content field to your view and trim it to the length you want in the field settings. Set it up so html is allowed and closing tags will be added, that's what's giving us the closing p tags. Add a Node: Link field to your view, enter whatever text you want to show up.

In your template print this out like so:

// find the position of the last closing p tag
$start = strrpos($fields['field_content_value']->content, '</p>');
// format the read more link - basically just adding a space before the link
$replacement = ' ' . $fields['view_node']->content;
// add the read more link before the last closing p tag in the content
print substr_replace($fields['field_content_value']->content, $replacement, $start, 0);

Make sure to rename your fields as appropriate.

gbirch’s picture

Version: 6.x-5.0-rc7 » 6.x-5.x-dev

As an alternative for people who use fields in their view, if you have or install the Views Custom Field module (http://drupal.org/project/views_customfield), you can create a quick fix with PHP. This fix is similar to the "hard workaround" mentioned in #15 above.
1. Add the Node: Body to the list of fields, but exclude it from the display. You need this for the customfield to work.
2. Create a PHP customfield and insert the following code (or similar):

if ($data->node_revisions_teaser != $data->node_revisions_body) echo '<a href="/node/' . $data->nid . '">Read more...</a>';

3. Move this field in the list to display wherever you like.