예제 #1
0
파일: index.php 프로젝트: nfell2009/profile
?>
</h3>
			</div>
	    </div>
	</div>

	 <div class="container mtb">
	 	<div class="row">
	 		<div class="col-lg-8"><h3 class="ctitle">Abandoned</h3><p>Yeah this is pretty much abandoned.. Sorry.</p></div>
			<div class="col-lg-8">
				<?php 
include "includes/blog.php";
$blogContent = $cache->get("home_page_blog");
if (!isset($blogContent) || empty($blogContent) || $blogContent == null) {
    ob_start();
    $res = getBlogData();
    if (empty($res) || $res->num_rows < 1) {
        echo "<h4>There's nothing here yet!</h4>";
    } else {
        while ($row = $res->fetch_assoc()) {
            ?>
								<h3 class="ctitle"><?php 
            echo ucwords($row['Title']);
            ?>
</h3>
								<p><csmall><?php 
            echo ucwords(convertDate($row['Date']));
            ?>
</csmall> | <csmall2>By: <?php 
            echo ucwords($row['Author']);
            ?>
<?php

// load configuration
require_once "../setBackendPath.php";
require_once $backendPath . "config.php";
require_once $backendPath . 'securityFunctions.php';
require_once "commonWeb.php";
//$dataId is the tag name
$dataId = isset($_GET["id"]) ? $_GET["id"] : "";
//array of blog-data
$blogDataArray = getBlogData($dataId);
function getBlogData($marketName)
{
    //create client
    $consumerKey = "Add your Key";
    $consumerSecret = "Add Secret key";
    $blogName = 'yr_username.tumblr.com';
    $client = new Tumblr\API\Client($consumerKey, $consumerSecret);
    $response = $client->getBlogPosts($blogName, array('tag' => $marketName));
    // get posts
    $posts = $response->posts;
    $blogs = $response->blog;
    global $dataId;
    $x = 0;
    foreach ($posts as $post) {
        if (isset($post->title)) {
            if (isset($post->body)) {
                $dataArray[] = array('imageSrc' => getImgSrc($post->body, "<img", "/>"), 'title' => $post->title, 'tags' => convertTagsIntoString(array_map('strval', $post->tags)), 'description' => trimblanklines(trimblankspaces(shortenedDescription(getDescription($post->body, "</p>", $dataId), 250))), 'postId' => $post->id);
            }
        }
        $x++;