Textpattern中调用 近期评论 能不能不用 用户名(文章标题) 的方式。 见下面地址的左边 http://www.luweiqing.com/article/332/about-education-something Recent comments * 锐风 (在多浏览器使用silverlight的遇到若干问题) * 锐风 (PyWordPress) * inso (PyWordPress) * lee (PyWordPress) * inso (中国雅虎推出邮件客户端) 怎样才可以直接调用讨论内容??!!
http://textpattern.org/plugins/968/wyn_recent_comments http://textpattern.org/plugins/640/wet_recent_comments 可用扩展实现,前者的作者貌似是个中国人
关于这个插件的一点小改进。 这个的插件的评论链接是该评论文章的标题。 如下面加上红色代码后 评论链接就会在评论文章的标题后面回评论编号(#c000000) 也就是评论链接和官方的一样。 代码: function wyn_recent_comments ($atts, $thing) { extract (lAtts (array ( 'class' => __FUNCTION__, 'wraptag' => 'ul', 'break' => 'li', 'label' => '', 'labeltag' => '', 'limit' => 10, 'wordcount' => 10, 'messagebreak' => '...', 'format' => '%content%', 'atitle' => '%commenter% on %time%', 'section' => '', 'timeformat' => '%d %b %Y · %X', ), $atts)); /* create sql things */ $cols = 'discussid, ID, name, unix_timestamp(txp_discuss.posted) as time, message, Title'; $tables = safe_pfx_j ('txp_discuss, textpattern'); $where = 'parentid=ID and visible=1' . ('' == trim ($section) ? '' : " and Section='$section'") . ' order by time desc limit ' . $limit; $sql = 'SELECT ' . $cols . ' FROM ' . $tables . ' WHERE ' . $where . ';'; $rs = startRows ($sql); if ($rs) { $out = array (); while ($o = nextRow ($rs)) { extract ($o); $time = safe_strftime($timeformat, $time); /* 0 if for no limit */ if ($wordcount != 0) { $message = trim (doStripTags ($message)); $message = utf8_substr ($message, 0, $wordcount, $messagebreak); } $atitleattr = preg_replace ('/%title%/', $Title, $atitle); $atitleattr = preg_replace ('/%commenter%/', $name, $atitleattr); $atitleattr = preg_replace ('/%time%/', $time, $atitleattr); $atitleattr = preg_replace ('/%content%/', $message, $atitleattr); /* who will use content here ??? */ $cont = preg_replace ('/%title%/', $Title, $format); $cont = preg_replace ('/%commenter%/', $name, $cont); $cont = preg_replace ('/%time%/', $time, $cont); $cont = preg_replace ('/%content%/', $message, $cont); $link = '<a href="' . permlinkurl_id ($ID) . '#c' . $discussid . '" title="' . $atitleattr . '">' . $cont . '</a>'; $out[] = $link; } return doLabel ($label, $labeltag) . doWrap ($out, $wraptag, $break, $class); } } function utf8_substr($string, $start, $length, $wordbreak) { /* just return original thing if length is 0 or less than 0 */ if ($length <= 0) { return $string; } preg_match_all ('/[\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF][\x80-\xBF]|[\xF0-\xF4][\x80-\xBF][\x80-\xBF][\x80-\xBF]/', $string, $rs); $out = ''; $size = count ($rs[0]); $end = $start + $length; if ($end > $size - 1) { $end = $size; } for ($i = $start; $i < $end; $i++) { $out .= $rs[0][$i]; } if ($end < $size - 1) { $out .= $wordbreak; } return $out; }