function doSkinVar($skinType, $numberOfWritebacks = 5, $filter = '', $TBorCm = 'all', $numberOfCharacters = 60, $numberOfTitleCharacters = 40, $toadd = "...")
 {
     global $manager, $CONF, $blog;
     if (!is_numeric($numberOfWritebacks)) {
         $filter = $numberOfWritebacks;
         $numberOfWritebacks = 5;
         // defaults to 5
     }
     $b =& $manager->getBlog($CONF['DefaultBlog']);
     $this->defaultblogurl = $b->getURL();
     if (!$this->defaultblogurl) {
         $this->defaultblogurl = $CONF['IndexURL'];
     }
     if ($blog) {
         $b =& $blog;
     }
     $blogid = $b->getID();
     //for select
     $filter = trim($filter);
     if ($filter == 'current') {
         $filter = 'cblog = ' . $blogid;
     } elseif (strstr($filter, '=')) {
         $filter = str_replace('=', '', $filter);
         $filter = ' cblog IN(' . str_replace('/', ',', $filter) . ')';
     } elseif (strstr($filter, '<>')) {
         $filter = str_replace('<>', '', $filter);
         $filter = ' cblog <> ' . str_replace('/', ' AND cblog <> ', $filter);
     }
     setlocale(LC_TIME, $this->getOption('timelocale'));
     $arr_res = array();
     if ($TBorCm != 't') {
         $join = '';
         $query = 'SELECT' . ' c.cnumber as commentid,' . ' c.cuser   as commentator,' . ' c.cbody   as commentbody,' . ' c.citem   as itemid,' . ' c.cmember as memberid,' . ' SUBSTRING(c.ctime, 6, 5) as commentday,' . ' UNIX_TIMESTAMP(c.ctime)  as ctimest';
         if ($EzComment2 = $this->pluginCheck('EzComment2')) {
             if (method_exists($EzComment2, 'getTemplateParts')) {
                 $query .= ', s.comid   as cid, ' . 's.secflg  as secret, ' . 's.module  as modname, ' . 's.userID  as identity ';
                 $join = ' LEFT OUTER JOIN ' . sql_table('plug_ezcomment2') . ' as s ' . ' ON c.cnumber = s.comid ';
             }
         }
         // select
         $query .= ' FROM ' . sql_table('comment') . ' as c ' . $join;
         if ($filter) {
             $query .= ' WHERE ' . $filter;
         }
         $query .= ' ORDER by c.ctime DESC LIMIT 0, ' . $numberOfWritebacks;
         $comments = sql_query($query);
         if (sql_num_rows($comments)) {
             while ($row = sql_fetch_object($comments)) {
                 $content = (array) $row;
                 $tempBody = strip_tags($content['commentbody']);
                 $tempBody = htmlspecialchars($tempBody, ENT_QUOTES, _CHARSET);
                 $tempBody = shorten($tempBody, $numberOfCharacters, $toadd);
                 $tempBody = htmlspecialchars($tempBody, ENT_QUOTES, _CHARSET);
                 $tempBody = str_replace("\r\n", ' ', $tempBody);
                 $tempBody = str_replace("&amp;", '&', $tempBody);
                 $tempBody = str_replace("&gt;", '>', $tempBody);
                 $tempBody = str_replace("&lt;", '<', $tempBody);
                 $content['commentdate'] = strftime($this->getOption('cmdateformat'), $content['ctimest']);
                 $content['commentbody'] = str_replace("&amp;amp;", '&amp;', $tempBody);
                 if (!empty($row->memberid)) {
                     $mem = new MEMBER();
                     $mem->readFromID(intval($row->memberid));
                     $content['commentator'] = $mem->getRealName();
                 }
                 if ($EzComment2) {
                     $bid = intval(getBlogIDFromItemID(intval($comment['itemid'])));
                     if ($EzComment2->getBlogOption($bid, 'secret') == 'yes') {
                         $b = $manager->getBlog($bid);
                         global $member;
                         $judge = $EzComment2->setSecretJudge($bid, $member, $b);
                     }
                 }
                 if ($judge && $content['secret']) {
                     $content = $EzComment2->JudgementCommentSecrets($content, $judge);
                 }
                 /*					$cid  = $row->cnumber;
                 					$ct  = $row->ctimest;
                 					$ctst  = date("y-m-d H:i",$ct);
                 					$text = strip_tags($row->cbody);
                 					$text = htmlspecialchars($text, ENT_QUOTES,_CHARSET);
                 					$ctext = shorten($text,$numberOfCharacters,$toadd);
                  
                 					if (!$row->cmember) $myname = $row->cuser;
                 					else {
                 						$mem = new MEMBER;
                 						$mem->readFromID(intval($row->cmember));
                 						$myname = $mem->getRealName();
                 					}*/
                 //					$itemlink = $this->_createItemLink($row->citem, '');
                 //					$arr_res[$ct] =  "<li>&clubs;<a href=\"".$itemlink."#c".$cid."\">$ctst|".$myname."&gt;".$ctext."</a></li>" ;
                 $itemlink = $this->_createItemLink($content['itemid']);
                 $content['itemlink'] = $itemlink;
                 $arr_res[$content['ctimest']] = TEMPLATE::fill($this->getOption('cmttemplate'), $content);
             }
         }
     }
     //=========================
     if ($manager->pluginInstalled('NP_TrackBack') && $TBorCm != 'c') {
         $query = 'SELECT' . ' t.id        as tbid,' . ' t.title     as entrytitle,' . ' t.excerpt   as expect,' . ' t.url       as tburl,' . ' t.tb_id     as trackbackid,' . ' t.blog_name as blogname,' . ' t.timestamp as tbdate,' . ' SUBSTRING(t.timestamp, 6, 5) as tbday,' . ' UNIX_TIMESTAMP(t.timestamp)  as ttimest' . ' FROM ' . sql_table('plugin_tb') . ' t,' . sql_table('item') . ' i' . ' WHERE t.tb_id = i.inumber';
         if ($this->checkTBVersion()) {
             $query .= ' and t.block = 0';
         }
         if ($filter) {
             $tfilter = str_replace('c.cblog', 'i.iblog', $filter);
             $query .= ' and ' . $tfilter;
         }
         $query .= ' ORDER by t.timestamp DESC LIMIT 0, ' . $numberOfWritebacks;
         $comments = sql_query($query);
         if (sql_num_rows($comments)) {
             while ($row = sql_fetch_object($comments)) {
                 $content = (array) $row;
                 $entrytitle = strip_tags($content['entrytitle']);
                 $entrytitle = htmlspecialchars($entrytitle, ENT_QUOTES, _CHARSET);
                 $entrytitle = shorten($entrytitle, $numberOfCharacters, $toadd);
                 $entrytitle = htmlspecialchars($entrytitle, ENT_QUOTES, _CHARSET);
                 $content['entrytitle'] = $entrytitle;
                 $content['expect'] = str_replace("\r\n", ' ', $content['expect']);
                 $blogname = htmlspecialchars($content['blogname'], ENT_QUOTES, _CHARSET);
                 $content['blogname'] = $blogname;
                 $content['tbdate'] = strftime($this->getOption('tbdateformat'), $content['ttimest']);
                 /*					$title = strip_tags($row->title);
                 					$title = htmlspecialchars($title, ENT_QUOTES,_CHARSET);
                 					$ctitle = shorten($title,$numberOfCharacters,$toadd);
                 					$blogname = htmlspecialchars($row->blog_name, ENT_QUOTES,_CHARSET);
                 					$tbtime = $row->ttimest;
                 					$ttst  = date("y-m-d H:i",$tbtime);*/
                 //					$itemlink = $this->_createItemLink($row->tb_id, '');
                 //					$arr_res[$tbtime] = '<li>&hellip;<a href="'.$itemlink.'#trackback">'.$ttst.'|'.$blogname.' ping: "'.$ctitle.'"</a></li>';
                 $itemlink = $this->_createItemLink($content['trackbackid']);
                 $content['itemlink'] = $itemlink;
                 $arr_res[$content['ttimest']] = TEMPLATE::fill($this->getOption('tbktemplate'), $content);
             }
         }
     }
     //=========================
     krsort($arr_res);
     $ress = array_values($arr_res);
     $show_rescnt = min(intval($numberOfWritebacks), count($arr_res));
     switch ($TBorCm) {
         case 'c':
             $head = $this->getOption('cmlisthead');
             $foot = $this->getOption('cmlistfoot');
             break;
         case 't':
             $head = $this->getOption('tblisthead');
             $foot = $this->getOption('tblistfoot');
             break;
         default:
             $head = ' <ul class="nobullets"> ';
             $foot = ' </ul> ';
             break;
     }
     //		echo ' <ul class="nobullets"> ';
     echo $head;
     for ($j = 0; $j < $show_rescnt; $j++) {
         echo $ress[$j] . "\n";
     }
     echo $foot;
     //		echo " </ul> ";
 }