3

(update: it not a problem relate to uppercases) I think I found a bug but not sure which module is causing it. Maybe CCK...

I have a content type with the body field set (through manage display) to be shown as Trimmed to lenght: 400

Then I created a node with 2 paragraphs of text in the body . When I load the full view of the node the trimming only shows the first paragraph

the trimming works fine if I enter this text in the body:

some text, some text, some text, some text, some text, some text, some text, some text

the trimming also works fine if I enter this text in the body (notide that the second paragraph is a short paragraph)

both paragraph are shown
some text, some text, some text, some text, some text, some text, some text, some text

but only the first paragraph is shown if I enter this text in the body (notice that the second paragraph is longer)

only this paragraph is shown 
some text, some text, some text, some text, some text, some text, some text, some textsome text, some text, some text, some text, some text, some text, some text, some textsome text, some text, some text, some text, some text, some text, some text, some textsome text, some text, some text, some text, some text, some text, some text, some textsome text, some text, some text, some text, some text, some text, some text, some text

How can I solve this?

2
  • no one? some help please.
    – chefnelone
    Jun 5, 2012 at 14:07
  • 1
    what version of Drupal and views are you using? Is there anything else special about your setup? I can't replicate the problem you are having.
    – nmc
    Jun 5, 2012 at 19:35

1 Answer 1

1
+50

Your best bet is a custom formatter. Create a custom formatter with the custom formatters module:

The Custom Formatters module allows users to easily create custom CCK/Field Formatters without the need to write a custom module. Custom Formatters can then be exported as CTools Exportables/Features or Drupal API Formatters.

Once installed just write some php code and format and insert the particular text that you're looking for.

4
  • good idea, but using php to trim text with html tags could generate a trimmed text with unclosed tags. What do you think?
    – chefnelone
    Jun 6, 2012 at 15:50
  • Just strip all html tags with php's strip_tag. After that's done wrap the text with the <p> tag again.
    – chrisjlee
    Jun 6, 2012 at 17:26
  • I'm not familiar with the Custom Formatters module but if you're not doing anything special with the formatting and just want a plain text output with a character limit, you should be able to do this with just Views settings without any additional modules.
    – nmc
    Jun 6, 2012 at 19:19
  • @nmc I set the view to be styled as Content | Teaser. What you say would be useful if I had styled the views as Field, then I would have set the output for the body field.
    – chefnelone
    Jun 6, 2012 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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