1 (edited by tovic 2015-01-04 18:16:48)

Topic: Tags Page

Download Here

Installation

Place the tags folder with its contents in plugins folder. Then update your config.php file:

<?php
    return array(
        ...
        ...
        ...
        'plugins' => array(
            'markdown',
            'sitemap',
            'tags' // <= Activation
        ),
        'tags_config' => array( // <= Configuration
            // Available in `configuration.txt`
        )
    );

Add this snippet to your blog_post.html that is placed in the themes folder to show the tag links:

<div class="post-tags">
    <?php Morfy::factory()->runAction('tags_links'); ?>
</div>

Edit your blog.html file. You have to replace the posts loop with this:

<?php
$posts = Morfy::factory()->getPages(CONTENT_PATH . '/blog/', 'date', 'DESC', array('404','index'));
$tag_filter = Morfy::$config['tags_config']['param'];
if(isset($tag_filter) && isset($_GET[$tag_filter])) { // Tags page
    Morfy::factory()->runAction('tags');
} else { // Normal posts loop
    foreach($posts as $post) {
        echo '<h3><a href="'.$config['site_url'].'/blog/'.$post['slug'].'">'.$post['title'].'</a></h3>                
            <p>Posted on '.$post['date'].'</p>    
            <div>'.$post['content_short'].'</div>';
    }
}

If you already installed this or this blog pagination plugin, use this code instead:

<?php
$tag_filter = Morfy::$config['tags_config']['param'];
if(isset($tag_filter) && isset($_GET[$tag_filter])) { // Tags page
    Morfy::factory()->runAction('tags');
} else { // Normal posts loop
    Morfy::factory()->runAction('pagination');
}

Or this:

<?php
$tag_filter = Morfy::$config['tags_config']['param'];
if(isset($tag_filter) && isset($_GET[$tag_filter])) { // Tags page
    Morfy::factory()->runAction('tags');
} else { // Normal posts loop
    Morfy::factory()->runAction('index_nextprev');
}
XSS Testing <script>alert('HIYAA!!!');</script>

tovic's Website

2 (edited by MBTY 2014-09-08 18:20:06)

Re: Tags Page

I`ve installed this plugin (http://forum.monstra.org/topic/520/blog-pagination) and Tags Page plugin
On my blog i have about 40-45 posts with same tag. Clicking on this tag shows all 40 posts on 1 page.  Pagination configured to show only 10 posts in 1 page. What i need to do for enable this function in tags page?

3 2014-12-07 00:52:32 (edited by tovic 2015-01-06 04:33:07)

Re: Tags Page

I’ve thinking about that, it’s just that I’m still looking for a better alternative to in_array() to filter the tags.

XSS Testing <script>alert('HIYAA!!!');</script>

tovic's Website

4 (edited by tovic 2015-01-05 16:08:41)

Re: Tags Page

I’ve added pagination feature on this plugin, just re-download and re-install the plugin. Demo URL is here → hxxp://latitudu.com/notes/morfy-cms?tagged=Plugins

Better alternative to in_array() is strpos() smile

foreach($all_posts as $post) {
    // Remove all spaces between commas, then wrap them with `<` and `>`
    $tags = '<' . preg_replace('/\s*,\s*/', ',', $post['tags']) . '>';
    if(
        strpos($tags, '<' . $filter . ',') !== false ||
        strpos($tags, ',' . $filter . ',') !== false ||
        strpos($tags, ',' . $filter . '>') !== false ||
        '<' . $filter . '>' === $tags
    ) {
        $filtered_posts[] = $post;
    }
}
XSS Testing <script>alert('HIYAA!!!');</script>

tovic's Website

5 2015-01-05 17:30:05

Re: Tags Page

Welcome back bro

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: Tags Page

nakome wrote:

Welcome back bro

Thanks. Lately I’m getting a lot of new activity in campus.

XSS Testing <script>alert('HIYAA!!!');</script>

tovic's Website