https://github.com/frc/wp-view
https://github.com/frc/wp-view
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/frc/wp-view
- Owner: frc
- Created: 2020-01-24T13:27:08.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-22T08:29:54.000Z (about 6 years ago)
- Last Synced: 2025-05-27T00:46:15.503Z (about 1 year ago)
- Language: PHP
- Size: 27.3 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WP View
TODO ...
This is a must-use plugin used via composer, plugin activation not required.
Logic and conventions inspired by Laravel and React.
## Usage
Call function as `frc_view($viewName, $data = [])`.
If you don't pass array as a second argument it will be assigned to array with key `children`.
Default root for searching view is themes `views` folder.
### Example
```php
= frc_view('components/app',
frc_view('components/layout', [
'main' => frc_view('components/blocks'),
'footer' => frc_view('components/page-footer', [
'shares' => false,
]),
])
); ?>
```
Rendered as:
```html
// views/components/app.php
...
...
= $children; ?> // content of views/components/layout.php
...
```
```html
// views/components/layout.php
= $main; ?> // content of views/components/blocks.php
= $footer; ?> // content of views/components/page-footer.php
```