Example #1
0
<?php

$id = mysqli_real_escape_string(db_connect(), $_GET['id']);
$info = new Category();
$category = $info->category_load($id);
if (!empty($_POST)) {
    $title = $_POST['title'];
    $description = $_POST['description'];
    $featured = $_POST['featured'];
    $metadescription = $_POST['metadescription'];
    $metakeywords = $_POST['metakeywords'];
    $info->category_save($id, '' . $title . '', '' . $description . '', '' . $featured . '', '' . $metadescription . '', '' . $metakeywords . '');
}
?>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <h1 class="page-header">Category: <?php 
echo $category['title'];
?>
</h1>
    <form class="form-horizontal" enctype="multipart/form-data" method="post" accept-charset="utf-8" action="<?php 
echo BASE_URL;
?>
/admin/categories/edit?id=<?php 
echo $id;
?>
">

        <div class="form-group">
            <label for="title" class="col-sm-2 control-label">Title</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="title" name="title" placeholder="Title" value="<?php 
Example #2
0
 public static function metainfo()
 {
     $routing_uri = $_SERVER['REQUEST_URI'];
     /* Contact */
     if (strpos($routing_uri, '/contact') !== FALSE) {
         echo '<meta name="description" content="' . METADESCRIPTION . '">';
         echo '<meta name="keywords" content="' . METAKEYWORDS . '">';
     } elseif (strpos($routing_uri, '/category') !== FALSE) {
         $category_id = explode("/", $routing_uri);
         if (is_numeric($category_id[2])) {
             $id = mysqli_real_escape_string(db_connect(), $category_id[2]);
         } else {
             $id = mysqli_real_escape_string(db_connect(), $category_id[3]);
         }
         $category_lookup = new Category();
         $category = $category_lookup->category_load($id);
         if (!empty($category['metadescription'])) {
             echo '<meta name="description" content="' . $category['metadescription'] . '">';
         } else {
             echo '<meta name="description" content="' . METADESCRIPTION . '">';
         }
         if (!empty($category['metakeywords'])) {
             echo '<meta name="keywords" content="' . $category['metakeywords'] . '">';
         } else {
             echo '<meta name="keywords" content="' . METAKEYWORDS . '">';
         }
     } elseif (strpos($routing_uri, '/blog') !== FALSE) {
         $post_id = explode("/", $routing_uri);
         $id = mysqli_real_escape_string(db_connect(), $post_id[2]);
         $post_class = new Post();
         $post = $post_class->post_load($id);
         if (!empty($post['metadescription'])) {
             echo '<meta name="description" content="' . $post['metadescription'] . '">';
         } else {
             echo '<meta name="description" content="' . METADESCRIPTION . '">';
         }
         if (!empty($post['metakeywords'])) {
             echo '<meta name="keywords" content="' . $post['metakeywords'] . '">';
         } else {
             echo '<meta name="keywords" content="' . METAKEYWORDS . '">';
         }
     } elseif (strpos($routing_uri, '/index.php') !== FALSE) {
         echo '<meta name="description" content="' . METADESCRIPTION . '">';
         echo '<meta name="keywords" content="' . METAKEYWORDS . '">';
     } elseif (strpos($routing_uri, '/') !== FALSE) {
         $page = explode("/", $routing_uri);
         if (empty($page[1])) {
             echo '<meta name="description" content="' . METADESCRIPTION . '">';
             echo '<meta name="keywords" content="' . METAKEYWORDS . '">';
         } else {
             $page_slug = explode("/", $routing_uri);
             $slug = mysqli_real_escape_string(db_connect(), $page_slug[1]);
             $slug = strtok($slug, '?');
             $page_lookup = new Page();
             $page = $page_lookup->page_load_slug($slug);
             if (!empty($page['metadescription'])) {
                 echo '<meta name="description" content="' . $page['metadescription'] . '">';
             } else {
                 echo '<meta name="description" content="' . METADESCRIPTION . '">';
             }
             if (!empty($page['metakeywords'])) {
                 echo '<meta name="keywords" content="' . $page['metakeywords'] . '">';
             } else {
                 echo '<meta name="keywords" content="' . METAKEYWORDS . '">';
             }
         }
     } else {
         echo '<meta name="description" content="' . METADESCRIPTION . '">';
         echo '<meta name="keywords" content="' . METAKEYWORDS . '">';
     }
 }
Example #3
0
<?php

$routing_uri = $_SERVER['REQUEST_URI'];
$category_id = explode("/", $routing_uri);
if (is_numeric($category_id[2])) {
    $id = mysqli_real_escape_string(db_connect(), $category_id[2]);
} else {
    $id = mysqli_real_escape_string(db_connect(), $category_id[3]);
}
$category_lookup = new Category();
$category = $category_lookup->category_load($id);
if (empty($category['featured'])) {
    $category['featured'] = DEFAULT_FEATURED_IMAGE;
}
?>
<header class="intro-header" style="background-image: url('<?php 
echo BASE_URL;
?>
/gw-content/uploads/<?php 
echo $category['featured'];
?>
')">&nbsp;</header>
<div class="container">
    <h1 class="page-header"><?php 
echo $category['title'];
?>
</h1>
    <p><?php 
if (!empty($category['description'])) {
    echo $category['description'];
}