MyBB Community Forums

Full Version: Limit character in Portal content page?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

In Portal page, the portal_announcement will display all content of the topic.

Have any ways to limit characters of a topic in this page? And have a Read more link at the end of each portal_announcement to access the full topic?

Thank you.
Either create a plugin that adds a hook to the portal page that gets the content of each post, trims it with PHP, then adds a read more link to the end of the content (probably as part of the message itself).

I have a similar system set up but it doesn't use a plugin. I've backed up my portal.php page and made changes to the source file directly.

Either case, you can do it.

(or you can try a CSS property called text-overflow)
Thank you Jazza for your suggestion, but I don't know PHP, I'm not a coder Smile.
There is a plugin on mybb that does this. In the mods site. Portal Announcement cut off.

http://mods.mybb.com/view/portal-announcement-cut-off
The problem with any similar plugin, is that MyCodes are not well handled by them.

You can write a plugin that cuts off any message after a <!--read_more--> kind of text, just like WordPress. Obviously, this will not be automatic.
(2012-07-05, 05:14 PM)Omar G. Wrote: [ -> ]The problem with any similar plugin, is that MyCodes are not well handled by them.

You'd need to do some intuitive programming to make sure you don't break MyCode.

What I've done is instructed my users to add a [readmore] tag to their posts that acts as a break point. PHP explodes using delimited [readmore] which removes the [readmore] tag and allows me to output the first part of the message (complete with MyCode because the user manually added the [readmore] tag).

That is a manual way that relies on your users.
Yes, that is what Omar said. Add a read more tag.
(2012-07-06, 08:29 AM)Leefish Wrote: [ -> ]Yes, that is what Omar said. Add a read more tag.

Yeah but using MyCode is more familiar with forum users (over say a WordPress style one).
Oh, I use [!--readmore--] for my portal plugin, though everybody can change to short it.

"<!--read_more-->" will not work with MyBB because of the parser or something, I tried it. It was just a example using WP Smile
Thank you all for your attention.

I am now using http://mods.mybb.com/view/portal-announcement-cut-off, thank you Leefish.
Pages: 1 2