Skip to content

Commit

Permalink
Controller/Object usage
Browse files Browse the repository at this point in the history
  • Loading branch information
gorriecoe committed Mar 2, 2018
1 parent 8cf69e5 commit c92e1ba
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Installation
Composer is the recommended way of installing SilverStripe modules.
```
composer require gorriecoe/silverstripe-embed
composer require gorriecoe/silverstripe-htmltag
```

## Requirements
Expand All @@ -15,7 +15,7 @@ composer require gorriecoe/silverstripe-embed

- [Gorrie Coe](https://github.com/gorriecoe)

# Template usage
## Template usage

```
{$h1($Title).setClass('title').setPrefix($Class)}
Expand All @@ -34,3 +34,29 @@ And returns
This sections title
</h1>
```

## Controller/Object usage

```php

use gorriecoe\HTMLTag\View\HTMLTag;

class MyController extends Controller
{
public function Title()
{
$title = HTMLTag::create($this->Data()->Title, 'h1')
->setPrefix($this->Class);
if (true) {
$title->setClass('title')
}
return $title;
}
}
```
Accessing and modifying the output in the template
```
<div>
{$Title.addClass('anotherclass')}
</div>
```

0 comments on commit c92e1ba

Please sign in to comment.