Jaxel
Well-known member
So I am writing XenPorta2. And in the addon, I transform the thread view using custom templates. This has always been a very simple process because of the way XenForo is set up. However, it gets a bit more complicated when you consider the AJAX component of XenForo. For instance, when I use quick reply on the thread, instead of it loading up the customized post bit, it loads up the original post bit.
This particular problem I solved relatively simply by hooking into the controller for thread:
However, there are other places which aren't so easy to fix. One in particular: "thread/show-posts". The show-posts action seems to rely completely on javascript and has no method to degrade back to a static page. Because of this, the action has a lot of it's configuration done in the view instead of in the controller. Instead of declaring the template 'post' in the controller, its iterated in the view.
I'm wondering why it was programmed this way. The javascript in XenForo is WAAAAY over my head; so I'm sure there is a good reason for it.
This particular problem I solved relatively simply by hooking into the controller for thread:
Code:
public function actionAddReply()
{
$response = parent::actionAddReply();
if ($this->_noRedirect() &&
$this->getModelFromCache('EWRporta2_Model_Articles')->getArticleByThreadId($response->params['thread']['thread_id']))
{
return $this->responseView(
'XenForo_ViewPublic_Thread_ViewNewPosts',
'EWRporta2_Article_NewPosts',
$response->params
);
}
return $response;
}
However, there are other places which aren't so easy to fix. One in particular: "thread/show-posts". The show-posts action seems to rely completely on javascript and has no method to degrade back to a static page. Because of this, the action has a lot of it's configuration done in the view instead of in the controller. Instead of declaring the template 'post' in the controller, its iterated in the view.
I'm wondering why it was programmed this way. The javascript in XenForo is WAAAAY over my head; so I'm sure there is a good reason for it.