diff --git a/docs/02-control-structure-extends-section.md b/docs/02-control-structure-extends-section.md index ef1b1ad..72d6fa2 100644 --- a/docs/02-control-structure-extends-section.md +++ b/docs/02-control-structure-extends-section.md @@ -119,4 +119,52 @@ We could use the previous file `path/home` and generate, let's say, the same pag ``` -Notice that the `
` tag is now empty, since we've redeclared it in our navless view. \ No newline at end of file +Notice that the `
` tag is now empty, since we've redeclared it in our navless view. + +## Overview of `section` (string $name, array $options) + +In your `$name` variable, accepted characters are alpha-numeric and those specific caracters : `.-_:`, so +names suches as : + + `body.content` + `my-cool-section:heading` + `MyOtherSection` + `_another_accepted_name` + +Allowed options are : + + string `action` : allowed are `prepend`, `default`, `append` + int `order` : if you must + +### Actions can also be passed using specials tokens : + +`section.prepend` and `section.append` can also be used without passing an `action` option. + +*path/home-nav.phtml* +```html +{% extends "path/home" %} + +{% section "header" %} + First link here ! +{% endsection %} +``` + +*path/home-admin-nav.phtml* +```html +{% extends "path/home-nav" %} + +{% section.prepend "header" %} +

My new NAV header

+{% endsection %} + +{% section.append "header" %} + Second link here ! +{% endsection %} +``` + +**[HTML]** Would render as such : +```html +

My new NAV header

+First link here ! +Second link here ! +```