Topic: Blog pagination

Download here

Simple preview:


https://dl.dropboxusercontent.com/u/23834858/Morfy/pagination.jpg



Instructions:

Config.php:

        'num_of_pages' => 3, // Number of posts
        'plugins' => array(
            'markdown',
            'sitemap',
            'pagination', // Activate / Desactivate plugin
        )

Remplace blog code for this:

<?php echo Morfy::factory()->runAction('pagination');?>

In plugins/pagination/lib you have css and js folders to make more pretty wink

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

Re: Blog pagination

Preview for few days

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

Re: Blog pagination

nice smile
would be nice if you did manstra cms!
free server http://www.000webhost.com/ hehehe

Re: Blog pagination

not working

http://i.troll.ws/a862fe20.png

Re: Blog pagination

fr1zzer wrote:

not working


You have written in the code ?

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

Re: Blog pagination

fr1zzer wrote:

not working

http://i.troll.ws/a862fe20.png

http://s17.postimg.org/7e3fezi27/2014_01_31_1404.png

Re: Blog pagination

What version of morfy use?
Where is the readmore button?
Where is the author and tags ?

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

Re: Blog pagination

http://s29.postimg.org/512za5ttj/2014_01_31_1451.png
morty version 1.0.4
localhost

Re: Blog pagination

nakome wrote:

You have written in the code ?

Yes.

nakome wrote:

What version of morfy use?

1.0.4

nakome wrote:

Where is the readmore button?
Where is the author and tags ?

http://i.troll.ws/800b8332.png
http://i.troll.ws/eccf4e10.png

Re: Blog pagination

Remplace blog code for this:
<?php echo Morfy::factory()->runAction('pagination');?>

Example:

<?php include 'header.html' ?>
<?php include 'navbar.html' ?>
<div class="container">
    <?php Morfy::factory()->runAction('theme_content_before'); ?>
    <?php Morfy::factory()->runAction('pagination'); ?>
    <?php Morfy::factory()->runAction('theme_content_after'); ?>
</div>
<?php include 'footer.html' ?>
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

11 (edited by nakome 2014-01-31 13:25:24)

Re: Blog pagination

i update code and remove  strpos() i try in other theme http://nakome.co.nf/blog

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

Re: Blog pagination

hi fr1zzer:

I do not think it had a problem with that. I've tried it and it worked. I see your screenshot, and you are wrong to put the code in the blog.html


localhost screenshot:

Morfy Site


code screenshot:

Blog.html

I'm not like them but I can pretend.

Re: Blog pagination

Would be awesome to make Tags clickable. And if after clicking on the tag will be displayed Post with this tag only. Is that possible?

Re: Blog pagination

Maybe but i can't make for now  i have not time for now sorry.

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

15 (edited by tovic 2014-02-11 14:21:37)

Re: Blog pagination

MBTY wrote:

Would be awesome to make Tags clickable. And if after clicking on the tag will be displayed Post with this tag only. Is that possible?

This is how I make tags becomes clickable. The rest is about how to make custom template for the tags filter via $_GET['tagged']

<?php
    $segments = Morfy::factory()->getUriSegments(); // print_r($segments);
    $tags = explode(',', $page['tags']);
    $tags_link = array();
    array_pop($segments); // We don't need the last path. We only need the parent of the current page
    foreach($tags as $tag) {
        $tags_link[] = '<a href="' . rtrim($config['site_url'], '/') . '/' . implode('/', $segments) . '?tagged=' . trim($tag) . '">' . trim($tag) . '</a>';
    }
    sort($tags_link); // Sort alphabetically
    echo implode(', ', $tags_link);
?>
XSS Testing <script>alert('HIYAA!!!');</script>

Re: Blog pagination

Good job tovic

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

Re: Blog pagination

nakome wrote:

Download here

Simple preview:


https://dl.dropboxusercontent.com/u/23834858/Morfy/pagination.jpg


hello,
how do I get image and together;
Thank you

Re: Blog pagination

can be pagination for each template separately as exemplified below;

blog template

<?php include 'header.html' ?>
<?php include 'navbar.html' ?>
<div class="container">
    <?php Morfy::factory()->runAction('theme_content_before'); ?>
      <?php
            //  Morfy::factory()->getPages($url,$order_by,$order_type,$ignore,$limit);
            // $url  is a folder of posts
            $url = CONTENT_PATH . '/blog/';
            // $order_by is a order like date or title 
            $order_by = 'date';
            // $order_type is a order type  like ASC or DESC
            $order_type =   'DESC';
            // $ignore  = array of files to ignore
            $ignore =  array('404','index');
            // $limit is a number of posts
            $limit = 2;
            $posts = Morfy::factory()->getPages($url,$order_by, $order_type,$ignore,$limit);
            foreach($posts as $post) {

                // use default image if not write Thumbnail 
                $thumbnail =  ($post['thumbnail']) ? $post['thumbnail'] : $config['Site_url'].'public/images/default.jpg';

                echo '<h3><a href="'.$config['site_url'].'/blog/'.$post['slug'].'">'.$post['title'].'</a></h3>                
                <p>Posted on '.$post['date'].'</p>
                <div class="tumb">
                    <img src="'.$thumbnail.'" alt="'.$post['title'].'">
                </div>
                <div>'.$post['content_short'].'</div>';
            }
    ?>
    <?php Morfy::factory()->runAction('pagination'); ?>
    <?php Morfy::factory()->runAction('theme_content_after'); ?>
</div>
<?php include 'footer.html' ?>

news template

<?php include 'header.html' ?>
<?php include 'navbar.html' ?>
<div class="container">
    <?php Morfy::factory()->runAction('theme_content_before'); ?>
      <?php
            //  Morfy::factory()->getPages($url,$order_by,$order_type,$ignore,$limit);
            // $url  is a folder of posts
            $url = CONTENT_PATH . '/news/';
            // $order_by is a order like date or title 
            $order_by = 'date';
            // $order_type is a order type  like ASC or DESC
            $order_type =   'DESC';
            // $ignore  = array of files to ignore
            $ignore =  array('404','index');
            // $limit is a number of posts
            $limit = 2;
            $posts = Morfy::factory()->getPages($url,$order_by, $order_type,$ignore,$limit);
            foreach($posts as $post) {

                // use default image if not write Thumbnail 
                $thumbnail =  ($post['thumbnail']) ? $post['thumbnail'] : $config['Site_url'].'public/images/default.jpg';

                echo '<h3><a href="'.$config['site_url'].'/news/'.$post['slug'].'">'.$post['title'].'</a></h3>                
                <p>Posted on '.$post['date'].'</p>
                <div class="tumb">
                    <img src="'.$thumbnail.'" alt="'.$post['title'].'">
                </div>
                <div>'.$post['content_short'].'</div>';
            }
    ?>
    <?php Morfy::factory()->runAction('pagination'); ?>
    <?php Morfy::factory()->runAction('theme_content_after'); ?>
</div>
<?php include 'footer.html' ?>

http://postimg.org/image/yhzr1img1/