- Added a new doc section about both new tokens 'section.prepend/append'
This commit is contained in:
		
							parent
							
								
									ded3d5e907
								
							
						
					
					
						commit
						afeb8789b5
					
				| @ -119,4 +119,52 @@ We could use the previous file `path/home` and generate, let's say, the same pag | |||||||
| </html> | </html> | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Notice that the `<header>` tag is now empty, since we've redeclared it in our navless view. | Notice that the `<header>` 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" %} | ||||||
|  |     <a href="#mylink">First link here !</a> | ||||||
|  | {% endsection %} | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | *path/home-admin-nav.phtml* | ||||||
|  | ```html | ||||||
|  | {% extends "path/home-nav" %} | ||||||
|  | 
 | ||||||
|  | {% section.prepend "header" %} | ||||||
|  |     <h4>My new NAV header</h4> | ||||||
|  | {% endsection %} | ||||||
|  | 
 | ||||||
|  | {% section.append "header" %} | ||||||
|  |     <a href="#mylink">Second link here !</a> | ||||||
|  | {% endsection %} | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | **[HTML]** Would render as such : | ||||||
|  | ```html | ||||||
|  | <h4>My new NAV header</h4> | ||||||
|  | <a href="#mylink">First link here !</a> | ||||||
|  | <a href="#mylink">Second link here !</a> | ||||||
|  | ``` | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user