Problem implementing /vanilla/views/discussion/discussion.php
R_J
Admin
I've created a plugin and wanted to render a discussion with help of the standard discussion view. I'm using Vanilla 2.1, default theme and have disabled every plugin. But I always get only a part of the expected result.
This is the code I use:
public function PluginController_TestView_Create($Sender, $Args) {
$DiscussionID = $Args[0];
$DiscussionModel = new DiscussionModel();
$Discussion = $DiscussionModel->GetID($DiscussionID);
$Sender->SetData('Discussion', $Discussion);
$Sender->Render($Sender->FetchViewLocation('discussion', 'Discussion', 'Vanilla'));
And that is the HTML I get in return
< div id="Discussion_2" class="Item ItemDiscussion">
< div class="Discussion">
< div class="Item-Header DiscussionHeader">
< div class="AuthorWrap">
< span class="Author">
< a title="Moe" href="/forum/profile/4/Moe" class="PhotoWrap">< img src="http://wd.vanillicon.com/d355bc8c2ea95365ea9b23860e5ad39f_50.png" alt="Moe" class="ProfilePhoto ProfilePhotoMedium" />< /a>< a href="/forum/profile/4/Moe" class="Username">Moe< /a>
I've already tried DiscussionController instead of PluginController but that had no impact, the result has been the same.
Rendering seems to stop at echo FormatMeAction($Discussion); but I cannot find a reason for that. Does anyone has an idea what could be the problem here?
0
Answers
Tried to print out a comment:
require_once $Sender->FetchViewLocation('helper_functions', 'Discussion', 'Vanilla'); $CommentModel = new CommentModel(); $Comment = $CommentModel->GetID($Args[0]); $Session = Gdn::Session(); WriteComment($Comment, $this, $Session, 1);That was no problem at all...
Solved my problem: FormatMeAction is defined in discussion helper_functions and I haven't included that before rendering discussion view. That's all...