Re: Blog

Full blog documentation and installation

(с) Roman Art
So far So good wink

Re: Blog

Nice smile

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

Re: Blog

Hello guys.
Who can tell me how to display the date as - today, yesterday, tomorrow?

Thanks for answers.

Re: Blog

Its easy see This

// Today
<?php echo Date::today(); ?>

// Yesterday
<?php echo Date::yesterday(); ?>

// Tomorrow
<?php echo Date::tomorrow(); ?>
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

30 (edited by Dante 2013-02-01 16:10:47)

Re: Blog

nvm...

Re: Blog

Can you help me with these issues:

1. tried to rename all stuff with names like Blog and blog to see something different in address bar like news instead of blog;

2. how can I show specified number of news with selected tag - i.e. 5 news with tag 'software' and 2 news with tag 'giveaway'.

Thanks in advance for your help wink

Re: Blog

Try this

Remplace Blog::getPosts for this code:

<?php

     function getCustom($tag,$num){
       
       // if call the  tag 
       if (Request::get('tag')){
           return Blog::getPosts($num);
       // if not call the tag 
      }else{

            return Blog::getPosts(4);
      }
   }
   ?>

Call this with

echo getCustom($tag,$num);

$tag = the tag name,
$num = number of posts.

Example:

<?php
     function getCustom($tag,$num){
       if (Request::get('tag')){
           return Blog::getPosts($num); 
      }else{
            return Blog::getPosts(4);
      }
   }

// call custom posts
 echo getCustom('software',5); ?>
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

33 (edited by nakome 2013-02-14 21:40:10)

Re: Blog

Other solution:

<?php
function getCustom($tag){
    if (Request::get('tag')) {
        switch ($tag){
            case 'software':
                // if type sofware return this
                // for link try this: 
                // <a href="<?php Option::get('siteurl'); ?>blog?tag=software">Software</a>
                // and show only 5 posts
                return Blog::getPosts(5);
            break;
                // if type giveaway return this
                // for link try this: 
                // <a href="<?php Option::get('siteurl'); ?>blog?tag=giveaway">Giveaway</a>
                // and show only 2 posts
            case 'giveaway':
                return Blog::getPosts(2);
            break;
        }
    }else{
        // if not type nothing  show all posts
        return Blog::getPosts();
    }
};
// Call actions
echo getCustom('Themes');
echo getCustom('JQuery');
?>

Note: if you copy and paste put only this.

<?php
    function getCustom($tag){
        if (Request::get('tag')) {
            switch ($tag){
                case 'software':
                    return Blog::getPosts(5);
                break;
                case 'giveaway':
                    return Blog::getPosts(2);
                break;
            }
        }else{
            return Blog::getPosts();
        }
    }
    echo getCustom('software');
    echo getCustom('giveaway');
?>
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

34 (edited by glebcha 2013-02-15 07:33:57)

Re: Blog

