不断更新中……
最近更新日期: 2006-03-08 17:53
加入月历(MT3.2)
在“Main Index”模板的<div class=”module-search module”>一句之前,加入以下代码:
<div class=”module-calendar module”> <h2 class=”module-header”><$MTDate format=”%B %Y”$></h2> <div class=”module-content”> <table summary=”Monthly calendar with links to each day’s posts”><tr>
<th abbr=”星期日”>日</th>
<th abbr=”星期一”>一</th>
<th abbr=”星期二”>二</th>
<th abbr=”星期三”>三</th>
<th abbr=”星期四”>四</th>
<th abbr=”星期五”>五</th>
<th abbr=”星期六”>六</th>
</tr>
<MTCalendar>
<MTCalendarWeekHeader><tr></MTCalendarWeekHeader>
<td>
<MTCalendarIfEntries>
<MTEntries lastn=”1″>
<a href=”<$MTEntryPermalink$>”><$MTCalendarDay$></a>
</MTEntries>
</MTCalendarIfEntries>
<MTCalendarIfNoEntries>
<$MTCalendarDay$>
</MTCalendarIfNoEntries>
<MTCalendarIfBlank> </MTCalendarIfBlank></td>
<MTCalendarWeekFooter></tr></MTCalendarWeekFooter>
</MTCalendar>
</table>
</div>
</div>
链接日归档索引, 首先你必须已经启用了日存档,在Settings -> Publishing Settings -> Publishing中,选中“Daily”。
然后,把那段代码中的
<a href=”<$MTEntryPermalink$>”><$MTCalendarDay$></a>
改成
<a href=”<$MTCalendarDate format=”%Y/%m/%d/”$>”><$MTCalendarDay$></a>
最后,更改stylesheet:
.module-calendar .module-content td
{
width: 16%; /*在此处将14%更为16%*/
text-align: center;
}
让整个月历看上去更漂亮。
注意,服务器计算月历的代价是相当高昂的,建议如果没什么用处,不要将月历显示出来。
详细月历效果请见http://weblog.qiran.org
显示文章类别:
<p class=”entry-footer”><span class=”post-footers”>Posted by <$MTEntryAuthorDisplayName$> at <$MTEntryDate format=”%X”$></span>
<span class=”separator”>|
</span> <a class=”permalink” href=”<$MTEntryPermalink$>”>Permalink</a>
<MTIfCommentsActive>|
<a href=”<$MTEntryPermalink$>#comments”>Comments (<$MTEntryCommentCount$>)</a></MTIfCommentsActive>
<MTIfPingsActive>|
<a href=”<$MTEntryPermalink$>#trackback”>TrackBacks (<$MTEntryTrackbackCount$>)</a></MTIfPingsActive>|
<MTEntryCategories glue=”,”>
<a href=”<$MTCategoryArchiveLink$>”><$MTCategoryLabel$></a></MTEntryCategories>
</p>
安装blogroll
1. 下载blogroll插件
2. 解压后上传,注意对应好/cgi-bin/mt/下的同名文件夹上传,即把blogroll的/plugins/文件夹里的内容上传到/cgi-bin/mt/plugins/下面,/php/文件夹里的内容上传到/cgi-bin/mt/php/下面。
3. 将mt-blogroll.cgi的CHMOD permission设为755。
上传后,在System Overview里的plugins下面可以看到MT Blogroll插件,接下来初始化数据库,在浏览器里输入
http://yourdomain/cgi-bin/mt/plugins/mt-blogroll.cgi
按照install/upgrade界面按步骤完成初始化数据库。
接下来,就是新建你的blogroll catagories和添加链接了!
Note: 如果出问题,可能需要清除你的浏览器cache. 另外建议使用Mozilla Firefox浏览器,其他浏览器似乎有些问题。
MT Blogroll: Template Tags
对于static或者dymanic方式重建的系统,以下tags可以在你的模板里采用:
MTBlogrollEntries
MTBlogrollEntryID
MTBlogrollEntryURI
MTBlogrollEntryName
MTBlogrollEntryBlogAuthor
MTBlogrollEntryDesc
MTBlogrollEntryIfRel
MTBlogrollEntryRel
MTBlogrollEntryPriority
MTBlogrollEntryDate
MTBlogrollEntryModifiedDate
MTBlogrollEntryCategory
MTBlogrollEntryCategories
MTBlogrollEntryTarget
MTBlogrollEntryUpdated
MTBlogrollEntryIfUpdated
MTBlogrollCategories
MTBlogrollCategoryLabel
MTBlogrollCategoryDesc
我使用的方案:
<div class=”module-categories module”>
<h2 class=”module-header”>Blogroll</h2>
<div class=”module-content”>
<MTBlogrollCategories>
<p><MTBlogrollCategoryLabel></p>
<MTBlogrollEntries>
<li><a href=”<MTBlogrollEntryURI>” <MTBlogrollEntryIfRel>rel=”<MTBlogrollEntryRel>”
</MTBlogrollEntryIfRel> target=”<MTBlogrollEntryTarget>” title=”<MTBlogrollEntryDesc>”><MTBlogrollEntryName></a><br />
</li>
</MTBlogrollEntries>
</MTBlogrollCategories>
</div>
</div>
catagories文章数量显示:
<MTIfArchiveTypeEnabled archive_type=”Category”> <h3>Categories Archives</h3> <ul class=”sidebarlinks”> <MTCategories><li>
<a href=”<$MTCategoryArchiveLink$>” title=”<$MTCategoryDescription$>”>
<$MTCategoryLabel$>(<$MTCategoryCount$>)</a>
</li></MTCategories>
</ul>
</MTIfArchiveTypeEnabled>
或者
<MTIfNonZero tag=”MTCategoryCount”><li class=”module-list-item”>
<a href=”<$MTCategoryArchiveLink$>” title=”<$MTCategoryDescription$>”><MTCategoryLabel></a>(<$MTArchiveCount$>)<MTElse>
<li class=”module-list-item”><MTCategoryLabel>
</MTElse>
</MTIfNonZero>
显示comments:
<div class=”module-archives module”><h2 class=”module-header”>Recent Comments</h2>
<div class=”module-content”>
<ul class=”module-list”>
<MTComments lastn=”15″ sort_order=”descend”>
<MTCommentEntry><li class=”module-list-item”>
<a href=”<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTCommentEntryID$>”>
RE:<$MTEntryTitle$></a></MTCommentEntry>
<br/>
<$MTCommentAuthor$> at <$MTCommentDate format=”%m/%d”$> said:
<br />
<$MTCommentBody trim_to=”30″$>
</li></MTCommentEntry>
</MTComments>
</ul>
</div>
</div>
使用.htaccess
我的目录分布为:
/qiran.org/ 根目录
/weblog.qiran.org/ 次级域名,DH的特色,次级域名是独立的空间,可以真正分给朋友来使用。
/wiki.qiran.org/ 次级域名,同上
为了使http://www.qiran.org/weblog与http://weblog.qiran.org可以访问到同一个空间,因此使用了.htaccess的redirect功能:
Options -IndexesRedirect /weblog http://weblog.qiran.org/
Redirect /wiki http://wiki.qiran.org/
注:
第一行用于禁止显示文件清单,当前目录下没有默认的index文件时,文件清单将禁止显示!
第二/三行用于域名转向
建立google sitemap
在Template里面,新建名为sitemap的模板,输出文件sitemap.xml
该文件链接为/home/.ernie/christnan/qiran.org/sitemap.xml
内容如下:
<?xml version=”1.0″ encoding=”UTF-8″?><urlset xmlns=”http://www.google.com/schemas/sitemap/0.84″>
<url><loc><$MTBlogURL encode_xml=”1″$></loc>
<lastmod>2006-01-05</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<MTEntries lastn=”9999″>
<url><loc><$MTEntryPermalink encode_xml=”1″$></loc>
<lastmod><$MTEntryModifiedDate utc=”1″ format=”%Y-%m-%dT%H:%M:%SZ”$></lastmod></url>
</MTEntries>
</urlset>
重建该模板,在google上建立自己的帐号,添加链接让google找到sitemap.xml文件。
接下来按google要求的方式确认:即将googlea3e892f7c5eac9d1.html(内容为空,名字每个帐户不同)上传至根目录,点击google下的确认即可真正添加好自己的sitemap。
Related Entries插件
下载RelatedEntries.zip,将RelatedEntries.pl上传至/plugins文件夹,将其属性改为755
修改Individual Entry Archive里的以下内容:
<a id=”a<$MTEntryID pad=”1″$>”></a><div class=”entry” id=”entry-<$MTEntryID$>”>
<h3 class=”entry-header”><$MTEntryTitle$></h3>
<div class=”entry-content”>
<div class=”entry-body”>
<$MTEntryBody$>
</div><div id=”more” class=”entry-more”>
<$MTEntryMore$>
</div></div>
<p class=”entry-footer”>
<span class=”post-footers”>
By <$MTEntryAuthor$> on <$MTEntryDate$></span>
<span class=”separator”>|
</span> <a class=”permalink” href=”<$MTEntryPermalink$>”>Permalink</a>|
<MTEntryCategories glue=”,”>
<a href=”<$MTCategoryArchiveLink$>”><$MTCategoryLabel$></a></MTEntryCategories>
</p>
<br/>
<p>Related Entries|相关文章: <br />
<MTRelatedEntries field=”keywords”>
<MTEntries lastn=”6″>
<li><a href=”<MTEntryLink>”><MTEntryTitle></a> -
<i><$MTEntryDate format=”%b %d, %Y”$></i></li>
</MTEntries>
</MTRelatedEntries>
</p>
</div>
另外,Customize编辑文章时的显示模式,将keywords显示出来,这样Related Entries可以依据keywords将相关文章显示在当前文章下面。
建立所有文章列表
在TEMPLATES的index下,添加以下模板:
Template Name: ALL Entries
Output File: entries.html
Template Body:
<已删除>, 所有文章列表可以链接到http://yourweblogdomain/archives.html
你可以通过修过archives模板来添加每篇文章更具体的信息,而不必像原模板一样光溜溜的。
MT没有首页翻页功能,加上所有文章的链接,以便于快速查找。
Flickr与MT整合:
MT3.15之前,Flickr与Movable Type可以直接匹配,
但升级到MT3.2以后,由于MT增设了API密码,使得Flickr无法直接访问API,因此你需要做以下改动:
在Author Profile里面最后一行,
API Password:
For use with XML-RPC and Atom-enabled clients
设定好你的API密码(这样别人就需要通过密码来调用你的XML-RPC和ATOM了)
在flickr下,Set up a new blog,
类型为movable type blog
URL路径为http://yourdomin/cgi-bin/mt/mt-xmlrpc.cgi
用户名:<你的用户名>
密码:<你的API密码,注意MT3.2下不再是你的登录密码>
OK
接下来,在Flickr界面下自定义你的显示模板:
我的最终layout代码为:
<div style=”float: right; margin-bottom: 0px;”>
<a href=”{photo_url}” title=”photo sharing”><img src=”{photo_src_m}” alt=”" style=”border: solid 2px #000000;” /></a>
<br />
<span style=”font-size: 12px; font-family: Verdana, Arial, sans-serif; color: #666666; line-height: 130%;”>
<a href=”{photo_url}”>{photo_title}</a>
<br />
Originally uploaded by <a href=”{uploader_profile}”>{uploader_name}</a>.
</span>
</div>
<span style=”font-size: 12px; font-family: Verdana, Arial, sans-serif; color: #666666; line-height: 140%;”><br />
{description}
</span>
<br clear=”all” />
这样你就可以方便地通过点击”blog it”把你的照片发布了。
缺陷仍有,通过这种方式blog上去的照片没有默认的catagory,你要自己手动到MT管理界面下手动设定类别才行。
Lilina
使用lilina进行新闻聚合,制造自己的门户。
事实上,使用lilina并非是真的想制造门户,只是为了自己阅读方便,而不必打了那一大堆的窗口(70%以上往往是打开所有朋友的blog后发现没有任何更新)。
安装方法如下:
下载lilina,解压缩后更改conf.php
$BASEURL = ‘http://www.qiran.org’ ; // no trailling slash!
$USERNAME = ‘username’ ; //更改成你的用户名
$PASSWORD = ‘password’ ; //更改成你自己的密码
$SITETITLE = “QiRan.ORG” ;
$OWNERNAME = “Qi Ran” ;
$OWNEREMAIL = “Christnan@gmail.com” ;
保存后,将所有文件上传到根目录,安装方式见http://lilina.sourceforge.net/
注意将要求的目录CHMOD设定为777
访问http://yourlilinaURL/index.php
可以直接看到聚合内容了。
如果要更改自己要订阅的更新,可以通过以下方式修改订阅清单:
http://yourlilinaURL/edit.php
使用conf.php中设定的username和password,进入编辑模式,删除你不要的站点,添加上你想要的。
通过修改style.css和index.php里的相关内容,个性化你的门户。
在index.php中:
$TIMERANGE = ( $_REQUEST['hours'] ? $_REQUEST['hours']*3600 : 3600*72 ) ;
这里可以修改你的默认显示N天文章(3600*72是显示三天的)
define(’MAGPIE_CACHE_AGE’,60*60*3) ;
这里显示cache时间。”Lilina的缓存机制是每次请求的时候遍历缓存目录下的RSS文件,如果缓存文件过期,再动态向RSS数据源进行请求。” (from Chedong)
修改抓取时间(默认为服务器时间,因此要修改服务器与中国时差,我的服务器在-8区,时差达16小时),找到并修改成以下代码:
if ($x['date_timestamp'] == ”)
$x['date_timestamp'] = create_time($x['title'] . $x['link']);
else
$x['date_timestamp'] += $TIMEZONE_OFFSET * 60 * 60;
$items[] = $x ;
当然,如果RSS本身的时间就是错误的,抓取到的网页时间计算过来后也是错误的了,用WP的注意了。
每次load .php程序的时候, 后台先会判断cache是否过期(如上所述为3小时, 我的好友们不怎么常更新, 3个小时足够了), 再重新去取xml或直接将cache取到网页上显示出来. 这样一来, 首页的显示速度成了大问题.
参考了车东的经验后, 我将lilina放在了次级目录下, 把index.php与css重新排布适应自己的习惯, 再使用”wget -O”定时将lilina生成的动态页面取回存诸到根目录的index.html, 这样, 打开http://www.qiran.org/时便相当于打开了一个静态页面,速度立刻快了几倍.
wget -O /path_to_root/index.html http://www.qiran.org/lilina/lilina.php
随后,设定cron job:
1 * * * * (wget -O /path_to_root/index.html http://www.qiran.org/lilina/lilina.php)
使得每小时系统会自动去更新一次index.html
另外,之所以使用/lilina/lilina.php是因为CSS及图片等引用路径的原因, 其内容只需要将index.php复制过来稍作修改即可.
现在,终于明白那个“RSS”图标是做啥用的了吧?我现在订阅了比较关注的朋友们的网页,不用一个一个打开他们的网页也知道他们有没有更新过自己的blog了。
[åå]Blogroll å®è£ ç¬è®°
æ³ç»æçBlogæ·»å å ä¸ªåæ é¾æ¥ï¼ä½æ¯æåç°MTæ¬èº«å¹¶æ²¡ææä¾æ¤åè½ï¼å½ç¶ï¼æä»¬ä¹å¯ä»¥éè¿ç´æ¥ä¿®æ¹æ¨¡æ¿æ¥æ·»å 龿¥ï¼ä½æ¯æ»è§å¾è¿æ ·å¤ªéº»ç¦ãè¿å¥½ï¼MTçæä»¶Blogrollå¯ä»¥å¸®æè§£å³è¿ä¸ªé®é¢…