Skip to content
AngelNovo edited this page Aug 10, 2024 · 2 revisions

Location

Every view must be located in /views/

Relevant information

In Gravity2 0.0.1.alpha1 the file extension can only be phtml, as the view can contain both html and php

Accessing variables from the controller

  // `/controllers/ShowView.php`
  return View::Render('showview', [ 'greet' => 'Welcome to my blog' ]);
/*
 `/views/showview.phtml`
*/
<h1><?=$greet?></h1>

Clone this wiki locally