<?php
$ver = '3.1';
/* -------------------------------------------------------------------
| last update 09/12/2022
| ----------------------------------------------------------------- */
include_once('includes/config.inc.php');
include_once(SITE_ROOT.'includes/functions.inc.php');
//$DEBUG=1;
		$_SESSION['DEBUG_MESSAGE'] .= '<br>Index Version: '.$ver;
		
$id = (empty($_GET['id'])) ? get_home_page_alias() : $_GET['id'];
 $content = get_reponsive_page_content($id);
  
 /*  Content array
$pageTitle
$text
$mainImage
$browser_title
$meta_description
$meta_keywords
$not_found,
$row['id']
$row['stocklist']
$row['include_carousel']
$row['include_location']
$row['include_latest_stock']
$row['include_news']); 
 */
   	$pageTitle = (empty($content[0])) ? SITE_NAME : $content[0];
	 $text = $content[1];
	  $image = $content[2];
	   $browser_title = (empty($content[3])) ? SITE_NAME : $content[3];
	    $meta_description = (empty($content[4])) ? META_DESCRIPTION : $content[4];
	     $meta_keywords = (empty($content[5])) ? META_KEYWORDS : $content[5];
	      $not_found = $content[6];
	       $page_id = $content[7]; 	  
	  //System created panels
	  $include_stocklist = $content[8];
	   $include_carousel = $content[9];
	   	$include_location = $content[10];
	     $include_slider = $content[11];
		  $include_news = $content[12];
		 
// is there no content 
	if  ($not_found ==TRUE)  {		
			$default_url = get_home_page_alias();
			Header("Location:http://".$_SERVER['HTTP_HOST']."/content/".$default_url);
			exit();
	} 		 
include_once(SITE_ROOT.'includes/header.inc.php');
$pageTitle = (empty($pageTitle)) ? '' : '<h1>'.$content[0].'</h1>';
if ($include_carousel) {
		include_once(SITE_ROOT.'includes/top_panel.inc.php');	
}
?>
<div class="container" id="content">
	<div class="row">
	  <div class="col-md-12"> 
		<?=$pageTitle; ?>
		<?=$image; ?>
		<?=$text; ?>
	  </div>
	</div>
</div><!-- ends content div -->
<?php
if ($include_stocklist) {
	include_once(SITE_ROOT.'includes/stocklist_panel.inc.php');
}
if ($include_slider) {
	include_once(SITE_ROOT.'includes/latest_stock_slider_panel.inc.php');
}
if ($include_location) {
	include_once(SITE_ROOT.'includes/location_panel.inc.php');
}
include_once(SITE_ROOT.'includes/footer.inc.php');
?> 
