Yii's infinite-scroll-pager extension doesn't show pager - php

I am using the Yii's extension infinite-scroll-pager. My data provider has 6 registers, but I want it to show only the first 3. How can I get it done? Would the triggerPageTreshold (sic) have to do this job?
$listView = $this->widget(
'zii.widgets.CListView',
array(
'id' => 'activities-scroll-list',
'dataProvider' => $dataProvider,
'itemView' => '/experience/_experience_item',
'cssFile' => null,
'template' => $this->renderPartial(
'/experience/_experiences_list',
array(),
true
),
'pager' => array(
'id' => 'pager-id',
'class' => 'ext.infiniteScroll.IasPager',
'rowSelector' => '.row',
'listViewId' => 'activities-scroll-list',
'header' => 'TESTE',
'loaderText' => 'Loading...',
'options' => array(
'history' => true,
'triggerPageTreshold' => 3,
'trigger' => 'Load more'
)
),
)
);
The /experience/_experiences_list:
<div class="row">
<div id="home-experience-resume" class="wrapper-k">
<?php
echo '{summary} {items} {pager}';
?>
</div>
</div>
The /experience/_experience_item:
<article class="column-3 <?= ((($index - 1) % 3) == 0 ? 'middle' : ''); ?> equal-height">
<div class="inner-wrapper">
<div class="img-container">
<img src="/images/tmp_thumbExperiencia1.jpg" alt="<?php echo Yii::t('home','Experiência 1'); ?>" />
</div>
<div class="info-column-container">
<div class="info-column">
<p class="more-detail-link">
<img src="/images/experiences/iconLocal.png" alt="icon local"/>
<?= $data->showingCity; ?>
</p>
<h3><?= $data->name; ?></h3>
<a class="button bt-small" href="/experience/info/<?php echo $data->id; ?>" target="_self"><?= Yii::t('home','Saber mais'); ?></a>
</div>
</div>
</div>
</article>

Use:
'template' => '<div class="row">div id="home-experience-resume" class="wrapper-k"> {summary} {items} {pager} </div></div>',

Related

Yii2 Dynamic Data is not loading on all DepDrop in dynamic field

