Format post data AND get thread link


Active member
A little background.
I have a small class that I want to use to create my home page (the way I like it :) )
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']);

// 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
Your friend TerminalAddict has a link
Thanks, and enjoy
how do I turn this into HTML ?

what I have so far:

btw, I've watched this twice! :) (mainly so I can see some of the code in the vid)
plus, a great deal of thanks to Arik here:

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



Active member
whoops .. forgot to change the title of this thread :)
While I was typing this out, I figured out how to do thread links using <xen:link> :)


Well-known member
In your page html, instead of using {$yourMessageVariableName} to output the parsed message, use
{xen:raw $yourMessageVariableName}