forked from Chaospott/site
added a few articles, added media
This commit is contained in:
89
_site/tmp/var/www/chaospott.de/example-templates/main.php
Normal file
89
_site/tmp/var/www/chaospott.de/example-templates/main.php
Normal file
@ -0,0 +1,89 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="apple-touch-icon-precomposed" href="/apple-touch-icon.png"/>
|
||||
<title><?=
|
||||
(isset($content['post']) ? h($content['post']['post-title']) . ' – ' : '') .
|
||||
($content['page-title'] != $content['blog-title'] && (
|
||||
$content['page-type'] == 'page' || $content['page-type'] == 'archive' || $content['page-type'] == 'tag' || $content['page-type'] == 'type'
|
||||
) ? h($content['page-title']) . ' – ' : '') .
|
||||
h($content['blog-title'])
|
||||
?></title>
|
||||
|
||||
<? if ($content['page-type'] != 'frontpage' && $content['page-type'] != 'page' && $content['page-type'] != 'post') { ?>
|
||||
<meta name="robots" content="noindex"/>
|
||||
<? } ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mastheadbackground"> </div>
|
||||
|
||||
<section id="posts">
|
||||
|
||||
<div id="masthead">
|
||||
<h1><a href="/">My Site</a></h1>
|
||||
|
||||
<p id="description">Who am I?</p>
|
||||
</div>
|
||||
|
||||
<? if ($content['page-type'] == 'page') { ?>
|
||||
<article>
|
||||
<header>
|
||||
<h2><?= h($content['page-title']) ?></h2>
|
||||
</header>
|
||||
<?= $content['page-body'] ?>
|
||||
</article>
|
||||
<? } else { ?>
|
||||
<? if (isset($content['posts'])) foreach ($content['posts'] as $post) { ?>
|
||||
<article<?= $post['post-type'] == 'link' ? ' class="link"' : '' ?>>
|
||||
<header>
|
||||
<h2>
|
||||
<a href="<?= h($post['post-permalink-or-link']) ?>"><?= h($post['post-title']) ?></a>
|
||||
<?= $post['post-type'] == 'link' ? '<span class="linkarrow">→</span>' : '' ?>
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
<time datetime="<?= h(date('c', $post['post-timestamp'])) ?>" pubdate="pubdate"><?= date('F j, Y', $post['post-timestamp']) ?></time>
|
||||
•
|
||||
<a class="permalink" title="Permalink" href="<?= h($post['post-permalink']) ?>">∞</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<?= $post['post-body'] ?>
|
||||
</article>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
|
||||
<? if (isset($content['archives'])) { ?>
|
||||
<nav id="archives">
|
||||
<h3>Archives</h3>
|
||||
<div style="clear: both; font-size: 1px; line-height: 1px;"> </div>
|
||||
<div style="float: left; width: 90px; text-align: right; padding-bottom: 2em;">
|
||||
<? $so_far = 0; $per_column = ceil(count($content['archives']) / 5); ?>
|
||||
<? foreach ($content['archives'] as $archive) { ?>
|
||||
<? if (++$so_far > $per_column) { ?>
|
||||
<? $so_far = 1; ?>
|
||||
</div>
|
||||
<div style="float: left; width: 90px; text-align: right;">
|
||||
<? } ?>
|
||||
<a href="<?= h($archive['archives-uri']) ?>"><?= $archive['archives-month-short-name'] ?> <?= $archive['archives-year'] ?></a>
|
||||
<br/>
|
||||
<? } ?>
|
||||
</div>
|
||||
<div style="clear: both; font-size: 1px; line-height: 1px;"> </div>
|
||||
</nav>
|
||||
<? } ?>
|
||||
|
||||
<footer>
|
||||
<p>© 2006-2012 Marco Arment. All rights reserved.</p>
|
||||
<p>
|
||||
<a href="/rss.xml">RSS feed</a>.
|
||||
Powered by <a href="http://www.marco.org/secondcrack">Second Crack</a>.
|
||||
</p>
|
||||
|
||||
</footer>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
80
_site/tmp/var/www/chaospott.de/example-templates/rss.php
Normal file
80
_site/tmp/var/www/chaospott.de/example-templates/rss.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?
|
||||
if (! function_exists('title_for_post_callback')) {
|
||||
|
||||
// Feel free to edit these -------------------------------------------------
|
||||
|
||||
function title_for_post_callback($post)
|
||||
{
|
||||
if ($post['post-type'] == 'link') {
|
||||
// For link posts, prepend a Unicode right-pointing-arrow (→)
|
||||
return "\xE2\x86\x92 " . $post['post-title'];
|
||||
} else {
|
||||
return $post['post-title'];
|
||||
}
|
||||
}
|
||||
|
||||
function url_for_post_callback($post) { return $post['post-permalink-or-link']; }
|
||||
|
||||
function body_for_post_callback($post)
|
||||
{
|
||||
if ($post['post-type'] == 'link') {
|
||||
// Insert little permalink infinity-symbol into RSS body for link posts
|
||||
return $post['post-body'] . "\n\n<p><a href=\"http://www.YOURDOMAINHERE.com" . $post['post-permalink'] . "\">∞ Permalink</a></p>";
|
||||
} else {
|
||||
return $post['post-body'];
|
||||
}
|
||||
}
|
||||
|
||||
// You should probably stop editing here -----------------------------------
|
||||
}
|
||||
|
||||
$dom = new DOMDocument('1.0', 'UTF-8');
|
||||
$root = $dom->createElement('rss');
|
||||
$root->setAttribute('version', '2.0');
|
||||
$channel = $dom->createElement('channel');
|
||||
|
||||
$title_node = $dom->createElement('title');
|
||||
$title_node->appendChild($dom->createTextNode($content['blog-title']));
|
||||
$channel->appendChild($title_node);
|
||||
|
||||
$link_node = $dom->createElement('link');
|
||||
$link_node->appendChild($dom->createTextNode($content['blog-url']));
|
||||
$channel->appendChild($link_node);
|
||||
|
||||
$desc_node = $dom->createElement('description');
|
||||
$desc_node->appendChild($dom->createTextNode($content['blog-description']));
|
||||
$channel->appendChild($desc_node);
|
||||
|
||||
foreach ($content['posts'] as $post) {
|
||||
$item_node = $dom->createElement('item');
|
||||
|
||||
$title_node = $dom->createElement('title');
|
||||
$title_node->appendChild($dom->createTextNode(title_for_post_callback($post)));
|
||||
$item_node->appendChild($title_node);
|
||||
|
||||
$link_node = $dom->createElement('link');
|
||||
$link_url = url_for_post_callback($post);
|
||||
if (! isset($link_url[0]) || $link_url[0] == '/') $link_url = rtrim($content['blog-url'], '/') . $link_url;
|
||||
$link_node->appendChild($dom->createTextNode($link_url));
|
||||
$item_node->appendChild($link_node);
|
||||
|
||||
$guid = $dom->createElement('guid');
|
||||
$guid->setAttribute('isPermaLink', 'false');
|
||||
$guid->appendChild($dom->createTextNode($post['post-permalink-or-link']));
|
||||
$item_node->appendChild($guid);
|
||||
|
||||
$date_node = $dom->createElement('pubDate');
|
||||
$date_node->appendChild($dom->createTextNode($post['post-rss-date']));
|
||||
$item_node->appendChild($date_node);
|
||||
|
||||
$desc = $dom->createElement('description');
|
||||
$desc->appendChild($dom->createTextNode(body_for_post_callback($post)));
|
||||
$item_node->appendChild($desc);
|
||||
|
||||
$channel->appendChild($item_node);
|
||||
}
|
||||
|
||||
$root->appendChild($channel);
|
||||
$dom->appendChild($root);
|
||||
echo $dom->saveXML();
|
||||
|
Reference in New Issue
Block a user