Twig::render PHP Метод

render() публичный Метод

Renders Twig Template and Returns as String
public render ( string $view, array $params = [] ) : string
$view string Template filename without `.twig`
$params array Array of parameters to pass to the template
Результат string
    public function render($view, $params = [])
    {
        $this->createTwig();
        // We call addFunctions() here, because we must call addFunctions()
        // after loading CodeIgniter functions in a controller.
        $this->addFunctions();
        $view = $view . '.twig';
        return $this->twig->render($view, $params);
    }

Usage Example

Пример #1
0
 /**
  * Create or update a table in a database.
  *
  * @param string $database The name of the database.
  * @param string $schema The name of the schema.
  * @param Table $table The Table object representing what the table should become.
  * @param bool $force If false, the driver should not perform possibly destructive changes.
  * @return bool True if operations were performed successfully.
  */
 public function setTable($database, $schema, Table $table, $force = false)
 {
     $success = true;
     foreach ($this->templates as $dest => $template) {
         $output = $this->twig->render($template, ['database' => $database, 'schema' => $schema, 'table' => $table]);
         $success = $success && file_put_contents($dest, $output);
     }
     return $success;
 }
All Usage Examples Of Twig::render