SimplePortal

Development => Bugs => Fixed or Bogus Bugs => Topic started by: dannbass on November 19, 2009, 11:28:50 AM

Title: Three dots in articles
Post by: dannbass on November 19, 2009, 11:28:50 AM
I'm using articles for the front page, and the three dots that cut the article work great, if I'm writing normal, but since I want my articles pretty, I'm using the justify bbcode and the dots are pushed down.

I get that I'm not being as descriptive as possible, so I'm attaching three screen caps.  First two are with the problem, and the last one is fine.
Title: Re: Three dots in articles
Post by: Nathaniel on November 20, 2009, 07:19:51 AM
Try this edit.

Code: ("Find (Sources/PortalArticles.php)") [Select]
   if (!empty($modSettings['articlelength']) && $smcFunc['strlen']($row['body']) > $modSettings['articlelength'])
      $row['body'] = parse_bbc(sp_truncateText($row['body']), $row['smileys_enabled'], $row['id_message']) . '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';

Code: ("Replace") [Select]
    if (!empty($modSettings['articlelength']) && $smcFunc['strlen']($row['body']) > $modSettings['articlelength'])
    {
        $row['body'] = rtrim(sp_truncateText($row['body']));
        $row['body'] = substr($row['body'], -6) == '<br />' ? substr($row['body'], 0, -6) : $row['body'];
        $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_message']) . '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';
    }
Title: Re: Three dots in articles
Post by: dannbass on November 20, 2009, 10:32:18 AM
No, it didn't work.
Title: Re: Three dots in articles
Post by: ccbtimewiz on November 20, 2009, 05:00:59 PM
This part:

Code: [Select]
$row['body'] = substr($row['body'], -6) == '<br />' ? substr($row['body'], 0, -6) : $row['body'];
Change to:

Code: [Select]
$row['body'] = substr($row['body'], -6) == '[br]' ? substr($row['body'], 0, -6) : $row['body'];
Title: Re: Three dots in articles
Post by: dannbass on November 20, 2009, 05:04:45 PM
Nope, that didn't do it either.  :|
Title: Re: Three dots in articles
Post by: ccbtimewiz on November 20, 2009, 05:20:30 PM
What kind of justify tag are you using? Can you show me the exact bbcode?
Title: Re: Three dots in articles
Post by: dannbass on November 20, 2009, 05:22:58 PM
Sure! here is the mod I'm using.
Thank you for looking into it!
Title: Re: Three dots in articles
Post by: ccbtimewiz on November 20, 2009, 06:49:08 PM
Try this out:

Code: [Select]
  if (!empty($modSettings['articlelength']) && $smcFunc['strlen']($row['body']) > $modSettings['articlelength'])
      $row['body'] = parse_bbc(sp_truncateText($row['body']), $row['smileys_enabled'], $row['id_message']) . '<div align="justify"><a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a></div>';
Title: Re: Three dots in articles
Post by: dannbass on November 20, 2009, 06:51:35 PM
I'm sorry to say, but that didn't do it either, and moved the dots from the articles that were not justified.
Title: Re: Three dots in articles
Post by: ccbtimewiz on November 20, 2009, 06:56:17 PM
I'm confused as to what you're trying to do then. Are you justifying the entire article? As in, you will wrap the entire post in the justify tag?
Title: Re: Three dots in articles
Post by: dannbass on November 20, 2009, 06:58:51 PM
Yes, I'm wrapping the whole article and when displayed it sends the dots to the next line.
Oh I see, is the code to justify the article without having to use the tags?
Title: Re: Three dots in articles
Post by: ccbtimewiz on November 20, 2009, 07:02:44 PM
It is quite possible (and probably easier) to just justify using manual HTML in the article template than manipulating it through BBC.

What I did above was put the "..." in a justify wrap, but I'm assuming the HTML doesn't layer like that. I see two possible solutions:

1.) Remove the BBcode "justify" from the articles, and then manually hack the article templates to use it.
2.) Write up a nice regex that will look for the closed justify tag, and then push it after the "...".

Title: Re: Three dots in articles
Post by: dannbass on November 20, 2009, 07:06:56 PM
The only problem is that not all of the articles will need to be justified, for layout reasons, maybe not the best but I might not need them all displayed like that.
Thank you so much! I'll just get by without justifying them.  The dots are more important in my opinion.
Title: Re: Three dots in articles
Post by: ccbtimewiz on November 20, 2009, 07:15:31 PM
The reason to why this was happening was because, everything in an article, is contained (think of it as layer 1), and then the layer closed and another layer is manually put on top of it (layer 2). Layer 2 is the "...".

Example:

Code: [Select]
<div class="content"><div align="justify">The article post is here.</div>...</div>
As you can see, the "..." is not contained in layer 1 because the article system is assuming you aren't manipulating the alignment.

Technically this could be considered as a bug, as if I made an entire post align to the left or right (like for example, my signature), the "..." would show to the left when it is not intended. The only known solution would be to use regex and see if anything alignment-esque entites are manipulating the article itself.

Hopefully the development team can address this.
Title: Re: Three dots in articles
Post by: dannbass on November 20, 2009, 07:20:34 PM
Thank you for the explanation! I see now, yes I think it looks better once everything is justified, but it should be the same for the post, so ideally the alignment should be in the message itself, and then displayed accordingly in the frontpage.
SimplePortal 2.3.8 © 2008-2024, SimplePortal