<div class="w3-col l2 m4 s12 w3-hide-small">

<div id="saccordion" style="font-size:14px;">
<?php
$loc = str_replace('/', '', PATH);
include(BASE);
$getcatext = $dbc->query("SELECT * FROM `categlinks` WHERE `catext_loc`='{$loc}' ORDER BY `sort` ASC") or die($dbc->error);

if($getcatext->num_rows > 0){
while($rwcatex = $getcatext->fetch_assoc()){ 
?>

<div class="card">
<a class="collapsed w3-button w3-bluepm w3-hover-seagreen" data-toggle="collapse" href="#<?=$rwcatex['catext_seo']?>">
<?=$rwcatex['catext_name']?>
</a>

<div id="<?=$rwcatex['catext_seo']?>" class="collapse<?php if($rwcatex['sort'] === '1'){echo ' show';}?>" data-parent="#saccordion">
<div class="w3-bar w3-bar-block">
<?php   
$getlinkext = $dbc->query("SELECT * FROM `extlinks` WHERE `catext_id`='".$rwcatex['catext_id']."' ORDER BY `sort` ASC") or die($dbc->error);
if($getlinkext->num_rows > 0){
    while($rwlnk = $getlinkext->fetch_assoc()){
        echo '<a href="'.$rwlnk['extl_url'].'" class="w3-bar-item w3-button" target="'.$rwlnk['extl_target'].'">'.$rwlnk['extl_name'].'</a>';
    }
}
?>
</div>
</div>

</div>
<?php  } } $dbc->close(); ?>
</div>

</div>

<div class="w3-col l10 m8 s12">
<iframe height="800px" width="100%" src="<?php
include(BASE);
$getfcatextdf = $dbc->query("SELECT `catext_id` FROM `categlinks` WHERE `catext_loc`='{$loc}'") or die($dbc->error);
if($getfcatextdf->num_rows > 0){
    while($rci = $getfcatextdf->fetch_assoc()){
        
        $gtdefirst = $dbc->query("SELECT * FROM `extlinks` WHERE `extl_default`='1' AND `catext_id`='{$rci['catext_id']}' LIMIT 1") or die($dbc->error);
$rwfirst = $gtdefirst->fetch_assoc();
echo $rwfirst['extl_url'];

    }



 }
$dbc->close();
?>" name="mainFrame" style="border:none;

"></iframe>
</div>

<script>
function myFunction(id) {
  var x = document.getElementById(id);
  if (x.className.indexOf("w3-show") == -1) {
    x.className += " w3-show";
  } else { 
    x.className = x.className.replace(" w3-show", "");
  }
}
</script>