BLOG:CMS :: Support Forum

Support Forum for BLOG:CMS

You are not logged in.

#1 24.11.2005 14:23

ihra
BLOG:CMS Senior
From: Helsinki, Finland
Registered: 03.08.2004
Posts: 83
Website

NP_Events

Or something similar. Shows future items in simple "date/time caption + basic description" from each item. Intended to use with my "how-to: show future posts" (http://forum.blogcms.com/viewtopic.php?id=1809).

Save it as /admin/plugins/NP_Events.php
Call it from your skin (<%Plugin(Events)%> or similar).

Code:

<?

class NP_Events extends NucleusPlugin {

    // name of plugin
    function getName() {
        return 'Tapahtumat kalenterista';
    }

    // author of plugin
    function getAuthor()  {
        return 'ihra';
    }

    // an URL to the plugin website
    // can also be of the form mailto:foo@bar.com
    function getURL()
    {
        return 'http://www.nominaali.com/~freebooters/';
    }

    // version of the plugin
    function getVersion() {
        return '1.0.4';
    }

    // a description to be shown on the installed plugins listing
    function getDescription() {
        return 'Shows 5 incoming events from item database.';
    }

    function doSkinVar($skinType) {
    // get blog id
    $blogid = strval(getCurrentBlogId());
    // insert your category by hand
     $query = sql_query("SELECT inumber, ititle, iurltitle, ibody,  UNIX_TIMESTAMP(itime) as time "
                           ."FROM ".sql_table('item')." as i WHERE i.iblog=$blogid and i.itime>".mysqldate(time())." AND icat=3 ORDER by time DESC LIMIT 0,5"); 
      $num = 0; 
      global $blog;
      echo "<h4>Incoming events</h4>";
      while ($msg = sql_fetch_array($query)) { 
        $itemdate= date("d.n.y G:i",$msg['time']);
        $itemlink = fancyTitle($msg['inumber'],$msg['iurltitle'],$msg['itime']);
        if ($num==0) echo "<ul id='articlestats5'>\n";
        $num++; 
        echo "<li><b>".$itemdate."</b> <a href=\"".$itemlink."\">".strip_tags($msg['ititle'])."</a>".$msg['ibody']."</li>\n"; 
      } 
     if ($num>0) echo "</ul>\n";
    
    }

}
?>

Last edited by ihra (24.11.2005 14:26)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

TOPlist