Skip to content

Commit

Permalink
readme mistakes got fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
hokoo committed Nov 16, 2024
1 parent da7956d commit 072b2e9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Render the template with the containers.

```php
$title = new \iTRON\Anatomy\Container();
$container->addText( 'The Best Title' );
$title->addText( 'The Best Title' );

return $templater->render( $html, [
'title' => $title,
Expand Down Expand Up @@ -302,11 +302,15 @@ $button->addBlock( 'button', [
'text' => 'I am not a button',
] );

$container = new \iTRON\Anatomy\Container();
$container->addBlock( 'item', [
$items = new \iTRON\Anatomy\Container();
$items->addBlock( 'item', [
'title' => 'The Best Title',
'buttons' => $buttons,
] );

return $templater->render( $html, [
'items' => $items
] );
```

The result would be:
Expand Down Expand Up @@ -364,7 +368,7 @@ And again, it does not matter what order you describe blocks. The next template

Since we consider blocks as an almost independent template, you can use blocks out of context of the main template.

Suppose, you need to render a "button" block in a different place. Great, there's no need to duplicate the block's code. Just render the block separately.
Suppose, you need to render a "button" block from the template above in a different place. Great, there's no need to duplicate the block's code. Just render the block separately.

```php
echo $templater->renderBlock(
Expand Down

0 comments on commit 072b2e9

Please sign in to comment.