https://github.com/igogo5yo/yii2-render-many
Trait for Yii Framework 2
https://github.com/igogo5yo/yii2-render-many
landing-page many render rendering trait views yii2
Last synced: 3 months ago
JSON representation
Trait for Yii Framework 2
- Host: GitHub
- URL: https://github.com/igogo5yo/yii2-render-many
- Owner: igogo5yo
- License: mit
- Created: 2015-12-07T09:11:55.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-24T15:43:04.000Z (about 9 years ago)
- Last Synced: 2025-05-30T12:48:34.368Z (4 months ago)
- Topics: landing-page, many, render, rendering, trait, views, yii2
- Language: PHP
- Size: 14.6 KB
- Stars: 13
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# RenderMany extension for Yii Framework 2
[](https://packagist.org/packages/igogo5yo/yii2-render-many) [](https://packagist.org/packages/igogo5yo/yii2-render-many) [](https://packagist.org/packages/igogo5yo/yii2-render-many) [](https://www.versioneye.com/user/projects/56655361f376cc003d000a91)
Yii Framework 2 extension for render many views in one action (best solution for landing pages or pages with many content blocks)
Please submit issue reports and pull requests to the main repository.
For license information check the [LICENSE](LICENSE.md)-file.Installation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer require --prefer-dist igogo5yo/yii2-render-many
```or add
```
"igogo5yo/yii2-render-many": ">=1.0"
```to your `composer.json` file
Example
----use trait
```php
...
class MyController extends Controller {
use igogo5yo\rendermany\RenderMany;
public function actionIndex()
{
return $this->renderMany([
'sliderSection' => [
'slides' => ['img1.jpg', 'img3.jpg', 'img3.jpg']
],
'contentSection' => [
'title' => 'My post',
'description' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry...',
],
'partnersSection' => [
'partners' => [
['link' => '#', 'name' => 'partner 1'],
['link' => '#', 'name' => 'partner 2'],
['link' => '#', 'name' => 'partner 3'],
]
],
'footer' //without passing variables
]);
}
}
```or extend your controller
```phpclass MyController extends igogo5yo\rendermany\Controller {
public function actionIndex()
{
return $this->renderMany([
'sliderSection' => [
'slides' => ['img1.jpg', 'img3.jpg', 'img3.jpg']
],
'contentSection' => [
'title' => 'My post',
'description' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry...',
],
'partnersSection' => [
'partners' => [
['link' => '#', 'name' => 'partner 1'],
['link' => '#', 'name' => 'partner 2'],
['link' => '#', 'name' => 'partner 3'],
]
],
'footer' //without passing variables
]);
}
}
```also you can use partial rendering
```php
public function actionIndex()
{
return $this->renderMany([
'sliderSection' => [
'slides' => ['img1.jpg', 'img3.jpg', 'img3.jpg']
],
'wrapper' => [
'innerRenders' => $this->renderManyPartial([
'innerView1' => [
'param1' => 'some data 1'.
'param2' => 'some data 2'
],
'innerView2' //without passing variables
])
],
'footer' //without passing variables
]);
}
```