?>
><a href="<?php 
    /* navbar.tpl:17: {$.site.url} */
    echo $tpl->getStorage()->site_config["url"];
    ?>
/contact">Contact</a></li> </ul> </div> </div> </div> <?php 
    $var = $t7e67f4a8_1;
    unset($t7e67f4a8_1);
    ?>
 <?php 
    /* base.tpl:25: {Morfy::runAction('theme_content_before')} */
    echo Morfy::runAction('theme_content_before');
    ?>
  <div class="container"> <?php 
    /* blog.tpl:4: {set $posts = Morfy::getPages('blog', 'date', 'DESC', ['404','index'])} */
    $var["posts"] = Morfy::getPages('blog', 'date', 'DESC', array('404', 'index'));
    ?>
 <?php 
    /* blog.tpl:5: {foreach $posts as $post} */
    if (!empty($var["posts"]) && (is_array($var["posts"]) || $var["posts"] instanceof \Traversable)) {
        foreach ($var["posts"] as $var["post"]) {
            ?>
 <h3><a href="<?php 
            /* blog.tpl:6: {$.site.url} */
            echo $tpl->getStorage()->site_config["url"];
            ?>
/blog/<?php 
            /* blog.tpl:6: {$post.slug} */
            echo $var["post"]["slug"];
            ?>
"><?php 
Beispiel #2
0
<?php

/**
 * Morfy Sitemap Plugin
 *
 * (c) Romanenko Sergey / Awilum <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
if (Url::getUriSegment(0) == 'sitemap.xml') {
    Morfy::addAction('before_render', function () {
        $fenom = Fenom::factory(PLUGINS_PATH . '/sitemap/templates/', CACHE_PATH . '/fenom/', Morfy::$fenom);
        $fenom->setOptions(array("strip" => false));
        $pages = Morfy::getPages('', 'date', 'DESC', array('404'));
        Response::status(200);
        Request::setHeaders('Content-Type: text/xml; charset=utf-8');
        $fenom->display('sitemap.tpl', array('pages' => $pages));
        Request::shutdown();
    });
}
        // Pagination
        $nextprev_template->display('nav.tpl', array('config' => $nextprev_config, 'current' => $current_page, 'total' => $total_pages, 'prev' => $current_page > 1 ? '?' . $nextprev_config['param'] . '=' . ($current_page - 1) : false, 'next' => $current_page < $total_pages ? '?' . $nextprev_config['param'] . '=' . ($current_page + 1) : false));
    } else {
        $nextprev_template->display('error.tpl', array('config' => $nextprev_config));
    }
    unset($all_pages);
});
// For single article
// Usage => Morfy::runAction('item_nextprev');
Morfy::addAction('item_nextprev', function () use($nextprev_config, $nextprev_template) {
    // Get current URI segments
    $path = Url::getUriSegments();
    array_pop($path);
    $path = implode('/', $path);
    // Get all posts
    $all_pages = Morfy::getPages($path, 'date', 'DESC', array('404', 'index'));
    // Count total posts
    $total_pages = count($all_pages);
    // Get current page path
    $current_path = Url::getUriString();
    // Get current page data
    $current_page = Morfy::getPage($current_path);
    // Testing...
    // echo $current_page['date'];
    // Find next and previous link from current page
    $prev_page = $next_page = false;
    for ($i = 0; $i < $total_pages; $i++) {
        if ($current_page['date'] == $all_pages[$i]['date']) {
            $prev_page = isset($all_pages[$i - 1]['url']) && !empty($all_pages[$i - 1]['url']) ? $all_pages[$i - 1]['url'] : false;
            $next_page = isset($all_pages[$i + 1]['url']) && !empty($all_pages[$i + 1]['url']) ? $all_pages[$i + 1]['url'] : false;
        }
Beispiel #4
0
<?php

/**
 * Morfy Feed Plugin
 *
 * (c) Romanenko Sergey / Awilum <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
if (Url::getUriSegment(0) == 'rss') {
    Morfy::addAction('before_render', function () {
        $fenom = Fenom::factory(PLUGINS_PATH . '/feed/templates/', CACHE_PATH . '/fenom/', Morfy::$fenom);
        $fenom->setOptions(array("strip" => false));
        Response::status(200);
        Request::setHeaders('Content-Type: text/xml; charset=utf-8');
        $fenom->display('rss.tpl', array('page' => Morfy::getPage(Morfy::$plugins['feed']['page']), 'pages' => Morfy::getPages(Morfy::$plugins['feed']['page'], 'date', 'DESC', array('404'))));
        Request::shutdown();
    });
}