Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

In this Discussion

Vanilla 2.6 is here! It includes security fixes and requires PHP 7.0. We have therefore ALSO released Vanilla 2.5.2 with security patches if you are still on PHP 5.6 to give you additional time to upgrade.

Problem implementing /vanilla/views/discussion/discussion.php

R_JR_J Cheerleader & TroubleshooterMunich Moderator

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?

Comments

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    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...

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Solved my problem: FormatMeAction is defined in discussion helper_functions and I haven't included that before rendering discussion view. That's all...

    hgtonightUnderDog
Sign In or Register to comment.