solved Limiting Characters in List Module

alt=
@mrsaaron411
5 years ago
15 posts
Hello! The list module for blogs and forum discussions displays the entire content of the blog or discussion. How would I go about changing it so that it only shows an excerpt from each one? TIA
updated by @mrsaaron411: 08/21/19 06:32:59PM
michael
@michael
5 years ago
7,692 posts
jrCore_list is the function that creates lists,

Docs: "{jrCore_list ...... }"
https://www.jamroom.net/the-jamroom-network/documentation/module-developer-guide/89/jrcore-list

The default template is usually called item_list.tpl. so for the blog module it would be found at /modules/jrBlog/templates/item_list.tpl

But may be overridden by a skin template override called jrBlog_item_list.tpl

Docs: "Altering a modules template"
https://www.jamroom.net/the-jamroom-network/documentation/module-developer-guide/1051/altering-a-modules-template

In that will be the variable that outputs the blog text, it will look something like this
{$item.blog_text}

You can find the exact name by using the {debug} function

Docs: "{debug}"
https://www.jamroom.net/the-jamroom-network/documentation/module-developer-guide/1477/debug

Onto the end of that use the smarty function truncate

Smarty Docs: "Truncate"
https://www.smarty.net/docs/en/language.modifier.truncate

So to limit to 200 characters
{$item.blog_text|truncate:200}
alt=
@mrsaaron411
5 years ago
15 posts
Thank you so much Michael! Unfortunately, I tried that and it didn't seem to do anything. There were 2 places in the code that said {$item.blog_text} and I tried modifying both of them as you said, but nothing changed. I am sorry, all of this is way over my head and I am trying to figure it out as I go. I really appreciate everyone's help!
paul
@paul
5 years ago
4,325 posts
When you make a change to a template be sure to clear the site caches so that you see the change immediately.
Alternatively, if making multiple changes or developing a site, disable the caching system. Its an option in the Developer module.
hth


--
Paul Asher - JR Developer and System Import Specialist
michael
@michael
5 years ago
7,692 posts
I also like to add a place holder so I know my updates are in the right place, so where you see
{$item.blog_text}
when you make the change also add some marker text so you know it was the correct location
HERE I AM MAKING SOME ALTERATIONS, WHERE DOES THIS TEXT COME OUT???????{$item.blog_text}

So if you see that extra text you know the template changes were in the right place. Also make sure you did what paul said and reset the caches.

Tags