fetchView() public method

Fetches the contents of a view into a string and returns it. Returns false on failure.
public fetchView ( string $View = '', string $ControllerName = false, string $ApplicationFolder = false )
$View string The name of the view to fetch. If not specified, it will use the value of $this->View. If $this->View is not specified, it will use the value of $this->RequestMethod (which is defined by the dispatcher class).
$ControllerName string The name of the controller that owns the view if it is not $this.
$ApplicationFolder string The name of the application folder that contains the requested controller if it is not $this->ApplicationFolder.
Esempio n. 1
0
 /**
  * Hook (view) to render a captcha.
  *
  * THIS METHOD ECHOS DATA
  *
  * @param Gdn_Controller $sender
  */
 public function captcha_render_handler($sender)
 {
     echo $sender->fetchView('captcha', 'display', 'plugins/recaptcha');
 }
Esempio n. 2
0
 /**
  *
  *
  * @param Gdn_Controller $Controller
  * @param string $Type
  * @return void
  */
 protected function attachUploadsToComment($Controller, $Type = 'comment')
 {
     $RawType = ucfirst($Type);
     if (StringEndsWith($Controller->RequestMethod, 'Comment', true) && $Type != 'comment') {
         $Type = 'comment';
         $RawType = 'Comment';
         if (!isset($Controller->Comment)) {
             return;
         }
         $Controller->EventArguments['Comment'] = $Controller->Comment;
     }
     $MediaList = $this->mediaCache();
     if (!is_array($MediaList)) {
         return;
     }
     $Param = $Type == 'comment' ? 'CommentID' : 'DiscussionID';
     $MediaKey = $Type . '/' . val($Param, val($RawType, $Controller->EventArguments));
     if (array_key_exists($MediaKey, $MediaList)) {
         include_once $Controller->fetchViewLocation('fileupload_functions', '', 'plugins/FileUpload');
         $Controller->setData('CommentMediaList', $MediaList[$MediaKey]);
         $Controller->setData('GearImage', $this->getWebResource('images/gear.png'));
         $Controller->setData('Garbage', $this->getWebResource('images/trash.png'));
         $Controller->setData('CanDownload', $this->CanDownload);
         echo $Controller->fetchView($this->getView('link_files.php'));
     }
 }
Esempio n. 3
0
 /**
  * Render the email.
  *
  * @return string The rendered email.
  */
 public function toString()
 {
     if ($this->isPlaintext()) {
         return $this->plainTextEmail();
     }
     $controller = new Gdn_Controller();
     $controller->setData('email', $this->objectToArray($this));
     $email = $controller->fetchView($this->view);
     // Append plaintext version
     $email .= self::PLAINTEXT_START . $this->plainTextEmail();
     return $email;
 }