nakome, sorry that didn't mention before - I need to show my news on main page (slug 'home'), but keep showing all posts for slug 'blog'.
Also tried your tricks and they seem to not work if I change echo Blog::getPosts in blog.template.php (maybe I've done it wrong way?).

Your help is highly appreciated!



<?php Chunk::get('header'); ?>

<div id="landing">
    <div class="container">

        <div>
            <?php Action::run('theme_pre_content'); ?>
        </div>

        <div>

<?php
     function getCustom($tag,$num){
       if (Request::get('tag')){
           return Blog::getPosts($num); 
      }else{
            return Blog::getPosts(4);
      }
   }

// call custom posts
 echo getCustom('software',5); ?>
        </div>

        <div>
          <?php Action::run('theme_post_content'); ?>
        </div>

</div>
</div>
<?php Chunk::get('footer'); ?>   

35 (edited by nakome 2013-02-15 15:53:51)

Re: Blog

Works but if you call from a link  example

<a href="<?php echo Url::base();?>?tag=giveaway">Giveaway</a>

I´m sorry,  i try other solution.


try this:


In blog.template  remplace Blog::getPosts for this:

<?php
    function getCustom($tag){
        if (Request::get('tag')) {
            switch ($tag){
                case 'software':
                    return Blog::getPosts(5);
                break;
                case 'giveaway':
                    return Blog::getPosts(2);
                break;
            }
        }else{
            return Blog::getPosts();
        }
    }
    echo getCustom('software');
    echo getCustom('giveaway');
?>


Now in main put this code on footer after load jquery.

          <script type="text/javascript">
            $(document).ready(function(){
                // Load content tag
                $('#mycustompost').load('<?php echo Url::base();?>?tag=software  .content');  // .content  is a div with your blog content
            }); 
         </script>

Now in main index create a div with id mycustompost and jquery load the post here

Note: if you want load more tags,  you must  create other divs and load more tags like this:

       
          <script type="text/javascript">
            $(document).ready(function(){

                 // Load content tag  one
                $('#mycustompost').load('<?php echo Url::base();?>?tag=software  .content');  // .content  is a div with your blog content

                 // Load content tag  two
                $('#mycustompost2').load('<?php echo Url::base();?>?tag=giveaway  .content2');  // .content2  is a div with your blog content

            }); 
         </script>

You understand.


Preview
http://i.minus.com/iww8YF8jN4XcE.png

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

36 (edited by glebcha 2013-02-18 07:07:00)

Re: Blog

nakome, tried and blog entries are displaying only if I exclude ".content" from

.load('<?php echo Url::base();?>?tag=software  .content');

. But all page content displayed, not only entries and that's why block styles gone mad.
As I understand you are looking for a class "content", but in output code I can see only a clean <div>. Maybe that is the reason?
Sorry that I had no luck with this, but maybe you can show working example or something else?

37 (edited by nakome 2013-02-18 15:56:55)

Re: Blog

Sorry i try in my demo page and not working, only working this

.container  is a div of your blog content

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

Re: Blog

nakome wrote:

Sorry i try in my demo page and not working, only working this

.container  is a div of your blog content

You have <div id="blog" class="well"></div> while for me it is only <div></div>. Maybe I should correct blog post settings?

39 (edited by nakome 2013-02-19 12:10:27)

Re: Blog

Yes in blog.template.php add id or class like this

      <div>
            <?php Action::run('theme_pre_content'); ?>
        </div>
 
        <div id="blog"><!-- here put the id or class-->
            <?php echo Blog::getPosts(5); ?>
        </div>
 
        <div>
            <?php Action::run('theme_post_content'); ?>
        </div>
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

Re: Blog

Missed it there while searching in plugin configs, shame on me)

Will improve your script to show defined number of elements:

<script type="text/javascript">
    $(document).ready(function(){
         $('.container-with-loaded-posts').load("<?php echo Url::base(); ?>/blog?tag=lorem .blog-post-container:lt(4)"); // only 4 posts will be displayed
    }); 
</script>

Re: Blog

nice smile

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

42 (edited by glebcha 2013-03-07 04:15:25)

Re: Blog

Pagination for tags is not working - pages after first will show all blog posts, but not for defined tag. And maybe there is a hint how not to display pages count if it is only one page.
Any solution appreciated smile

Re: Blog

glebcha wrote:

Pagination for tags is not working - pages after first will show all blog posts, but not for defined tag. And maybe there is a hint how not to display pages count if it is only one page.
Any solution appreciated smile

I talked about it for a long time on the Russian forum, and the problem is not solved yet.
And also title does not change in the tags.

Re: Blog

Remplace pagination with this pagination until  resolution the problem

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

45 (edited by glebcha 2013-03-08 00:48:04)

Re: Blog

Should I delete this from blog.plugin.php:

                   View::factory('blog/views/frontend/pager')
                    ->assign('pages', $pages)
                    ->assign('page', $page)
                    ->render()

And delete pager.view.php?
And then use jquery plugin.

Re: Blog

Hm, no one knows how to replace default laggy pagination with working having no issues?

47 (edited by nakome 2013-03-18 13:53:26)

Re: Blog

In folder views pager.view.php
If you like other pagination clean the code of pager.

This is the code of my blog only show next and prev botton.

<?php
    $neighbours = 6;
    $left_neighbour = $page - $neighbours;
    if ($left_neighbour < 1) $left_neighbour = 1;

    $right_neighbour = $page + $neighbours;
    if ($right_neighbour > $pages) $right_neighbour = $pages;

    if ($page > 1) {
        echo ' <div ><a   href="?page=' . ($page-1) . '">'.__('prev', 'blog').'</a></div> ';
    }

    if ($page < $pages) {
        echo  ' <div><a  href="?page=' . ($page+1) . '">'.__('next', 'blog').'</a> </div>';
    }
?>
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

Re: Blog

Is it possible to install 2 instances of blog plugin? For example one is news and another is blog.

Re: Blog

If remane plugin

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

Re: Blog

@nakome You think ''if rename plugin'' big_smile

You Can Change the world, by using your brain... smile If you have one... Of cors!!!
http://www.neoart.rs