BLOG:CMS :: Support Forum

Support Forum for BLOG:CMS

You are not logged in.

#1 25.01.2005 13:38

pons
BLOG:CMS Junior
Registered: 27.09.2004
Posts: 33

NP_StickyItem, able to stick item from a different blog

Hello there,

i've modified the plugin to be able to have a sticky item available even if the item is from a different blog (IMHO it's good if you have multiple blogs)

Code:

<?php

class NP_StickyItem extends NucleusPlugin {
    function getName() { return 'StickyItem'; }
    function getAuthor() { return 'Anand (edited by xiffy)'; }
    function getURL() { return 'http://www.tamizhan.com/'; }
    function getVersion() { return '0.13'; }

    function install(){
        $this->createOption('itemid','Enter the sticky item\'s id','text','1');
        $this->createOption('blogid','Enter the blog id','text','1'); //added 
      $this->createOption('template','Enter the name of the template','text','default');
  }


    function supportsFeature($feature) {
        switch($feature) {
            case 'SqlTablePrefix':
                return 1;
            default:
                return 0;
        }
    }

  function getDescription() { return 'This plugin can be used to display one sticky post';  }

  function doSkinVar($data,$itemid=0) {
    global $manager, $blog, $CONF;
    //if ($blog) $b =& $blog; else $b =& $manager->getBlog($CONF['DefaultBlog']);
    $b =& $manager->getBlog($this->getOption('blogid')); //added
    if ($itemid<1 || !isset($itemid)) $itemid = $this->getOption('itemid');
    $template = $this->getOption('template');
    $extraQuery = ' and inumber=' . intval($itemid);
    $b->readLogAmount($template, 1, $extraQuery, 0, 1, 0);
  }
}
?>

I leaved the old lines commented and I just added two lines, those that ends with the "added" php comment.

hope it's usefull to anyone.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

TOPlist