The plugin displays the category logo of the item it's belong to.

General Plugin info
Author: Qi, Liangpei (qi at jabber.org)
Current Version: 0.3
Download: -
Code: np_catlogo.php_code
Demo: -
Forum Thread: -

There also is another way to get the same effect, even more simple and nice, and no plugin needed, see this forum thread.

Installing

  1. Copy and save the code below to a file named by “NP_CatLogo.php”;
  2. Upload the NP_CatLogo.php file into the nucleus plugin directory;
  3. Install it in the plugin admin page.
  4. After then, insert the following to your templates, default and detailed. For example, between the item title and item body.
<div class="logobox"><%CatLogo%></div>

Options

When installed, there will be 4 options in the category config page. Goto the bottom of the blog config page, pick one category to set its logo options:

  • width of logo pic (default 50)
  • height of logo pic (default 50)
  • logo pic path (default /nucleus/plugins/cat_logo/)
  • logo pic name (default logo.jpg)

The pic path and pic name will be combined together to form the whole logo picture source in the <img > tag. Remember to prepare this path and the needed logo pictures by yourself.

Styling

Nucleus (by default) relies heavily upon a seperate stylesheet (.css file) that controls the look of your weblog/news page. The look of the category logo can be controlled by adding extra declarations to your css file. For instance:

.logobox {
   float: right;
   margin: 2px;
   padding: 0;
} 

NP_CatLogo.php code

<?php
class NP_CatLogo extends NucleusPlugin {
    function getName() { return 'Category Logo'; }
    function getAuthor()  { return 'Qi, Liangpei';}
    function getURL()  { return '';}
    function getVersion() { return '0.3';}
    function getDescription() {
        return 'The plugin displays the category logo of the item it\'s belong to.';
    }
    function supportsFeature ($what)
    {
        switch ($what)
        {
            case 'SqlTablePrefix':
                return 1;
            default:
                return 0;
        }
    }
 
    function install() {
      $this->createCategoryOption('pic_width','the width of your logo pic','text','50');
      $this->createCategoryOption('pic_height','the height of your logo pic','text','50');
      $this->createCategoryOption('pic_path','Logo pics Path. Default is nucleus/plugins/cat_logo/. And it must be ended with a slash.','text','/nucleus/plugins/cat_logo/');
      $this->createCategoryOption('pic_name','the full name of your logo pic','text','logo.jpg');
   }
 
    function doTemplateVar(&$item) {
	global $manager, $blog;
	$currentBlogid = $blog->getID();
 
	$catlogo_width = $this->getCategoryOption($item->catid, pic_width);
	$catlogo_height = $this->getCategoryOption($item->catid, pic_height);
	$catlogo_path = $this->getCategoryOption($item->catid, pic_path);
	$catlogo_name = $this->getCategoryOption($item->catid, pic_name);
 
	$catlogo = $catlogo_path . $catlogo_name;
	$params = array('blogid' => $currentBlogid);
	$catlink = createCategoryLink($item->catid, $params);
 
	echo '<a href="' . $catlink . '">' . '<img src="' . $catlogo . '" width="' . $catlogo_width . '" height="' . $catlogo_height . '" alt="' . 'logo" >' . '</a>';
 
    }
}
?> 

Plugin review

NP_CatLogo version 0.3 works with Nucleus CMS version 3.31 - 2007-10-27 ftruscot

:: Back to Plugins Overview ::

catlogo.txt · Last modified: 2007/10/28 06:00 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki