teaser到底是啥意思

由 vaccy 于 周六, 2006-12-30 10:34 提交。

一直不能准确理解这个词的意思,大家说说。

teaser中文翻译的时候

teaser中文翻译的时候叫做“内容摘要”,就是像首页那里看到的一小段文章内容,点击进去才是全文。
内容摘要,缺省设置就是文章的前一小部分(具体到哪里可以自己设置),也有专门的模块来定制专门的摘要内容。

--------------------------------------------------
我的Drupal试验田:http://drupal.verydummy.com
--------------------------------------------------

哦,因为我看到有的

哦,因为我看到有的说teaser时提到title,submission,terms,content,links,等等,所以我有些迷糊了

对,你说的差不多这

对,你说的差不多这些都是一个node的基本组成成分

--------------------------------------------------
我的Drupal试验田:http://drupal.verydummy.com
--------------------------------------------------

那上面说teaser也包含

那上面说teaser也包含这些,迷糊

嗯。。。我想是因为

嗯。。。我想是因为语境的不同吧

从程序(或者theming) 的角度说,严格的说teaser就是摘要的那一小段正文。但是在一般讨论中,可以也会用到teaser title之类的话,应该是指在teaser view(摘要显示)页面上的node title显示,因为从theming的角度说,teaser view 和 full page node view 的title/submitted/links等可能需要分别对待。。。

唉。。。也不知说清楚没有

--------------------------------------------------
我的Drupal试验田:http://drupal.verydummy.com
--------------------------------------------------

谢谢啊,我现在不是

谢谢啊,我现在不是特别迷糊了,转为模糊了,祝新年快乐!

哈哈,难得糊涂,新

哈哈,难得糊涂,新年快乐!

--------------------------------------------------
我的Drupal试验田:http://drupal.verydummy.com
--------------------------------------------------

大米,有关于PHPTemplate

大米,有关于PHPTemplate的编程资料么?

英文手册有:http://drup

英文手册有:http://drupal.org/phptemplate

中文的暂时还没有,至少我还不知道。我对theming不是很内行,不过有时间可以翻译过来一些。
Drupal的theming功能还是很强大的,很多功能我往往会先想到通过module来解决,有时候看到其实只要在theme中加上一两行php code就行了,感觉还是很佩服的

--------------------------------------------------
我的Drupal试验田:http://drupal.verydummy.com
--------------------------------------------------

嗯,我感觉theme的方法

嗯,我感觉theme的方法比module统一点,易于重用,你觉得那种方法好啊?

我觉得80%的小定制基

我觉得80%的小定制基本都能靠theme解决吧,就像你说的,也利于重用
不过稍微大一点的修改,要用到hook之类的,就只好上module了

--------------------------------------------------
我的Drupal试验田:http://drupal.verydummy.com
--------------------------------------------------

新手学习中!

新手学习中!

其实这个很简单,看代码就知道了

这是我在node.module当中取下来的代码,看过后你就明白了!
/**
* Automatically generate a teaser for a node body in a given format.
*/
function node_teaser($body, $format = NULL) {

$size = variable_get('teaser_length', 600);

// Find where the delimiter is in the body
$delimiter = strpos($body, '');

// If the size is zero, and there is no delimiter, the entire body is the teaser.
if ($size == 0 && $delimiter === FALSE) {
return $body;
}

// If a valid delimiter has been specified, use it to chop off the teaser.
if ($delimiter !== FALSE) {
return substr($body, 0, $delimiter);
}

// We check for the presence of the PHP evaluator filter in the current
// format. If the body contains PHP code, we do not split it up to prevent
// parse errors.
if (isset($format)) {
$filters = filter_list_format($format);
if (isset($filters['filter/1']) && strpos($body, '<?') !== FALSE) {
return $body;
}
}

// If we have a short body, the entire body is the teaser.
if (strlen($body) < $size) {
return $body;
}

// The teaser may not be longer than maximum length specified. Initial slice.
$teaser = truncate_utf8($body, $size);
$position = 0;
// Cache the reverse of the teaser.
$reversed = strrev($teaser);

// In some cases, no delimiter has been specified. In this case, we try to
// split at paragraph boundaries.
$breakpoints = array('' => 0, '' => 6, '' => 4, "\n" => 1);
// We use strpos on the reversed needle and haystack for speed.
foreach ($breakpoints as $point => $offset) {
$length = strpos($reversed, strrev($point));
if ($length !== FALSE) {
$position = - $length - $offset;
return ($position == 0) ? $teaser : substr($teaser, 0, $position);
}
}

// When even the first paragraph is too long, we try to split at the end of
// the last full sentence.
$breakpoints = array('. ' => 1, '! ' => 1, '? ' => 1, '。' => 0, '؟ ' => 1);
$min_length = strlen($reversed);
foreach ($breakpoints as $point => $offset) {
$length = strpos($reversed, strrev($point));
if ($length !== FALSE) {
$min_length = min($length, $min_length);
$position = 0 - $length - $offset;
}
}
return ($position == 0) ? $teaser : substr($teaser, 0, $position);
}

英文wiki给出的解释:

英文wiki给出的解释:

Teaser may refer to:

* "cold open", a segment at the beginning of a television program or film before the opening credits

* Teaser trailer, a short theatrical trailer
* Teaser (gambling), a type of gambling bet that allows the bettor to combine his bets on two different games.

在drupal中主要就是文章的前一小段内容。
--
爱吃瓜子,爱吃阳春面,爱吃韭菜炒鸡蛋。哈哈别说我是zhu

爱好飞行模拟游戏,在建网站 http://www.fsgame.org ,欢迎交流。