<?php require_once 'includes/main.php'; ?>
<?php require_once 'elements/head.php'; ?>

<!-- META: TITLE -->
<title><?php echo $set['index_title']; ?> - <?php echo $set['website_name']; ?></title>

<!-- META: OTHER -->
<meta name="description" content="<?php echo $set['index_description']; ?>" />
<meta name="keywords" content="<?php echo $set['index_keywords']; ?>" />
<!-- SEO -->

<!-- META: GRAPH -->
<meta property="og:url"                content="<?php echo URL; ?>" />
<meta property="og:type"               content="website" />
<meta property="og:title"              content="<?php echo $set['index_title']; ?> - <?php echo $set['website_name']; ?>" />
<meta property="og:description"        content="<?php echo $set['index_description']; ?>" />

</head>

<body>

<?php include_once 'elements/header.php'; ?>

<!-- CONTENT -->
<section class="Content">

   <h2 class="GLOB-Title">Listings: <span class="FR"><?php echo comma_number(fetch_record("SELECT COUNT(id) FROM listings WHERE status = 'active'")); ?></span></h2>

   <?php $sql = "SELECT * FROM listings WHERE status = 'active' AND points > 0 ORDER BY points DESC LIMIT {$per['listings']}"; ?>

   <!-- APPEND -->
   <section id="append">
      <?php fetch_elements($sql, 'elements/listings/main.php', 'a'); ?>
   </section>
   <!-- APPEND -->

   <!-- MORE -->
   <?php if(fetch_rows($sql) == $per['listings']){ ?>
      <div class="MORE">
         <button onclick="loadMore(this, 'ex/more.listings.php', '.Listings');">Load More</button>
      </div>
   <?php } ?>
   <!-- MORE -->

</section>
<!-- CONTENT -->

<?php include_once 'elements/sidebar/main.php'; ?>

<?php include_once 'elements/footer.php'; ?>

</body>
</html>
