Exemplo n.º 1
0
<?php

// To be used in the footer to enable comments at the bottom of the blog
$commentType = "viewpost";
include_once "classes/config.inc.php";
// Check to see if user is logged in or out
$loggedIn = $user->is_logged_in();
$stmt = $db->prepare('SELECT postID, postSlug, postTitle, postDesc, postCont, postDate FROM blog_posts WHERE postSlug = :postSlug');
$stmt->execute(array(':postSlug' => $_GET['id']));
$row = $stmt->fetch();
$pageTitle = $row['postTitle'] . " | AMStevenson blogs";
// Meta description - for viewing a post, have made this the post description for now
$metaDescription = setMetaDescription($row['postDesc']);
include_once "includes/header.php";
// If we do not get any rows returned from the database, redirect back one page
if ($row['postID'] == '') {
    header('Location: ./');
    exit;
}
// Set up wrapper structure
echo ' <section id="wrapper">
                        <header>
                            <div class="inner">
                                <h2>' . $row['postTitle'] . '</h2>
                            </div>
                        </header>

                        <div class="wrapper" >
                            <div class="inner" >

                                <section>
Exemplo n.º 2
0
/**
 * Set meta
 */
function setMetaDescAndKwords()
{
    // Get content //////////////////////////////////////////////////////////////
    if (!isset($_GET[getLgFileText("CONTENT")])) {
        setMetaDescription(LINK_CNT_CAT_0);
        setMetaKeywords(LINK_CNT_CAT_0);
    } else {
        if ($_GET[getLgFileText("CONTENT")] == getLgFileText("MAP")) {
            setMetaDescription('', getLgFileText("SITE_NAME") . ', ' . getLgFileText("MAP"), true);
            setMetaKeywords('', getLgFileText("SITE_NAME") . ', ' . getLgFileText("MAP"), true);
        } else {
            $content = $_GET[getLgFileText("CONTENT")];
            //echo "CNT: ".$content;
            // Get language file
            $lang_array = parse_ini_file(LINK_LANG);
            // Get language array keys
            $lang_array_keys = array_keys($lang_array);
            $nbCat2 = count($lang_array_keys);
            $done = false;
            // Loop on number of keys
            for ($j = 0; $j < $nbCat2; $j++) {
                // Get only categories
                if (substr($lang_array_keys[$j], 0, 3) == "CAT") {
                    // Get category, trimed and where spaces are replaced by dashes
                    $lineL = $lang_array_keys[$j];
                    // Main categories
                    if (strlen($lineL) == 5) {
                        if ($content == getLgFileTextForUrl($lineL)) {
                            setMetaDescription(constant("LINK_CNT_" . $lineL));
                            setMetaKeywords(constant("LINK_CNT_" . $lineL));
                            $done = true;
                        }
                        $cat = $lineL;
                    } else {
                        if (strlen($lineL) == 7) {
                            if ($content == getLgFileTextForUrl($cat) . ">" . getLgFileTextForUrl($lineL)) {
                                setMetaDescription(constant("LINK_CNT_" . $lineL));
                                setMetaKeywords(constant("LINK_CNT_" . $lineL));
                                $done = true;
                            }
                        }
                    }
                }
            }
            if (!$done) {
                setMetaDescription("");
                setMetaKeywords("");
            }
        }
    }
    if ($content == getLgFileText("MAP")) {
        setMetaDescription('', getLgFileText("SITE_NAME") . ', ' . getLgFileText("MAP"));
        setMetaKeywords('', getLgFileText("SITE_NAME") . ', ' . getLgFileText("MAP"));
    }
}