My Blog';
// Get metadata on all posts from the metadata.json file
include_once('_functions/loadJSON.php');
$contentCol .= loadHomepageJSON('_data/metadata.json');
// Create a template
include_once('_classes/Template.php');
$template = new Template(
$GLOBALS['fullDomain'],
'Explore the thoughts of...',
'Blog | YourName',
'',
$contentCol,
''
);
// Echo the HTML to the user
$template->echoTemplate();
}
function showPost($params)
{
// URL Parameter
$query = $params[0];
// Get metadata on this post from the metadata.json file
include_once('_functions/loadJSON.php');
$headerData = loadPostJSON('_data/metadata.json', $query);
// Apply metadata to post header
$header = '
';
$userComments .= loadCommentJSON('_data/comments.json');
$userComments .= '';
// Combine comment form and previous user comments
$commentSection = $commentHeader . $userComments;
// Create a template
include_once('_classes/Template.php');
$template = new Template(
$GLOBALS['fullDomain'] . '/comments/',
'Read through some recent comments for blog posts at ' . $GLOBALS['fullDomain'] . '.',
'Recent Comments | Blog',
'',
'',
$commentSection
);
// Echo the HTML to the user
$template->echoTemplate();
}
function showCategory()
{
// Open the article list
$contentCol = '
Categories
';
// Get metadata on all posts from the metadata.json file
include_once('_functions/loadJSON.php');
$contentCol .= loadCategoryJSON('_data/metadata.json');
// Create a template
include_once('_classes/Template.php');
$template = new Template(
$GLOBALS['fullDomain'] . '/categories/',
'Browse the categories for blog posts at ' . $GLOBALS['fullDomain'] . '.',
'Categories | Blog',
'',
$contentCol,
''
);
// Echo the HTML to the user
$template->echoTemplate();
}
function showRSS()
{
// Loop through the metadata file and display any article that is published
include_once('_functions/loadRSS.php');
$rssContents = loadRSS('_data/metadata.json');
// Echo the RSS XML
header('Content-type: text/xml');
echo $rssContents;
die();
}
function showRobots()
{
header('Content-type: text/plain');
echo 'User-agent: * Disallow:';
die();
}
Comments
'; $userComments .= loadCommentJSON('_data/comments.json', $query); $userComments .= '