nwrightau VIP
Total posts: 99
27 Sep 2014 02:06

Using the records module to list teasers of some content, it just cuts the content off - sometimes mid sentence. I'd like to add '...' whenever this happens, where abouts can I do this?

Last Modified: 09 Apr 2018


pepperstreet VIP
Total posts: 3,837
28 Sep 2014 00:57

Can you give some more details, please?

  • Maybe a screenshot can help. Is the cutoff "programatically" or "visually"?
  • What type of field is your "intro text". i.e. Title, Text field, TextArea field, HTML field
  • Do you use a certain field output template?
  • Do you use a certain list template?

nwrightau VIP
Total posts: 99
28 Sep 2014 01:52

pepperstreet Can you give some more details, please?

  • Maybe a screenshot can help. Is the cutoff "programatically" or "visually"?

Pretty simple, I just want to:

  1. Strip out formatting (paragraphs are coming through)
  2. Where the characeter cut off is, add '...'
  • What type of field is your "intro text". i.e. Title, Text field, TextArea field, HTML field

Just a HTML field.

  • Do you use a certain field output template?* Do you use a certain list template?

Yes custom template based on simple list.


pepperstreet VIP
Total posts: 3,837
28 Sep 2014 15:08

Thanks for answering my questions ;) Much more clearer now.

nwrightau Strip out formatting (paragraphs are coming through)

You want to strip out any formatting? Or keep the paragraphs?

Just a HTML field nwrightau

Did you checkout the "TextArea" field. It has already parameters for your needs.


pepperstreet VIP
Total posts: 3,837
28 Sep 2014 23:50

nwrightau Just a HTML field

You may set HTML field parameters to limit intro characters. Most likely you have done this already. Then turn on "ReadMore" button, and change the button text to dots "...". By default it will get a bootstrap button style. So, you might apply custom CSS classes in field params. Then adjust CSS styles for the module context only. (not impossible, but a bit cumbersome. There are a lot of unwanted CSS styles for DL lists and wrapping P-tags.)

Headsup / Drawbacks: If you use field parameters and output template, the changes do also apply to other occurrences. i.e. any other list view of your items.

Quick example with available field parameters and CSS. 20 characters limit and ReadMore button as "...":

Bildschirmfoto 2014-09-29 um 02.04.47

Result:

Bildschirmfoto 2014-09-29 um 02.00.01

nwrightau Yes custom template based on simple list.

This is a particular template for the module only?
Do you use Cobalt standard fields loop?

I think is best to output your field separately.
Then you can modify your HTML field output, and append the dots "...". Without affecting any other occurrences.


nwrightau VIP
Total posts: 99
29 Sep 2014 02:19

I fixed this myself using a custom template and some php. It's a standard feature in most other systems though - my thoughts are, if you're going to trim text down for a teaser - the html formatting should be stripped [or optional] and it should end with ... so it doesn't look like the text is just cut off.


pepperstreet VIP
Total posts: 3,837
29 Sep 2014 20:21

nwrightau my thoughts are, if you're going to trim text down for a teaser - the html formatting should be stripped [or optional] and it should end with ...

Yep, I agree with you. Apparently it has been simply forgotten, due to the many other parameters and read-more functionality.


@Sergey / MintJoomla

  • Why not apppend the 3-dots permanently?! I think, text limit in TextArea field works like this. Would be nice to have it wrapped with SPAN-tags and CSS class.
  • The ReadMore button has Paragraph tags. IMHO, this extra markup is unnecessary. Positioning/LineBreak could be controlled by CSS only. More flexible.

Sergey
Total posts: 13,748
09 Apr 2018 09:33

pepperstreet @Sergey

Why not apppend the 3-dots permanently?! I think, text limit in TextArea field works like this. Would be nice to have it wrapped with SPAN-tags and CSS class.* The ReadMore button has Paragraph tags. IMHO, this extra markup is unnecessary. Positioning/LineBreak could be controlled by CSS only. More flexible.

Templates require serious refactor which I am going to do for Joomla 4. I'll adopt everything for BS4ю

Powered by Cobalt