Here i am having one Nav Tabs
section ,and based tab section i have to display the product heading if i am giving static value like
- Computer Accessories
- Electronic
TABS
<!-- Nav tabs START-->
<ul class="nav nav-tabs tabs-left sideways">
<li><a href="#Computer Accessories" data-toggle="tab">Computer Accessories</a></li>
<li><a href="#Electronic" data-toggle="tab">Electronic</a></li>
</ul>
<!-- Nav tabs END-->
DISPLAY SECTION
<!-----Computer Accessories categoryName Start---------->
<div class="tab-pane" id="Computer Accessories">
<div class="row">
<div class="col-sm-3">
<h1>Prodcut 1</h2>
</div>
</div>
</div>
<!-----Computer Accessories categoryName End---------->
<!-----Electronic categoryName Start---------->
<div class="tab-pane" id="Electronic">
<div class="row">
<div class="col-sm-3">
<h1>Prodcut 2</h2>
</div>
<div class="col-sm-3">
<h1>Prodcut 3</h2>
</div>
</div>
</div>
<!-----Electronic categoryName End---------->
Now i am giving static values Computer Accessories
and Electronic
so It is working fine, but for me don't want static value , i have to give dynamic categoryName
value
print_r($mainArray)
{
"status": "success",
"message": "Total 4 record(s) found.",
"total_record": 4,
"data": [
{
"categoryName": "Computer Accessories",
"categoryId": "4",
"products": [
{
"productId": "Prodcut 1",
"Galery": [
{
"gId": "10",
"productId": "4",
"prodcutImage": "2df674d73106dfc64777c75818eb4359.jpg"
}
],
"discountType": "Percentage",
}
]
},
{
"categoryName": "Electronic",
"categoryId": "1",
"products": [
{
"productId": "Prodcut 2",
"Galery": [
{
"gId": "10",
"productId": "4",
"prodcutImage": "2df674d73106dfc64777c75818eb4359.jpg"
},
{
"gId": "11",
"productId": "4",
"prodcutImage": "65458600d6b7b9df1a38a9341ad2336b.jpg"
}
],
"discountType": "NA",
},
{
"productId": "Prodcut 3",
"Galery": [
{
"gId": "10",
"productId": "4",
"prodcutImage": "2df674d73106dfc64777c75818eb4359.jpg"
}
],
"discountType": "Percentage",
}
]
}
]
}
Using above array dynamically we have to display the tabs
as well tabs section
, if any one know means please update my answer
My Updated answer
<ul class="nav nav-tabs">
<?php foreach ($arr['data'] as $string) {
echo ' <li><a href="'.$string['categoryName'].'" data-toggle="tab">'.$string['categoryName'].'</a></li>';
}
?>
</ul>