26 2013-01-09 09:04:09

Re: Blog

Full blog documentation and installation

(с) Roman Art
So far So good wink

RomanArt's Website

27 2013-01-09 10:42:46

Re: Blog

Nice smile

nakome's Website

28 2013-01-30 23:20:56

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(); ?>

nakome's Website

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); ?>

nakome's Website

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');
?>

nakome's Website

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

nakome's Website

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

nakome's Website

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>

nakome's Website

40 2013-02-20 14:41:50

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

nakome's Website

42 (edited by glebcha Yesterday 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

43 Yesterday 13:59:11

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.

44 Yesterday 14:27:04

Re: Blog

Remplace pagination with this pagination until  resolution the problem

nakome's Website

45 (edited by glebcha Today 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.