solved Truncated description causes missing div tag

Developer Networks
Developer Networks
@developer-networks
8 years ago
566 posts
Currently a trunicated description in a template causes a missing div tag when returned in the item code.
{$item.discuss_description|truncate:120}
 {$item.discuss_description|substr:0:120} 
Then inside the foreach loop when used in a template It seems to loose a closing div in the varible during the foreach loop. So after the second or third item in this cycle it causes all divs in any template to be off.

It seems that there is a div passed in the discuss_description and it is being cut of so when trunicated



updated by @developer-networks: 03/05/17 04:27:30PM
Developer Networks
Developer Networks
@developer-networks
8 years ago
566 posts
So when we dont truncate discuss_description in a template it was good.

However the truncated version cut off the closing
 </div>
In the code.

This was throwing off other div tags in the templates.
How would I resolve this in jamroom?

I would think in design the item descriptions
 {$item.discuss_description}
the item itself should not automatically have div tags passed with them... since the divs are always called from with in the templates or module templates.

<div class="p10">{$item.discuss_description|substr:0:120}
</div>


updated by @developer-networks: 11/23/16 08:41:07AM
SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
discuss_description is probably an editor field which would save html to the database.

You can get rid of the html using the jrCore_strip_html smarty modifier before you truncate:
{$item.discuss_description|jrCore_strip_html|truncate:120}



--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
Developer Networks
Developer Networks
@developer-networks
8 years ago
566 posts
Thanks Steve!
I tried that function and it did resolve the issue.
{$item.discuss_description|jrCore_strip_html|truncate:120}



updated by @developer-networks: 11/23/16 09:38:14AM
Developer Networks
Developer Networks
@developer-networks
8 years ago
566 posts
This image is what happens to templates in jamroom after trunicating the item description with out using jrCore_strip_html
{$item.discuss_description|jrCore_strip_html|truncate:120}
like shown above...

Thanks again Steve for the help this resolved the issue.
Help1.jpg
Help1.jpg  •  205KB


updated by @developer-networks: 11/23/16 09:41:14AM
douglas
@douglas
8 years ago
2,791 posts
This is whats in the GroupDiscuss item_list.tpl...

{$item.discuss_description|jrCore_format_string:$item.profile_quota_id|jrCore_strip_html|truncate:150}

Hope this helps!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
Developer Networks
Developer Networks
@developer-networks
8 years ago
566 posts
It does. I didnt know I could use jrCore_strip_html with Jamroom.

Thanks Douglas
douglas
@douglas
8 years ago
2,791 posts
Your welcome! Glad it is working for you. :)


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
Developer Networks"]
Thanks Steve!
I tried that function and it did resolve the issue.
{$item.discuss_description|jrCore_strip_html|truncate:120}

I don't know why that didn't work for you.

I have just used this to fix the same problem on a site:
{$item.items_text|jrCore_strip_html|truncate:200:"..."}
It works perfectly.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
Developer Networks
Developer Networks
@developer-networks
8 years ago
566 posts
SteveX:
Developer Networks"]
Thanks Steve!
I tried that function and it did resolve the issue.
{$item.discuss_description|jrCore_strip_html|truncate:120}

I don't know why that didn't work for you.

I have just used this to fix the same problem on a site:
{$item.items_text|jrCore_strip_html|truncate:200:"..."}
It works perfectly.



Steve It says: "It did work". Thanks again for your help.

Tags