-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c2a008
commit 7c9a1c8
Showing
1 changed file
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
# Yocto Views Component | ||
# Mira Views Component | ||
A Tiny view renderer | ||
|
||
# Usage | ||
|
||
## Basic | ||
```php | ||
// assumes a __DIR__/path/to/dir/view.phtml file exists | ||
|
||
$mira = new Mira\Mira(__DIR__ . '/path/to/views'); | ||
|
||
// title will be injected as variable $title | ||
$page = $mira->render('view', ['title' => 'title']); | ||
|
||
// Display content however you want | ||
echo $page; | ||
``` | ||
|
||
## Insert Sections in the Template | ||
```php | ||
<div> | ||
<?php | ||
// render a section in the view | ||
$this->insert("section"); | ||
?> | ||
</div> | ||
``` | ||
|
||
## Escape Injected parameters | ||
```php | ||
<div> | ||
<?php echo $this->e($title); ?> | ||
</div> | ||
``` |