Recent Topics

[Widget] Latest posts

Started by on Aug 27, 2008 – Contents updated: Aug 27, 2008

Aug 27, 2008 16:08    

Oct 31, 2008 07:01

cool, i ve just noticed this one browsing BOPIT, otherwise i d possibly miss it forever may be... will test/use this one and be back with further feedback, thanks for the plugin sam2kb..

Dec 13, 2008 03:00

Widget updated to v0.2
It didn't display the latest posts before :oops: , but now it does ;)

May 15, 2010 20:50

You need to create new widget container. Use this code

PHP

skin_containerNT_('Container name'), array(
        'block_start'  => '<div class="$wi_class$">',
        'block_end'   => '</div>',
    ) );

May 15, 2010 21:47

sam2kb wrote:

You need to create new widget container. Use this code

PHP

skin_containerNT_('Container name'), array(
        'block_start'  => '<div class="$wi_class$">',
        'block_end'   => '</div>',
    ) );

Thanks . But I need to know the above code should be added in which file or I've to create a new php file ? Sorry for my dumb question :oops:

May 16, 2010 01:27

It depends on where you want to display the widget.

Generally you should put the above code after the post list in index.main.php and posts.main.php

Find the following block and add new code below

PHP

// -------------- MAIN CONTENT TEMPLATE INCLUDED HERE (Based on $disp) --------------
skin_include'$disp$'array(
        'disp_posts'  => '',        // We already handled this case above
        'disp_single' => '',        // We already handled this case above
        'disp_page'   => '',        // We already handled this case above
    ) );
// Note: you can customize any of the sub templates included here by
// copying the matching php file into your skin directory.
// ------------------------- END OF MAIN CONTENT TEMPLATE ---------------------------
 
 
 
// Widget container
skin_containerNT_('Container name'), array(
        'block_start'  => '<div class="$wi_class$">',
        'block_end'   => '</div>',
    ) );

May 16, 2010 02:49

sam2kb wrote:

Generally you should put the above code after the post list in index.main.php and posts.main.php

Find the following block and add new code below

I only found the above block in index.main.php .I've already added the widget container code in it as you mentionned . Surely it doesn't fix my problem . I think I missed something .

Again thanks for your time .

May 16, 2010 02:59

abcd wrote:

I only found the above block in index.main.php

It's ok

Surely it doesn't fix my problem . I think I missed something .

You need to reload containers in the skin on General settings > Skins tab.

Oct 02, 2010 00:53

Hi. Recently I installed this plugin and activate it in 2 blogs. My problem is that in one of the blogs it looks just fine but in the second blog it move the main content to the right column. Any ideas?

Here some pics of how it looks before and after activating the plugin:

BEFORE ACTIVATING (main content in its place)
http://www.trvenezuela.com/storage/1_1.jpg

AFTER ACTIVATING (main content moved to right column)
http://www.trvenezuela.com/storage/3.jpg

Thx in advance.

Oct 02, 2010 01:02

How many columns have you set. Try 1 or 2
Can you give a link to the blog?

Dec 31, 2010 19:54

Is there a method to add the latest posts to an index page within the blogs directory?

I would like build an index page and add the recent posts by four guys onto a consolidated page.

Thanks

Dec 31, 2010 22:47

Thank you for the response sam.

I've download and installed the plugin but I've set the Default blog to display in my global settings to no blog which uses the default.php page. I've modified the default page to list the bloggers that write for my site and wanted the latest posts to show up at the top of the page.

The code supplied I don't believe will work for the default page. I would like all the current blogs and any future (added later) to show on the main default page.

Any suggestions would be appreciated?


sam2kb wrote:

Try this widget http://forums.b2evolution.net/...hp?t=16492

To display it on the home/index page only add the following code in index.main.php above the skin_include( '$disp$', array( block

PHP:

Code

if( is_default_page() )
{
    $disp = 'homepage';
    skin_container( NT_('Blog homepage') );
}

Dec 31, 2010 23:29

You can call the plugin from default.php too, just replace blog ID

PHP

skin_widgetarray(
        // CODE for the widget:
        'widget' => 'latest_posts',
        // Optional display params
        'title' => 'Whatever',
        'blog_ID' => 123,
        'cols' => 2,
        'limit' => 5,
) );

If you want to put the plugin in blogs loop, use this to get blog ID

PHP

'blog_ID' => $l_Blog->ID,

Jan 01, 2011 17:11

sam2kb wrote:

You can call the plugin from default.php too, just replace blog ID

PHP

skin_widgetarray(
        // CODE for the widget:
        'widget' => 'latest_posts',
        // Optional display params
        'title' => 'Whatever',
        'blog_ID' => 123,
        'cols' => 2,
        'limit' => 5,
) );

