corbitWire1
Member
Ok...this is my first post. I've been watching the forum for a few months and I have to say that xenForo rocks! Because xenForo rocks, I decided to start writing my own mods  Here is my first question/problem:
 Here is my first question/problem:
I want to apply custom formatting to the first post of each thread. So I've overriden actionIndex() of XenForo_ControllerPublic_Thread through the use of my own class and a LoadClassController listener.
My class is the following:
	
	
	
		
Also I've modified a chuck of the 'thread_view' template as follows:
	
	
	
		
The problem is that the first post doesn't display it's message and the post's owner signature. It seems that $message.messageHtml and $message.signatureHtml found in the 'message' template don't exist or they are empty. The problem exists only in my own code referencing $specialPost.
I've checked the response of my controller and the base controller through print_r and neither $posts nor $specialPost contain a messageHtml or signatureHtml value. Where is the problem???
				
			 Here is my first question/problem:
 Here is my first question/problem:I want to apply custom formatting to the first post of each thread. So I've overriden actionIndex() of XenForo_ControllerPublic_Thread through the use of my own class and a LoadClassController listener.
My class is the following:
		PHP:
	
	<?php
class SpecialPost_ControllerPublic_Thread extends XFCP_SpecialPost_ControllerPublic_Thread
{
    public function actionIndex()
    {
        $return = parent::actionIndex();
        $postid = $return->params['thread']['first_post_id'];
        if (isset ($return->params['posts'][$postid]))
        {
            $return->params['specialPost'][$postid] = $return->params['posts'][$postid];
            unset ($return->params['posts'][$postid]);
        }
        else
            $return->params['specialPost'] = array();
        return $return;
    }
}Also I've modified a chuck of the 'thread_view' template as follows:
		Code:
	
	<ol class="messageList" id="messageList">
<xen:foreach loop="$specialPost" value="$post">
            <xen:if is="{$post.message_state} == 'deleted'">
                <xen:include template="post_deleted_placeholder" />
            <xen:else />
                <xen:include template="post" />
            </xen:if>
        </xen:foreach>
        <xen:foreach loop="$posts" value="$post">
            <xen:if is="{$post.message_state} == 'deleted'">
                <xen:include template="post_deleted_placeholder" />
            <xen:else />
                <xen:include template="post" />
            </xen:if>
        </xen:foreach>
        <xen:edithint template="attached_files" />
    </ol>The problem is that the first post doesn't display it's message and the post's owner signature. It seems that $message.messageHtml and $message.signatureHtml found in the 'message' template don't exist or they are empty. The problem exists only in my own code referencing $specialPost.
I've checked the response of my controller and the base controller through print_r and neither $posts nor $specialPost contain a messageHtml or signatureHtml value. Where is the problem???
 
 
		 
 
		
 
 
		 
 
		 
 
		 
 
		