• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Format post data AND get thread link

#1
A little background.
I have a small class that I want to use to create my home page (the way I like it :) )
PHP:
class FPS_HomePage_PageCallback_HomePage
{
        public static function response(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract $response)
        {
                // do some raw stuff perhaps?
                $fps_intro = Array();
                $fps_current_giveaway = Array();
                $fps_previous_giveaway = Array();

// get models
$postModel = $controller->getModelFromCache('XenForo_Model_Post');
$threadModel = $controller->getModelFromCache('XenForo_Model_Thread');

// get a single post for our ABOUT section
$fps_intro = $postModel->getPostById(63); //post id for the post I want to use.

// get the previous giveaways thread
$fetchOptions = array(
        'limit' => 5,
        'order' => 'node_id',
        'orderDirection' => 'desc',
);
$conditions = array(
        'deleted' => false,
        'moderated' => false
);
$threads = $threadModel->getThreadsInForum(111, $conditions, $fetchOptions); // forum id where I post giveaways.

$count = 1;
foreach ($threads as $key => $value ) {
        $fps_previous_giveaway[$count] = Array('thread_id'=>$value['thread_id'], 'title'=>$value['title'], 'post_date'=>date('F j, Y',$value['post_date']), 'post_id'=>$value['first_post_id']);
        $count++;
}

// The latest giveaway is simply the first in the array of previous giveaways :)

$fps_current_giveaway['post_id'] = $fps_previous_giveaway[1]['post_id'];
$fps_current_giveaway['thread_id'] = $fps_previous_giveaway[1]['thread_id'];
$fps_current_giveaway['title'] = $fps_previous_giveaway[1]['title'];
$fps_current_giveaway['post_date'] = $fps_previous_giveaway[1]['post_date'];
$fps_current_giveaway['contentId'] = $postModel->getPostById($fps_previous_giveaway[1]['post_id']);
$fps_current_giveaway['content'] = $fps_current_giveaway['contentId']['message'];

                $response->templateName = 'FPS_HomePage';
                $response->params += array(
                        'FPS_intro' => $fps_intro['message'],
                        'FPS_current_giveaway' => $fps_current_giveaway,
                        'FPS_previous_giveaway' => $fps_previous_giveaway
                );
                // var_dump($fps_previous_giveaway[1]);
        }
}
this will return 1 var, and two arrays.

the "contents" of each return value looks like this
Code:
[LIST][*]first
[*]second.
[*]third
[/LIST]
Word!
[QUOTE]
Your friend TerminalAddict has a link
[url]http://www.fps.net.nz[/url]
Thanks, and enjoy
[/QUOTE]
how do I turn this into HTML ?

what I have so far: http://www.fps.net.nz/community/pages/Home/

btw, I've watched this http://vimeo.com/16239304 twice! :) (mainly so I can see some of the code in the vid)
plus, a great deal of thanks to Arik here: http://xenforo.com/community/threads/template-pagecallback-and-wordpress.12885/

so, is there a Model that I can use to format the "contents" ?

Thanks
-TA