SimplePortal

Customization => Custom Coding => Topic started by: kelu on August 16, 2013, 04:35:03 AM

Title: Simple Portal - "..." before parsing BBC
Post by: kelu on August 16, 2013, 04:35:03 AM
Hello,
I've modified your code a little bit and I suggest you do the same. I had a trouble with tables in boardNews block. When I had a table in some post visible at main opage and it was longer than 500 (or how much I set) it cut it in half. It wasn't a problem because it was parsed with parse_bbc function after. But later if the code was shortened, there was a tripple dot added with link, but because parse_bbc already closed table tags it was added below the whole table, not just after the text inside the table.

My solution (file PortalBlocks.php):
Code: [Select]
// Only place an ellipsis if the body has been shortened.
if ($limited)
    $row['body'] .= '[url=' . $scripturl . '?topic=' . $row['id_topic'] . '.0]...[/url]';

$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

instead of:
Code: [Select]
$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

// Only place an ellipsis if the body has been shortened.
if ($limited)
    $row['body'] .= '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';

I think it's pretty simple and I think it's worth adding to the main release. But it's up to you guy of course.
I'm sorry for my poor english, and thanks for your hard work.
~Kelu

EDIT: I guess I probably should've posted in Custom Coding... I'd appreciate a move if it's necessary
Title: Re: Simple Portal - "..." before parsing BBC
Post by: [SiNaN] on August 17, 2013, 06:26:45 AM
Welcome to SimplePortal!

Actually cutting the table in half is not something that we want but in case something like that happens, parse_bbc() will cover for it. Normally we add a [cutoff] tag to the point where we want the text to be cut, to prevent such issues. Some info here:

http://simpleportal.net/index.php?action=docs;area=the_cutoff_tag

Thanks for the code though! I'm sure there'll be some who'd find it useful. :)
SimplePortal 2.3.8 © 2008-2024, SimplePortal