<?php
/*
Version history:
- 0.2 (2004-09-11): added MySQL table prefix, small code fixes
- 0.1 (2003-08-13): initial version
*/
class NP_BlogList extends NucleusPlugin {
	function getName() { return 'Blog List'; }
	function getAuthor() { return 'Ben Osman | Rodrigo Moraes'; }
    function getURL() { return 'http://www.justletgo.org/'; }
	function getVersion() { return '0.2'; }
	function getDescription() {
		return 'List can be shown using &lt;%BlogList%&gt; OR &lt;%BlogList(bpublic = 1)%&gt;. <br /> It has following parameters : filter, header, list, footer)'; }
	function install() {
		$this->createOption('OrderBy','Field that list is sorted by','text','bname ASC');
		$this->createOption('Header','Header Template','text','<ul class="nobullets">');
		$this->createOption('List','List Template ','text','<li><a href="<%bloglink%>"><%blogname%></a></li>');
		$this->createOption('Footer','Footer Template','text','</ul>'); }
 
	function supportsFeature($what) {
		switch($what) {
			case 'SqlTablePrefix': return 1;
			default: return 0;
		}
	}
 
	function doSkinVar($skinType, $filter ='', $header ='', $list='', $footer='') { 
		global $CONF;
 
		// determine arguments next to catids
		// I guess this can be done in a better way, but it works
		if (!$header) {
			$header = $this->getOption('Header');
		}
		if (!$list) {
			$list = $this->getOption('List');
		}
		if (!$footer) {
			$footer = $this->getOption('Footer');
		}
 
		//$blogurl = $this->getURL() . $qargs;
		$blogurl = createBlogLink($this->getURL(), $linkparams);
 
		$template = TEMPLATE::read($template);
 
		echo TEMPLATE::fill($header,array());
 
		$where = '';
		if ($filter <> '') {
			$where =  'WHERE '.$filter;
		}
 
		$query = 'SELECT bnumber as blogid, bname as blogname, burl as bloglink FROM ' . sql_table('blog') . ' ' . $where . ' ORDER BY ' . $this->getOption('OrderBy');
		$res = sql_query($query);
 
		while ($data = mysql_fetch_assoc($res)) {
			$data['self'] = $CONF['Self'];
			$temp = TEMPLATE::fill($list,$data);
			echo strftime($temp,$current->itime);
		}
 
		echo TEMPLATE::fill($footer,array());
	}
}
?>
np_bloglist_code.txt · Last modified: 2007/10/30 19: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