<? /** * This plugin can be used to display articles by name, followed by the name of the author. */ class NP_ListArticlesAndAuthor extends NucleusPlugin { function getEventList() { return array(); } function getName() { return 'ListOfArticlesAndAuthor'; } function getAuthor() { return 'Novi O\'Magum (based on plugin by anand)'; } function getURL() { return 'http://www.noviomagum.com/'; } function getVersion() { return '0.1'; } function getDescription() { return 'This plugin can be used to display a list of recent articles by name, followed by the name of the author. Use <%ListOfArticlesAndAuthor(n)%>, where n is the number of items you want to show (default=25)'; } // skinvar plugin can have a blogname as second parameter function doSkinVar($skinType,$numberOfPosts = 25) { global $manager, $blog, $CONF; $FancyURLs = 1; // Change this to 0 if you are NOT using the new fancy URLs in nucleusDev1.99. if ($blog) $b =& $blog; else $b =& $manager->getBlog($CONF['DefaultBlog']); $query = 'SELECT i.inumber as itemid, i.ititle as title, i.iauthor as author' . ' FROM nucleus_item as i' . ' WHERE i.iblog='.$b->blogid . ' and i.idraft=0' // exclude drafts . ' and i.itime<=' . mysqldate($b->getCorrectTime()) . ' ORDER by itime DESC LIMIT' . ' 0,'.$numberOfPosts; $entries = sql_query($query); while ($row = mysql_fetch_assoc ($entries)){ $itemlink = createItemLink($row['itemid'],''); $namequery="SELECT i.mrealname as realname FROM nucleus_member as i WHERE i.mnumber=".$row['author']; $name=sql_query($namequery); $row2=mysql_fetch_assoc($name); $memberlink= createMemberLink($row['author']); if ( $FancyURLs ) { if ( $row['title'] ) echo "<a href=\"".$itemlink."\">".$row['title']."</a> <small>(<a href=\"".$memberlink."\">".$row2['realname']."</a>)</small>"; else echo "<a href=\"".$itemlink."\">"."Untitled"."</a> <small>(<a href=\"".$memberlink."\">".$row2['realname']."</a>)</small>"; } else { if ( $row['title'] ) echo "<a href=\"".$b->getURL().$itemlink."\">".$row['title']."</a> <small>(<a href=\"".$memberlink."\">".$row2['realname']."</a>)</small>"; else echo "<a href=\"".$b->getURL().$itemlink."\">"."Untitled"."</a> <small>(<a href=\"".$memberlink."\">".$row2['realname']."</a>)</small>"; } echo "<br />"; } } } ?>