If you want to put the plugin in blogs loop, use this to get blog ID

PHP

'blog_ID' => $l_Blog->ID,

:D Ok sam now you lost me, I'm not that good. I tried adding the code above as explained to the default.php page and got nothing.

I looked for the code you noted above and can't find it and more importantely once I do I'm not really sure how to get it to display on the default page.

Soory I'm new to the software and just fair at the coding.

And by the way, Happy New Year.

Jan 02, 2011 01:27

Happy New Year to you too :)

Can you post your default.php file here?

Jan 02, 2011 02:40

sam, the help is appreciated.

I was planning on creating one more block after the Welcome for the latest posts.

PHP

<?php
/**
 * This is the main public interface file!
 *
 * This file is NOT mandatory. You can delete it if you want.
 * You can also replace the contents of this file with contents similar to the contents
 * of a_stub.php, a_noskin.php, multiblogs.php, etc.
 *
 * b2evolution - {@link http://b2evolution.net/}
 * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}
 *
 * @package evoskins
 * @subpackage noskin
 */
 
/**
 * First thing: Do the minimal initializations required for b2evo:
 */
require_once dirname(__FILE__).'/conf/_config.php';
 
/**
 * Check this: we are requiring _main.inc.php INSTEAD of _blog_main.inc.php because we are not
 * trying to initialize any particular blog
 */
require_once $inc_path.'_main.inc.php';
 
 
 
