Trim and BBCode

Status
Not open for further replies.

Steven Moore

OMG Member
Oct 22, 2010
1,084
0
115
41
Jefferson City, Missouri
In my portal system I need to trim latest news article to a certain amount of characters before the read more link appears, but I can't figure that out as well as I need to convert bbcode for displaying on my portal.

Here is my latest news model:
PHP:
class xPortal_Model_News extends XenForo_Model
{
    public function getNews()
    {
        $nOption = XenForo_Application::get('options')->xportal_news;

        $nThread = $this->limitQueryResults('
            SELECT
                thread.title, thread.first_post_id, thread.username, post.*, user.*
            FROM xf_thread AS thread
            LEFT JOIN xf_post AS post ON (post.post_id = thread.first_post_id)
            LEFT JOIN xf_user AS user ON (user.username = thread.username)
            WHERE thread.node_id = ?
        ', $nOption);

        return $this->_getDb()->fetchRow($nThread, $nOption);
    }
}

Same thing for my latest posts. Here is my latest posts model:
PHP:
class xPortal_Model_LatestPosts extends XenForo_Model
{
    public function getLatestPosts()
    {
        $lPosts = $this->limitQueryResults('
            SELECT post.*, thread.*
            FROM xf_post AS post
            LEFT JOIN xf_thread AS thread ON (thread.thread_id = post.thread_id)
            WHERE message_state = "visible"
            ORDER BY post.post_date
        ', 5);

return $this->_getDb()->fetchAll($lPosts);
    }
}

Thanks in advance
 
Status
Not open for further replies.