I am looking for some basic PHP help with an IF statement.
The code below, says IF window is less than 1024, use the following table details for the arrays. There are two arrays at the bottom. However, I want to use different table details for each array.
So, I want to say ‘IF’ window is less than 1024 && it is array 1 below, use this code. Else, if it is array 2, use this other code.
I can’t figure out how to reference the different arrays. Any help appreciated.
<?php
/*Add Headers for responsive*/
$this->registerJs('$("document").ready(function () {
var alterRTabelHeaders = function () {
var resultCount = "' . $resultCount . '";
var ww = document.body.clientWidth;
if (resultCount > 0) {
if (ww < 1024) {
$("table.fold-table td:nth-of-type(1)").attr("data-before", "#");
$("table.fold-table td:nth-of-type(2)").attr("data-before", "Action");
$("table.fold-table td:nth-of-type(3)").attr("data-before", "Fields Changed");
$("table.fold-table td:nth-of-type(4)").attr("data-before", "Action Date");
$("table.fold-table td:nth-of-type(5)").attr("data-before", "By");
}
}
};
$(window).resize(function () {
alterRTabelHeaders();
});
alterRTabelHeaders();
});');
echo Tabs::widget([
'items' => [
array(
'label' => 'Quotes (' . count($model->quotes) . ')',
'content' => $this->render('quotes', ['dataProvider' => $dataProvider]),
),
array(
'label' => 'Changelog (' . count($model->feeds) . ')',
'content' => $this->render('feeds', ['feedDataProvider' => $feedDataProvider, 'feedSearch' => $feedSearch]),
)
],
'options' => array(
'class' => 'tabbable tabs-left ui-tabs-vertical ui-helper-clearfix ui-tabs-vertical'
)
]);
?>