// --------------------- PAGE LEVEL CACHING SUPPORT ---------------------
// Note: This is totally optional. General caching must be enabled in Global settings, otherwise this will do nothing.
// Delete this block if you don't care about page level caching. Don't forget to delete the matching section at the end of the page.
load_class'_core/model/_pagecache.class.php' );
$PageCache = & new PageCacheNULL );
// Check for cached content & Start caching if needed:
if( ! $PageCache->check() )
{    // Cache miss, we have to generate:
    // --------------------- PAGE LEVEL CACHING SUPPORT ---------------------
 
 
header_content_type'text/html' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php locale_lang() ?>" lang="<?php locale_lang() ?>"><!-- InstanceBegin template="/Templates/evo_distrib_2.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>Mysites Blog Page</title>
    <!-- InstanceEndEditable -->
    <meta name="viewport" content="width = 750" />
    <link href="rsc/css/evo_distrib_2.css" rel="stylesheet" type="text/css" />
    <!-- InstanceBeginEditable name="head" -->
    <base href="<?php echo $baseurl ?>" />
    <!-- InstanceEndEditable -->
    <!-- InstanceParam name="lang" type="text" value="&lt;?php locale_lang() ?&gt;" -->
</head>
 
<body>
    <!-- InstanceBeginEditable name="BodyHead" -->
    <?php
    // ---------------------------- TOOLBAR INCLUDED HERE ----------------------------
    require $skins_path.'_toolbar.inc.php';
    // ------------------------------- END OF TOOLBAR --------------------------------
 
    echo "\n";
    if( is_logged_in() )
    {
        echo '<div id="skin_wrapper" class="skin_wrapper_loggedin">';
    }
    else
    {
        echo '<div id="skin_wrapper" class="skin_wrapper_anonymous">';
    }
    echo "\n";
    ?>
    <!-- Start of skin_wrapper -->
    <!-- InstanceEndEditable -->
 
    <div class="wrapper1">
    <div class="wrapper2">
        <span class="version_top"><!-- InstanceBeginEditable name="Version" --><Writers Home Page><!-- InstanceEndEditable --></span>
 
        <a href="http://www.mysite.com/1fish" target="_blank"><img src="rsc/img/distrib/ctabloglogo.gif" alt="Welcome to CTA" width="237" height="92" /></a>
 
        <div class="menu_top"><!-- InstanceBeginEditable name="MenuTop" -->
            <span class="floatright"><a href="<?php echo $admin_url ?>">Admin</a> </span>
            &nbsp;
        <!-- InstanceEndEditable --></div>
 
        <!-- InstanceBeginEditable name="Main" -->
        <?php
        /**
         * @var BlogCache
         */
        $BlogCache = & get_Cache('BlogCache');
        $BlogCache->load_all();
 
        if( $pagenow == 'index.php' || count$BlogCache->cache ) == )
        {    // This page is actually included by the index.html page OR there are no blogs
            ?>
<!-- Start Main Page -->
            <div class="block1">
            <div class="block2">
            <div class="block3">
 
<h2>Welcome to Mysite</h2>
<P>We are fortunate enough to have some members that have entertained, educated and enlightened us over the past couple years now writing in a blog. </P> 
 
<P>These folks have a wealth of knowledge in different areas of our sports so the plan is to have some humorous and stimulating things to share with our membership. </P>
 
<P>We hope you enjoy it and look forward to hearing your thoughts. </P>
 
            </div>
            </div>
            </div>
        <div class="block1">
        <div class="block2">
        <div class="block3">
 
<h2><center><a href="http://www.mysite.com/blog/any_luc.php">Of Platters and Slabs ~ Any Luc</A></center></h2>
 
<table cellpadding=5 border=0>
<tr>
<td width="20%"><a href="http://www.mysite.com/blog/any_luc.php"><img src="/blog/writers/anytar.jpg"></A></td>
<td align=left valign=top width="80%"><P>I’m just a fellow looking to follow along life’s curiosities, in a no different fashion than I did as a youngster, with big eyes.
The sharing of a like interest, the mystique of the under-surface, is what brings you and me together I’m sure.</P>
<P>Thus, I invite you to come with me, as we absorb what we may of the clues and the tricks to finding the whole, or maybe just itty bitty bits and pieces of, the down-from.</P></td>
</tr>
</table>
 
        </div>
        </div>
        </div>
 
        <div class="block1">
        <div class="block2">
        <div class="block3">
 
 <h2><center><a href="http://www.mysite.com/blog/runninbare.php">The Runnin' Bare Chronicles ~ Runnin' Bare</A></center></h2>
 
<table cellpadding=5 border=0>
<tr>
<td width="20%"><a href="http://www.mysite.com/blog/runninbare.php"><img src="/blog/writers/bare.jpg"></A></td>
<td align=left valign=top width="80%"><P>While I’ve pursued many species of fish, in both fresh- and salt-water, my obsession is salmon fishing on “the big pond”; Lake Michigan .  This is somewhat ironic, since I was not aware that salmon even existed in the Great Lakes until after my 30th birthday.  Ever since that Eureka ! moment, I have been learning everything I can about salmon fishing and then sharing that information with others.</P>  
 
<P>I am not a charter captain, nor a tournament angler.  Rather, I fish for the pure fun of it.  It is especially enjoyable to help a novice angler catch what is often the biggest fish of their life.  I have been a member of Salmon Unlimited since 1999, was elected to the Board of Directors in 2007 and became the Vice-President in 2010.  I am also honored to be part of the pro-staff for Sigg’s Rigs Trolling Flies.</P>
 
<P>When not fishing, I am an avid scuba diver and underwater photographer.</P>
</td>
</tr>
</table>
    </div>
    </div>
    </div>
 
        <div class="block1">
        <div class="block2">
        <div class="block3">
 
 <h2><center><a href="http://www.mysite.com/blog/creekyknees.php">River Musings and Meanderings ~ Creekyknees</A></center></h2>
 
<table cellpadding=5 border=0>
<tr>
<td width="20%"><a href="http://www.mysite.com/blog/creekyknees.php"><img src="/blog/writers/norm.jpg"></A></td>
<td align=left valign=top width="80%"><P>Norm (aka Creekyknees) has written articles for websites like the <a href="http://www.illinoissmallmouthalliance.com/">Illinois Smallmouth Alliance</a> Bronzeback Bulletin, the Outdoor Notebook and contributed to an article in InFisherman.</p>
 
<p>Norm could be called a river rat if you knew him well enough. He will fish in just about any conditions knowing that he will have the river to himself. Why,  because he knows that good things come to those who put the time in under any conditions.</p>
 
<p>His labor of love is the Kankakee River where you can find him chasing Bronzebacks.  He stays active on elements that impact the Kankakee and is currently a member of the Kankakee River Roundtable, working conservation, clean ups and other river issues that impact the fishery.</p> 
</td>
</tr>
</table>
 
    </div>
    </div>
    </div>
 
        <div class="block1">
        <div class="block2">
        <div class="block3">
 
 <h2><center><a href="http://www.mysite.com/blog/quailhunter.php">Armes de Feu ~ Quail Hunter</A></center></h2>
 
<table cellpadding=5 border=0>
<tr>
<td width="20%"><a href="http://www.mysite.com/blog/quailhunter.php"><img src="/blog/writers/hunter.jpg"></A></td>
<td align=left valign=top width="80%"><P>As of December of 2010, I am a few months away from turning 60.   I have been around guns my entire life.  At this stage of my life I am mainly an upland hunter.   I have taken my share of birds, white tail deer, fallow deer, black bear, Russian boar and coyote.</P>
 
<P> I am life member of the NRA.  I am also a member of Ducks Unlimited, Ruffed Grouse Society and Trout Unlimited.  Why those three?  Well it is simple each one is committed to conservation.  Each one provides improvements to public land. Why the NRA?  Well, that one is easy!  There is no other national organization devoted to protecting the 2nd Amendment.  I enjoy hunting; collecting firearms and watching a good dog work the field. </P>  
</td>
</tr>
</table>
    </div>
    </div>
    </div>
 
 
    <?php
    }