I'm trying to create a dynamic form for one of my projects. I used wbraganca's Dynamic From to achieve this. In my dynamic form I have a DepDrop to show subcategories list from a parent category.
My _form.php
<?php $form = ActiveForm::begin(['id' => 'dynamic-form']); ?>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'rq_job_no')->textInput() ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'rq_req_date')->widget(\yii\jui\DatePicker::class, [
//'language' => 'ru',
'dateFormat' => 'php:Y-m-d',
'clientOptions' => [
'changeMonth' => true,
'changeYear' => true,
'showButtonPanel' => true,
'yearRange' => '1990:2030',
'minDate' => date('Y-m-d'),
],
'options' => ['class' => 'form-control', 'readOnly' => true, 'placeholder' => 'Enter the Item Required Date'],
]) ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'rq_priority_type')->dropDownList(['urgent' => 'Urgent', 'normal' => 'Normal'], ['prompt' => '--Select Priority Type--']) ?>
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
<?= $form->field($model, 'rq_approval_type')->dropDownList([1 => ' Approved Vendor Needed', 2 => 'Approved Submitted Needed', 3 => 'Warranty Certificate to be Collected', 4 => 'Long Lead Material',], ['prompt' => '--Select Type of Approval--']) ?>
<?php echo $form->field($model, 'rq_cat_type')->widget(Select2::class, [
'data' => $catData,
'options' => ['placeholder' => '--Select Request Type--', 'class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]);
?>
</div>
<div class="col-md-12">
<?= $form->field($model, 'rq_remarks')->textarea(['rows' => 6]) ?>
</div>
</div>
<!-- code for dynamic form -->
<div class="panel panel-default">
<div class="panel-heading">
<h4><i class="glyphicon glyphicon-envelope"></i> Request Items</h4>
</div>
<div class="panel-body">
<?php DynamicFormWidget::begin([
'widgetContainer' => 'dynamicform_wrapper', // required: only alphanumeric characters plus "_" [A-Za-z0-9_]
'widgetBody' => '.container-items', // required: css class selector
'widgetItem' => '.item', // required: css class
'limit' => 10, // the maximum times, an element can be cloned (default 999)
'min' => 1, // 0 or 1 (default 1)
'insertButton' => '.add-item', // css class
'deleteButton' => '.remove-item', // css class
'model' => $modelsAddress[0],
'formId' => 'dynamic-form',
'formFields' => [
'item_name',
'item_qty',
'item_unit',
],
]); ?>
<div class="container-items">
<!-- widgetContainer -->
<?php foreach ($modelsAddress as $i => $modelAddress) : ?>
<div class="item panel panel-default">
<!-- widgetBody -->
<div class="panel-heading">
<h4 class="panel-title pull-left">Items</h4>
<div class="pull-right">
<button type="button" class="add-item btn btn-success btn-xs"><i class="fa fa-plus"></i></button>
<button type="button" class="remove-item btn btn-danger btn-xs"><i class="fa fa-minus"></i></button>
</div>
<div class="clearfix"></div>
</div>
<div class="panel-body">
<?php
// necessary for update action.
if (!$modelAddress->isNewRecord) {
echo Html::activeHiddenInput($modelAddress, "[{$i}]rt_id");
}
?>
<?php //$form->field($modelAddress, "[{$i}]rt_item")->textInput(['maxlength' => true]) ?>
<?= $form->field($modelAddress, "[{$i}]rt_item")->widget(DepDrop::class, [
'options' => ['id' => 'reqitems-'.$i.'-rt_item'],
'pluginOptions' => [
'depends' => ['requests-rq_cat_type'],
'placeholder' => '--Select Location--',
'url' => Url::to(['/requests/subcat'])
]
]); ?>
<div class="row">
<div class="col-sm-6">
<?= $form->field($modelAddress, "[{$i}]rt_qty")->textInput(['maxlength' => true]) ?>
</div>
<div class="col-sm-6">
<?= $form->field($modelAddress, "[{$i}]rt_unit")->textInput(['maxlength' => true]) ?>
</div>
</div><!-- .row -->
</div>
</div>
<?php endforeach; ?>
</div>
<?php DynamicFormWidget::end(); ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
My Controller action to load the subcategory
public function actionSubcat()
{
Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
$out = [];
if (isset($_POST['depdrop_parents'])) {
$parents = $_POST['depdrop_parents'];
if ($parents != null) {
$cat_id = $parents[0];
$out = self::getSubCatList($cat_id);
return ['output' => $out, 'selected' => ''];
}
}
return ['output' => 'No Category Available', 'selected' => ''];
}
public function getSubCatList($cat_id)
{
$output = [];
$category = Item::find()->where(['item_category' => $cat_id])->orderBy('item_title')->all();
if (empty($category)) {
$output[] = ['id' => '0', 'name' => 'No Category Available'];
} else {
foreach ($category as $cat) {
$output[] = ['id' => $cat->item_id, 'name' => $cat->item_title];
}
}
return $output;
}
My problem is that DepDrop is only loading the subcategory for the first loop of the dynamic form and leaves the rest loop blank. Attached screenshot for your reference.
Can anyone help by pointing what I am missing or how can I achieve my requirement.

yii2 display error msg

displaying msg on above the line, how to display error msg below line. I have added below view page. any suggestions.
below is view page
<div class="ibox-content bwform clearfix" id="bwcart">
<h2><b>Profile</b><div id="loader"></div></h2>
<?php $form = ActiveForm::begin(
['action' =>'',
'options' => ['method'=>'post','class'=>'form-horizontal','id'=>'profile-form','enctype'=>'multipart/form-data'],
'fieldConfig' => [
'template' => "{label}<div class=\"col-md-12\">{input}\n{error}</div>",
'labelOptions' => ['class' => 'col-lg-12 control-label p-l-0'],
],
'enableAjaxValidation'=>true,'enableClientValidation' => true,'validateOnSubmit'=>true]); ?>
<div class="box-2">
<div class="input input--hoshi <?=$prefilled ?>">
<?= $form->field($model, 'firstname')->textInput(array('placeholder' => '','class'=>'input__field input__field--hoshi'))->label(false); ?>
<label class="input__label input__label--hoshi input__label--hoshi-color-3" for="first_name">
<span class="input__label-content input__label-content--hoshi">First Name</span>
</label>
</div>
</div>
<div class="box-2">
<div class="input input--hoshi <?=$prefilled ?>">
<?= $form->field($model, 'lastname')->textInput(array('placeholder' => '','class'=>'input__field input__field--hoshi'))->label(false); ?>
<label class="input__label input__label--hoshi input__label--hoshi-color-3" for="first_name">
<span class="input__label-content input__label-content--hoshi">Last Name</span>
</label>
</div>
</div>
You can use this solution:
<?php $form = ActiveForm::begin(
['action' =>'',
'options' => ['method'=>'post','class'=>'form-horizontal','id'=>'profile-form','enctype'=>'multipart/form-data'],
'fieldConfig' => [
//modify this
'template' => "{label}<div class='col-md-12'>{input}</div><div class='col-md-12 '>{error}</div>",
'labelOptions' => ['class' => 'col-lg-12 control-label p-l-0'],
],
'enableAjaxValidation'=>true,'enableClientValidation' => true,'validateOnSubmit'=>true]); ?>
So your error tag is positioned
under your input tag.
Your error attribute should not be in your col-md-12 class div.
So it should be like this:
<?php $form = ActiveForm::begin(
['action' =>'',
'options' => ['method'=>'post','class'=>'form-horizontal','id'=>'profile-form','enctype'=>'multipart/form-data'],
'fieldConfig' => [
'template' => "{label}<div class=\"col-md-12\">{input}</div>{error}",
'labelOptions' => ['class' => 'col-lg-12 control-label p-l-0'],
],
'enableAjaxValidation'=>true,'enableClientValidation' => true,'validateOnSubmit'=>true]); ?>

Separate php Array from main site

So, I have a page to display products which I named apple.php :
<?php
foreach($apple as $item) {
?>
<div class="col-lg-4 col-sm-4 col-xs-12 text-xs-center">
<div class="view third-effect">
<a href="<?php echo $item['link'] ?>">
<div class="overlay-thing"><i class="fa fa-share" aria-hidden="true"></i></div>
<img src="<?php echo $item['image'] ?>" />
</a>
</div>
<p><?php echo $item['name'] ?> </p>
</div>
<?php
}
?>
I use an hardcoded array which looks like this:
$apple = array(
array(
'id' => '1',
'name' => 'iPhone 4',
'link' => 'reparatur/apple/iphone-4.php',
'category' => 'iPhone',
'image' => 'images/iphone4.png'
),
array(
'id' => '2',
'name' => 'iPhone 4s',
'link' => 'reparatur/apple/iphone-4s.php',
'category' => 'iPhone',
'image' => 'images/iphone4s.png'
)
);
etc etc...
It has around 10 products.
This array is on top on the file, and I wonder how can I separate this array into an separate file, calling it for example products.php.
How can i then access that array in the file apple.php for the foreach loop.
Also, I will have arrays for samsung, sony products and should I put them all into the same file?
You could use include.
i.e. :
product.php
$apple = array(
array(
'id' => '1',
'name' => 'iPhone 4',
'link' => 'reparatur/apple/iphone-4.php',
'category' => 'iPhone',
'image' => 'images/iphone4.png'
),
array(
'id' => '2',
'name' => 'iPhone 4s',
'link' => 'reparatur/apple/iphone-4s.php',
'category' => 'iPhone',
'image' => 'images/iphone4s.png'
)
);
apple.php
<?php
include 'product.php';
foreach($apple as $item) {
?>
<div class="col-lg-4 col-sm-4 col-xs-12 text-xs-center">
<div class="view third-effect">
<a href="<?php echo $item['link'] ?>">
<div class="overlay-thing"><i class="fa fa-share" aria-hidden="true"></i></div>
<img src="<?php echo $item['image'] ?>" />
</a>
</div>
<p><?php echo $item['name'] ?> </p>
</div>
<?php
}
?>
Hope it helps.
Create a file apple-products.php or any name and add following lines:
<?php // apple-list.php
return array(
array(
'id' => '1',
'name' => 'iphone 4',
'link' => 'reparatur/apple/iphone-4.php',
'category' => 'iPhone',
'image' => 'image/iphone4.png',
),
array(
'id' => '2',
'name' => 'iphone 4s',
'link' => 'reparatur/apple/iphone-4s.php',
'category' => 'iPhone',
'image' => 'image/iphone4s.png',
),
);
Now in the top of apple.php file replace your array with this:
$apple = require('apple-products.php'); // assuming apple.php and apple-products.php are in same directory
That's it. Hope that helped!

Upload photo with thumbnail preview, using codeigniter

How can i make a registration form where i upload an image for my profile picture, and before clicking register, there's a preview of the image that i want to set as the profile picture using CI??
here's my registration form code
register_model.php
<?php
class Register_model extends CI_Model
{
function create_user($photo_name)
{
$new_user_insert_data = array(
'id' => '',
'email' => $this->input->post('email'),
'password' => md5($this->input->post('password')),
'name' => $this->input->post('name'),
'major' => $this->input->post('user_major'),
'year' => $this->input->post('user_year'),
'bio' => $this->input->post('bio'),
'profpic' => $photo_name,
'insta' => $this->input->post('instagram'),
'twitter' => $this->input->post('twitter'),
'facebook' => $this->input->post('facebook'),
'vote_count' => '10',
'vote' => '0',
'gender' => $this->input->post('gender'),
);
$insert = $this->db->insert('user', $new_user_insert_data);
return $insert;
}
}
?>
Here's the view
register.php
<div class="margin-top-87">
<div class="container">
<h1>Register</h1>
<hr>
<div class="row">
<!-- left column -->
<div class="col-md-3">
<div class="text-center">
<img src="//placehold.it/100" class="avatar img-circle" alt="avatar">
<?php
if(!empty($_FILES['userfile'])){
$name_array = array();
$count = count($_FILES['userfile']['size']);
foreach($_FILES as $key => $value)
for ($s=0; $s<=$count-1; $s++)
{
//Original Image Upload - Start
$_FILES['userfile']['name'] = $value['name'][$s];
$_FILES['userfile']['type'] = $value['type'][$s];
$_FILES['userfile']['tmp_name'] = $value['tmp_name'][$s];
$_FILES['userfile']['error'] = $value['error'][$s];
$_FILES['userfile']['size'] = $value['size'][$s];
$config['upload_path'] = './public/images/campaign-images/';
$config['allowed_types'] = 'gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG';
$config['max_size'] = '10000';
//$config['max_width'] = '1024';
//$config['max_height'] = '768';
$CI->load->library('upload', $config);
$CI->upload->do_upload();
$data = $CI->upload->data();
//Original Image Upload - End
//Thumbnail Image Upload - Start
$config['image_library'] = 'gd2';
$config['source_image'] = './public/images/campaign-images/'. $value['name'][$s];
$config['new_image'] = './public/images/campaign-images/thumbs/'.$value['name'][$s];
$config['width'] = 350;
$config['height'] = 250;
//load resize library
$this->load->library('image_lib', $config);
$this->image_lib->resize();
//Thumbnail Image Upload - End
$name_array[] = $data['file_name'];
}
return $name_array;
}
?>
<h6>Please use real photo, not an avatar</h6>
<?php
$data= array
(
'name' => 'userfile',
'type' => 'file',
'class' => 'form-control',
'id' => 'form_register'
);
echo form_upload($data);
?>
</div>
</div>
<!-- edit form column -->
<div class="col-md-9 personal-info">
<div class="alert alert-info fade in">
<strong>Info!</strong> Please fill with real information of yours.
</div>
<?php
if(validation_errors('<p class="error">'!=""))
{?>
<div class="alert alert-danger fade in">
×
<strong>Attention!</strong> <?php echo validation_errors('<p class="error">') ?>
</div><?php
}?>
<h3>Personal info</h3>
<?php $attributes = array('class' => 'form-horizontal', 'role' => 'form', 'id' => 'form_register'); echo form_open('index/create_user',$attributes); ?>
<div class="form-group">
<label class="col-lg-3 control-label">UC Student email :</label>
<div class="col-lg-8">
<?php
$data= array
(
'name' => 'email',
'placeholder' => 'Ciputra student email. Example : email#student.ciputra.ac.id',
'type' => 'email',
'class' => 'form-control',
'required' => 'required'
);
echo form_input($data);
?>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Name :</label>
<div class="col-lg-8">
<?php
$data= array
(
'name' => 'name',
'placeholder' => 'Full name. Example : Front Middle Last',
'type' => 'text',
'class' => 'form-control',
'required' => 'required'
);
echo form_input($data);
?>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Gender :</label>
<div class="col-lg-8">
<div class="ui-select">
<?php
$options = array
(
'' => 'Gender',
'Man' => 'Man',
'Woman' => 'Woman'
);
echo form_dropdown('gender', $options, '', 'class="form-control"');
?>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Major :</label>
<div class="col-lg-8">
<div class="ui-select">
<?php
$options = array
(
'' => 'Insert your major',
'CB' => 'CB',
'FDB' => 'FDB',
'IBM-IC' => 'IBM-IC',
'IBM-RC' => 'IBM-RC',
'IBA' => 'IBA',
'IHTB' => 'IHTB',
'IMT' => 'IMT',
'INA' => 'INA',
'MCM' => 'MCM',
'MIS' => 'MIS',
'PSY' => 'PSY',
'VCD' => 'VCD'
);
echo form_dropdown('user_major', $options, '', 'class="form-control"');
?>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Year :</label>
<div class="col-lg-8">
<div class="ui-select">
<?php
$options = array('' => 'Year joined UC');
for ($i = date('Y'); $i >= 2006; $i--)
{
$options[$i] = $i;
}
echo form_dropdown('user_year', $options, '', 'class="form-control"');
?>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Password :</label>
<div class="col-md-8">
<?php
$data= array
(
'name' => 'password',
'placeholder' => 'Password',
'type' => 'password',
'class' => 'form-control',
'required' => 'required',
'maxlength' => '15'
);
echo form_password($data);
?>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Confirm password :</label>
<div class="col-md-8">
<?php
$data= array
(
'name' => 'cpassword',
'placeholder' => 'Confirm Password',
'type' => 'password',
'class' => 'form-control',
'required' => 'required',
'maxlength' => '15'
);
echo form_password($data);
?>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Short Bio :</label>
<div class="col-lg-8">
<?php
$data= array
(
'name' => 'bio',
'placeholder' => 'Short bio (max 128 character)',
'type' => 'text',
'class' => 'form-control',
'maxlength' => '128',
'rows' => '3'
);
echo form_textarea($data);
?>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Facebook :</label>
<div class="col-lg-8">
<?php
$data= array
(
'name' => 'facebook',
'placeholder' => 'Facebook Profile link. Example : facebook.com/name',
'type' => 'url',
'class' => 'form-control',
);
echo form_input($data);
?>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Twitter :</label>
<div class="col-lg-8">
<?php
$data= array
(
'name' => 'twitter',
'placeholder' => 'Twitter Profile link. Example : #name',
'type' => 'url',
'class' => 'form-control',
);
echo form_input($data);
?>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Instagram :</label>
<div class="col-lg-8">
<?php
$data= array
(
'name' => 'instagram',
'placeholder' => 'Instagram Profile link. Example : #name',
'type' => 'url',
'class' => 'form-control',
);
echo form_input($data);
?>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-8">
<?php
$data= array
(
'name' => 'register',
'value' => 'Register',
'type' => 'submit',
'class' => 'btn btn-primary',
);
echo form_submit($data);
?>
<span></span>
<?php
$data= array
(
'name' => 'reset',
'value' => 'Clear',
'type' => 'reset',
'class' => 'btn btn-default',
);
echo form_reset($data);
?>
</div>
</div>
</form>
<?php echo form_close(); ?>
</div>
</div>
</div>
<hr>
</div>
The "preview before uploading" thing is a javascript trick that loads the local file into the <img> source. The rest is simple file upload where you check the file types, size, resolution etc.
Here is your answer: Preview an image before it is uploaded

CGridView styling specific column, inserting <div> inside <td> elements

I’m trying to apply custom styling to specific columns generated by CGridView. I need to insert inside the elements, but I can’t figure out how to do it.
Here is the view file:
<div id="shortcodes" class="page">
<div class="container">
<!-- Title Page -->
<div class="row">
<div class="span12">
<div class="title-page">
<h2 class="title">Available Products</h2>
</div>
</div>
</div>
<!-- End Title Page -->
<!-- Start Product Section -->
<div class="row">
<?php
$this->widget('bootstrap.widgets.TbGridView', array(
'id' => 'products-grid',
'dataProvider' => $dataProvider,
'ajaxUpdate' => TRUE,
'pager' => array(
'header' => '',
'cssFile' => false,
'maxButtonCount' => 25,
'selectedPageCssClass' => 'active',
'hiddenPageCssClass' => 'disabled',
'firstPageCssClass' => 'previous',
'lastPageCssClass' => 'next',
'firstPageLabel' => '<<',
'lastPageLabel' => '>>',
'prevPageLabel' => '<',
'nextPageLabel' => '>',
),
'columns' => array(
'id',
'name',
'category',
'brand',
'weight_unit',
'price_unit',
'flavors',
array(
'name' => 'providers',
'htmlOptions' => array('class' => 'label label-info'),
),
),
));
?>
</div>
<!-- End Product Section -->
</div>
</div>
So I want to style the column named “providers”. Using htmlOptions does add the class to the td column, but the alignment of the column is getting out of place. That’s why I wanted to wrap it inside a <div>, to apply the proper alignments and styling.
Right now it appears like this:
<tr class="even">
<td>414</td>
<td>Owl Book</td>
<td>Night Owl Trance</td>
<td>Binaural Beats</td>
<td> 400 Grams</td>
<td>$569.66</td>
<td>Ether</td>
<td class="label label-info">Shrooms.com</td>
</tr>
What I was looking to do is this:
<tr class="even">
<td>414</td>
<td>Owl Book</td>
<td>Night Owl Trance</td>
<td>Binaural Beats</td>
<td> 400 Grams</td>
<td>$569.66</td>
<td>Ether</td>
<td><div class="label label-info">Shrooms.com</div></td>
</tr>
So, how would I do this? Is there an option for it? As far as I know, htmlOptions will only add attributes to the element.
Not tested, but I think you can use something like this.
'flavors',
array(
'name' => 'providers',
'value' => "<div class=label label-info>$data->providers</div>"
),
Ok, i first tried redGREENblue's answer, but i gives a Undefined variable: data
'value' => ''.$data->providers.'',.
Then after some advice in the Yii forums i found the solution. Basically what i did was return the value from within a function closure, and it worked,
The working code ::
<div id="shortcodes" class="page">
<div class="container">
<!-- Title Page -->
<div class="row">
<div class="span12">
<div class="title-page">
<h2 class="title">Available Products</h2>
</div>
</div>
</div>
<!-- End Title Page -->
<!-- Start Product Section -->
<div class="row">
<?php
$this->widget('bootstrap.widgets.TbGridView', array(
'id' => 'products-grid',
'dataProvider' => $dataProvider,
'filter' => $dataProvider->model,
'ajaxUpdate' => TRUE,
'pager' => array(
'header' => '',
'cssFile' => false,
'maxButtonCount' => 25,
'selectedPageCssClass' => 'active',
'hiddenPageCssClass' => 'disabled',
'firstPageCssClass' => 'previous',
'lastPageCssClass' => 'next',
'firstPageLabel' => '<<',
'lastPageLabel' => '>>',
'prevPageLabel' => '<',
'nextPageLabel' => '>',
),
'columns' => array(
'id',
'name',
'category',
'brand',
'weight_unit',
'price_unit',
'flavors',
array(
'name' => 'providers',
'value' => function($data) { //*the closure that works*
return '<div class="label label-info">'.$data->providers.'</div>';
},
'type' => 'raw',
),
),
));
?>
</div>
<!-- End Product Section -->
</div>

Categories