Invision Community 5: A video walkthrough creating a custom theme and homepage By Matt Thursday at 04:02 PM
Foxtrek_64 Posted November 3, 2020 Posted November 3, 2020 I have a custom page which displays an announcement database I have built (separate from the built-in announcements system). This database syncs with an announcements board where users may post comments. I am using the Category Articles template to display my announcements but I am not happy with how the truncation is working. By default, the template renders the data like so: <section class='ipsType_normal ipsType_richText ipsType_break ipsSpacer_bottom' data-ipsTruncate data-ipsTruncate-size='7 lines' data-ipsTruncate-type='remove'> {$record->truncated()|raw} </section> I would theorize that the data-ipsTruncate-type is what determines how the truncation is handled, though I am unsure what other values are valid here. The current truncation effect seems to be doing two things: Shorten to seven lines maximum - this I am fine with. Remove all formatting - this breaks content such as lists, and I would like to avoid this. I have looked through the database settings but I was unable to find anything that affected this by default. Did I miss something in the options that would resolve this? If not, how can I change this to behave the way I would like it to. Is there any developer documentation available for review so that I can see the what these properties control and what their values are?
bfarber Posted November 3, 2020 Posted November 3, 2020 The truncate javascript widget removes formatting to get the number of lines right. You could change this to get a different effect: data-ipsTruncate-type='remove' to data-ipsTruncate-type='hide'
Foxtrek_64 Posted November 3, 2020 Author Posted November 3, 2020 29 minutes ago, bfarber said: The truncate javascript widget removes formatting to get the number of lines right. You could change this to get a different effect: data-ipsTruncate-type='remove' to data-ipsTruncate-type='hide' I have tried using both 'hide' and 'none' as values. After saving and refreshing, I can see the new value when inspecting the html, however there does not seem to be a change in behavior.
Nathan Explosion Posted November 3, 2020 Posted November 3, 2020 5 hours ago, Foxtrek_64 said: {$record->truncated()|raw} I'm not that big in to Pages, but aren't you returning the truncated content here? So effectively you are truncating in HTML what is already truncated in the record. This should get the full content, which can then be truncated in HTML: {$record->_content|raw} bfarber 1
Solution Foxtrek_64 Posted November 3, 2020 Author Solution Posted November 3, 2020 Good catch, @Nathan Explosion. Setting the truncate type to hide and then getting the full content resolved the issue. Thanks! bfarber 1
Recommended Posts