?>
 
<!-- End Main Table -->
 
 
<!-- InstanceEndEditable -->
    </div>
 
    <div class="body_fade_out">
 
    <div class="menu_bottom"><!-- InstanceBeginEditable name="MenuBottom" -->Copyright Mysite.com &bull; 2003-2010</a>
        <!-- InstanceEndEditable --></div>
 
    <div class="copyright"><!-- InstanceBeginEditable name="CopyrightTail" -->
        <a href="contact.php"><?php echo T_('Contact the Administrator'?></a>
        <?php
            creditsarray(
                    'list_start'  => ' &middot; ',
                    'list_end'    => ' ',
                    'separator'   => ' &middot; ',
                    'item_start'  => ' ',
                    'item_end'    => ' ',
                ) );
        ?> 
        <!-- InstanceEndEditable --></div>
 
    </div>
    </div>
 
    <!-- InstanceBeginEditable name="BodyFoot" -->
    <!-- End of skin_wrapper -->
    </div>
    <!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
<?php
    // --------------------- PAGE LEVEL CACHING SUPPORT ---------------------
    // Save collected cached data if needed:
    $PageCache->end_collect();
}
// --------------------- PAGE LEVEL CACHING SUPPORT ---------------------
?>

Jan 02, 2011 03:04

Try this
You need to set blog_ID for each widget

PHP

...
<P>ThusI invite you to come with me, as we absorb what we may of the clues and the tricks to finding the whole, or maybe just itty bitty bits and pieces ofthe down-from.</P></td>
</tr>
</table>
 
<?php
 
skin_widgetarray(
        // CODE for the widget:
        'widget' => 'latest_posts',
        // Optional display params
        'title' => '',
        'blog_ID' => 123// make sure you changed this to correct blog ID
        'cols' => 3,
        'limit' => 6,
) ); 
 
?>
 
</div>
</div>
</div>

Jan 02, 2011 15:55

sam,

Dropped this in where you suggested and changed the blog ID to the correct one for the user and got this:

Code

Fatal error: Call to undefined function skin_widget() in /var/www/virtual/chitown-angler.com/htdocs/fin-n-feathers/default.php on line 132

Before we started working on this, when I installed the software I renamed the blog from blog1.php to any_luc.php. Would that have any impact?

Just an FYI, the plugin I have the rendering set to always.

Jan 02, 2011 19:22

Edit this

PHP

/**
 * Check this: we are requiring _main.inc.php INSTEAD of _blog_main.inc.php because we are not
 * trying to initialize any particular blog
 */
require_once $inc_path.'_main.inc.php'
 
load_funcs('skins/_skin.funcs.php');

Jan 02, 2011 20:02

Looks like we're getting closer.

I received this error

Invalid widget code provided [latest_posts]!

I checked the plugin settings and you were right on with the code, it is latest_posts.

What else might it be looking for sam.

And I do appreciate the help.

Jan 02, 2011 20:06

My bad. It's a plugin, not a widget.

PHP

$Plugins->call_by_code'latest_posts'array(
        'title' => '',
        'blog_ID' => 123// make sure you changed this to correct blog ID
        'cols' => 3,
        'limit' => 6,
) );

Jan 02, 2011 20:50

Alright sam, I replaced

Took out:

<?php

skin_widget( array(
// CODE for the widget:
'widget' => 'latest_posts',
// Optional display params
'title' => '',
'blog_ID' => 123, // make sure you changed this to correct blog ID
'cols' => 3,
'limit' => 6,
) );

?>

Replaced with:

<?php

$Plugins->call_by_code( 'latest_posts' array(
'title' => '',
'blog_ID' => 2, // make sure you changed this to correct blog ID
'cols' => 3,
'limit' => 6,
) );

?>

And got:

Parse error: syntax error, unexpected T_ARRAY in /var/www/virtual/chitown-angler.com/htdocs/fin-n-feathers/default.php on line 135

Jan 02, 2011 20:57

A comma is missing :oops:

PHP

$Plugins->call_by_code'latest_posts'array(

The code I post is usually free typed and not tested ;)

Jan 02, 2011 22:01

sam2kb wrote:

A comma is missing :oops:

OK, now were rockin sam. And you missed a comma typing, hell I didn't even know it was missing.

Thanks a lot! You've been real helpful getting my site tweaked. It's appreciated.

Jan 26, 2011 22:38

Nice plugin.

But is there anyway for it to display the X most recent posts, and then list them in ascending order instead of descending? Using the options in the backend grabs the oldest posts instead.

Any workaround?


Form is loading...

Secure CMS – This forum is powered by b2evolution CMS, a complete engine for your website.