Tuesday, October 18, 2005

SSI 和 document.write()

这两天一直在考虑怎么给 Blogger 加上 Calendar 和分类的功能。原来是这么打算的:

首先,要让生成的 HTML 代码尽量符合 XHTML 规范,以便可以写程序用 XML 解析器来分析并从中提取数据。只要是合法的 XML,应该问题就不大,不一定要完全遵循 XHTML 的 DTD,反正 Dom4J 没有 DTD 照样能分析 XML,不过,这个还有待试验证实。

Blogger 的帖子数据里面,link 这个字段似乎没有什么用,可以利用它来存储分类。通过程序分析提取以后,套用 Blogger 的模板生成 HTML,并把出现过的分类列表写到一个单独的 HTML 中,由需要的页面通过 SSI include 进来。

同样利用分析出来的数据,生成日历的 HTML,每个月一个文件,供需要的页面调用。

不过,要让 Resin 支持 SSI 功能,可能性不太大,必须另外想办法。

昨天给 BlogBus 做模板,发现这个 Blog 的默认模板里头,所有侧边栏(日历,最近贴,存档,Tags 等)全部都是由 JavaScript 来 document.write() 的,而 JavaScript 代码本身,也貌似是发布的时候根据数据动态产生的,估计这个是为了达到这些数据块可以在需要的地方重复调用的目的。

于是,我想,是不是我也可以将 Blogger 里头需要的 Calendar 和分类数据也在发布时用 Servlet 写成 JavaScript,然后再在需要的地方用这些 JavaScript 来 document.write()

嗯,有空试验一下就知道了…… 理论上应该是可行的……

Updated on 11/13/2005:

经过试验,用 document.write() 方式输出是可行的,现在此 blog sidebar 上的日历就是用 document.write() 打印出来的,而数据是由 Servlet 分析生成的 HTML 文件后自动写的 JavaScript 代码。问题有两个,一是用 Dom4j 解析的时候,对实体 (entities) 的解析有点问题,要把除 & 以外的所有实体全部清楚掉才能解析正确,应该有正确的识别方法,尚在研究中。另一个问题是,documents.write() 写出来的内容,无法被搜索引擎识别,但对网站本身功能影响不大。


Anonymous said...



Anonymous said...

呵呵,Blogger 除了缺少一些 Blog 流行的功能以外,其它都挺好的……

Anonymous said...

請問要如何在blogger beta 加上 canender ?

Anonymous said...

Excellent blog! Do you have any recommendations for aspiring writers?
I'm hoping to start my own blog soon but I'm a
little lost on everything. Would you recommend starting with a free platform like Wordpress or go for a
paid option? There are so many choices out there that I'm completely overwhelmed ..
Any tips? Thank you!

Here is my page - download RP generator (goo.gl)

oakleyses said...

ferragamo shoes, supra shoes, abercrombie and fitch, ray ban pas cher, wedding dresses, nfl jerseys, reebok outlet, hermes, juicy couture outlet, air max, lululemon, p90x, ghd, timberland, mulberry, lancel, hogan, new balance shoes, birkin bag, mont blanc, asics, nike air max, ugg boots, soccer jerseys, hollister, rolex watches, north face outlet, beats by dre, montre pas cher, nike free, louis vuitton, ugg boots, herve leger, chi flat iron, vans, ralph lauren, oakley pas cher, jimmy choo, insanity, converse shoes, louis vuitton, karen millen, celine handbags, bottega veneta, marc jacobs, soccer shoes, mcm handbags, yoga pants, burberry, valentino shoes

oakleyses said...

oakley outlet, moncler outlet, oakley vault, rayban, ray-ban, canada goose outlet, oakley vault, oakley sunglasses cheap, cheap sunglasses, cheap oakley, ugg boots, ugg, ray ban, ralph lauren, oakley vault, ray ban outlet, raybans, ray ban, cheap sunglasses, ray ban sunglasses outlet, louboutin, oakley, cheap sunglasses, canada goose, canada goose, canada goose, cheap oakley sunglasses, cheap oakley sunglasses, ray bans, oakley sunglasses outlet, oakley sunglasses cheap, oakley sunglasses outlet, discount oakley sunglasses, ray ban, ray bans, rayban, cheap oakley sunglasses, tn pas cher, ray ban outlet, oakley outlet, oakley outlet, moncler, oakley sunglasses outlet, canada goose, gucci, moncler, moncler, canada goose outlet, oakley sunglasses cheap

oakleyses said...

nike blazer, michael kors, nike free run uk, nike air max, true religion jeans, true religion jeans, air jordan pas cher, nike air max, ralph lauren uk, timberland, air max, nike roshe, tn pas cher, louboutin pas cher, true religion outlet, vans pas cher, coach outlet, hermes, ralph lauren pas cher, nike free, coach purses, michael kors, oakley pas cher, mulberry, hollister pas cher, lacoste pas cher, new balance pas cher, ray ban pas cher, vanessa bruno, burberry, hollister, michael kors, kate spade handbags, coach outlet, abercrombie and fitch, lululemon, coach factory outlet, nike roshe run, north face, nike air max, ray ban uk, michael kors, true religion jeans, converse pas cher, north face, air force, hogan, sac longchamp, longchamp pas cher, sac guess

Karen said...

This NFL Flag for Washington Redskins is constructed of polyester, measures 3x5 feet, and has two metal grommets for attaching to our 6' aluminum flagpoles or any of our tailgate pole systems. The perimeter of our NFL Flag for Washington Redskins is double stitched and the team logos are screen printed into the flag so they won't peel. Because of its large size, these flags are great to hang on any wall in your game room, sports room, garage.

stars and stripes flags,
football flags salecheap St.Louis Rams house divided flags
Falcons house divided flags

Karen said...

Proprio come la scorsa stagione, il Galatasaray 16-17 kit di casa pantaloncini sono rossi. La novità di quest’anno sono le calze che sono di colore giallo per completare una combinazione insolita che è in linea con la maggior parte degli altri kit di Nike per la stagione 2016-17maglie calcio 2017,
maglie calcio poco prezzo, Maglia real madrid a poco prezzo 2017
nuove Maglia Atletico Madrid prezzo

琐事 said...

michael kors handbags wholesale
cheap nfl jerseys wholesale
instyler max 2
nike huarache trainers
ed hardy outlet
pandora charms
michael kors handbags sale
tiffany and co outlet
lebron shoes
longchamp le pliage

chenmeinv0 said...

cheap nhl jerseys
canada goose sale
coach outlet store online clearances
canada goose jackets
coach factory outlet
abercrombie kids
ugg clearance
polo ralph lauren
canada goose jackets
michael kors outlet online