By Christina on Tuesday, 23 September 2014
Posted in Technical Issues
Replies 9
Likes 0
Views 733
Votes 0
I've set my blog to truncate on the front page using the "By break tags" option (By "character" or "word" truncation isn't an option as they look terrible in my case, and "By paragraph" isn't an option either for other reasons).

But there seems to be a problem: I've set it to truncate after 5 break tags, and it does truncate, BUT it also seems to add the next two characters that come after the end of the last br tag. So if I had a sixth BR tag coming after the fifth, EasyBlog would add in the first two characters of the next tag, in this case <b. It then is "smart" enough to complete the tag. And it does it like this:
<b <!--="" @trigger:="" onafterdisplaycontent="" --=""> The entire next post on my front page is within this bold tag, thus the whole next post is bold when shown on the front page. </b>


This is a big problem. It sometimes happens when the tag after the fifth br is a span tag, which then makes the next post below it on the front page a strikethrough (because it turns it into the <s> tag). Or if it's just text after the fifth BR tag, then the first two characters of the next "paragraph" show up, which of course looks weird.

Any ideas why it's adding in the two characters after the fifth/final BR tag? I have my BR tags formatted like this: <br />
Hello Christina,

We can't really debug your site without the access to it. However, you can check this file : ..\components\com_easyblog\helpers\helper.php in line 1173.
·
Wednesday, 24 September 2014 14:00
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Christina,

To be honest with you, I am not really sure how to replicate this. I guess the best way is for you to provide us with the access to the site so that we can check on this?
·
Tuesday, 23 September 2014 01:58
·
0 Likes
·
0 Votes
·
0 Comments
·
It is actually a client site, so I don't think giving direct access is a possibility. I can copy and paste code that might be relevant though, and/or provide some screenshots. Let me know what you might need.

Basically, whatever two characters that come directly after the end of the fifth BR tag get added to the HTML code before the front page blog truncation occurs. It can really screw with the rest of the page.
·
Tuesday, 23 September 2014 05:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Christina,

We really need to access the site (backend and FTP) otherwise, we cannot find what causing this issue. We have tried in our local and the <br> truncation is working just fine. Please advise.
·
Tuesday, 23 September 2014 11:41
·
0 Likes
·
0 Votes
·
0 Comments
·
Giving access to the back end just isn't an option at this point. :-(

What are the relevant PHP files that deal with the truncation? I'm no expert at PHP, but I've been trying to go in manually to see if I can figure something out on my own. Some of the files I've been looking at are: blog.item.php, blog.read.php, and a few others. I can't seem to locate the exact file that deals with how the truncation is formatted...

EDIT: It also seems that if I remove the space and the forward slash from the BR tags (if I change them all from &lt;br /&gt; to &lt;br&gt; ), then EasyBlog keeps FOUR characters before truncating instead of just two. So apparently EasyBlog think the BR tag ends right after the R instead of after the closing angle bracket, and then it goes on to include the next four characters. (Or at least it does that in my case.)
·
Wednesday, 24 September 2014 01:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Christina,

During the blog creation, have you click the toggle editor? This is because, if you want to use <br> tag, you have to write the post in HTML format so once saved, the html tag will not change to all these: <br /> to <br>. Refer to this screenshot: http://screencast.com/t/RMWF7ltLi , I've toggled the editor to show my post in HTML format and add the <br> tag inside. And the result will be like this: http://screencast.com/t/oDyPx1kgklX .
·
Wednesday, 24 September 2014 10:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes, I've been adding the BR tags in the HTML mode (via the Toggle Editor button). And they work just fine, except that the posts on the front page truncate four characters after the end of the "r" in the BR tag.
·
Wednesday, 24 September 2014 12:44
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Nik, after spending a little while in the helper.php code I think I figured it out. :-)

I changed the 6 in the following code
$matches[ $maxTag - 1 ] + 6
to a 4, which stopped it from including the first two characters of the next line of code. Not sure why the issue was coming up in the first place, but maybe it was due to a conflict with some other plugin or something. But it seems to be working now.

So lines 1251 – 1265 in my helper.php now look like the following:
if( count( $matches ) > $maxTag )
{
$row->text = JString::substr( $content , 0 , $matches[ $maxTag - 1 ] + 4 );
$row->readmore = true;
}
else
·
Thursday, 25 September 2014 06:11
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Christina,

Glad you have figured it out. And thanks for sharing it here. It might be useful information to others.
·
Thursday, 25 September 2014 11:33
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post