The error is there, because the actionChangedate should be the function that returns a "View". In Model-View-Controller, you should return a view. What you are doing now, is the "Controller". You do not need the model if you just write "Hello World", but you do need to return a view every time.
Do you want to see your own template if you click on that /posts/1234/changedate link? It's so easy.
1. Add a new template named "andy_changedate". At the bottom of the page, you can assign this template to your addon. There is a list of addons and you can just select yours.
Code:
<h1>Andy Change Date</h1>
postId is {$postId}
2. You can put this at the end of your actionChangedate() function:
PHP:
<?php
class Andy_ChangeDate_ControllerPublic_Post extends XFCP_Andy_ChangeDate_ControllerPublic_Post{
public function actionChangedate()
{$postId= $this->_input->filterSingle('post_id', XenForo_Input::UINT);
echo 'ControllerPublic: Change Date. $postId = ' . $postId;
$viewParams = array(
'postId' => $postId,
);
return $this->responseView(
'Andy_DateChange_ViewPublic_Post',
'andy_changedate',
$viewParams
);
}
}
$viewParams is a list of all variables you can view in your template. so if you want your custom $postId be accessible like {$postId} in your template, then you have to put it there.
'Andy_DateChange_ViewPublic_Post' is the first parameter in that view, you don't worry about that, because if it is not there, always the regular View will be choosen from xenforo. I only once created my own view, and it is rather complicated. So as a beginner, just do it like that.
'andy_changedate' is the name of the template the View should return. So it's your template.