����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /var/www/html/st2/vendor/league/plates/docs/templates/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/st2/vendor/league/plates/docs/templates/index.md
---
layout: default
permalink: templates/
title: Templates
---

Templates
=========

Plates templates are very simple PHP objects. Generally you'll want to create these using the two factory methods, `make()` and `render()`, in the [engine](/engine/). For example:

~~~ php
// Create new Plates instance
$templates = new League\Plates\Engine('/path/to/templates');

// Render a template in a subdirectory
echo $templates->render('partials/header');

// Render a template
echo $templates->render('profile', ['name' => 'Jonathan']);
~~~

For more information about how Plates is designed to be easily added to your application, see the section on [dependency injection](/engine/#dependency-injection).

## Manually creating templates

It's also possible to create templates manually. The only dependency they require is an instance of the [engine](/engine/) object. For example:

~~~ php
// Create new Plates instance
$templates = new League\Plates\Engine('/path/to/templates');

// Create a new template
$template = new League\Plates\Template\Template($templates, 'profile');

// Render the template
echo $template->render(['name' => 'Jonathan']);

// You can also render the template using the toString() magic method
echo $template;
~~~

## Check if a template exists

When dynamically loading templates, you may need to check if they exist. This can be done using the engine's `exists()` method:

~~~ php
if ($templates->exists('articles::beginners_guide')) {
    // It exists!
}
~~~

You can also run this check on an existing template:

~~~ php
if ($template->exists()) {
    // It exists!
}
~~~

## Get a template path

To get a template path from its name, use the engine's `path()` method:

~~~ php
$path = $templates->path('articles::beginners_guide');
~~~

You can also get the path from an existing template:

~~~ php
$path = $template->path();
~~~

ZeroDay Forums Mini