修改modules/comment/comment.module中的function theme_comment_block()这个函数,去掉time参数
原来的函数是这样的:
$items[] = l($comment->subject, 'node/'. $comment->nid, NULL, NULL,
'comment-'. $comment->cid) .''. t('@time ago', array('@time' =>
format_interval(time() - $comment->timestamp)));
改过以后:
$items[] = l($comment->subject, 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid) .''. t('');
這是template 的範圍,
這是template 的範圍, 應使用template 修改
/themes/garland/comment.tpl.php:
<div class="comment<?php print ($comment->new) ? ' comment-new' : ''; print ($comment->status == COMMENT_NOT_PUBLISHED) ? ' comment-unpublished' : ''; print ' '. $zebra; ?>">
<div class="clear-block">
<?php if ($submitted): ?>
/*原本: <span class="submitted"><?php print t('!date — !username', array('!username' => theme('username', $comment), '!date' => format_date($comment->timestamp))); ?></span>*/
//改成:
<span class="submitted"><?php print t('!date — !username', array('!username' => theme('username', $comment))); ?></span>
<?php endif; ?>
<?php if ($comment->new) : ?>
<a id="new"></a>
<span class="new"><?php print drupal_ucfirst($new) ?></span>
<?php endif; ?>
<?php print $picture ?>
<h3><?php print $title ?></h3>
<div class="content">
<?php print $content ?>
</div>
</div>
<?php if ($links): ?>
<div class="links"><?php print $links ?></div>
<?php endif; ?>
</div>
--------------------------------
Joetsui's blog
joe我想进一步请教这个问题一下
从您的这个回复中,我可以看出只要将
<?phpprint t('!date — !username', array('!username' => theme('username', $comment), '!date' => format_date($comment->timestamp)));
?>
这一行代码整个去掉,那么comment中就没有了作者和提交时间的选项。
在这个基础上,我有一个新的想法,比如说,对有的comment我需要没有提交时间和作者,有的又希望有。这个区别应该是根据不同的comment type中的以实现的。
请问如何可以实现这一的想法呢?
另外,之所以会有这样的想法,主要是在我构思的网站中(一个简单的公司网站),有的呈现简单信息和介绍的,是不需要有作者和时间的。有些,比如说是网站的首页,也不需要呈现时间和作者,象这个网站的首页http://www.bmc.com/,如果我想作出一个这样版式的首页,应该怎样构造呢?貌似现有的一些themes都是在首页自动把新内容呈现出来的,不是这种固定版式的商务类型。
您有什么好的方法可以介绍给我么?
概念不對 上面的代碼
概念不對
上面的代碼只是不將時間顯示出來, 而不是"去掉提交時間的選項"
你可以令首頁的內容用另一個內容類型, 而那個內容類型不將時間顯示
--------------------------------
Joetsui's blog
多谢了,我去试试看~~
谢谢
问题来了,Joe
还要接着问你了,首页的内容类型,如何设定将时间和作者不显示出来呢?
麻烦您再说一下啊
在主题设置里面有,
在主题设置里面有,很多功能很简单,只要你认真的查看了所有的设置和帮助。
-------
http://fhileo.cn
http://www.networkdictionary.com
http://www.networkdictionary.cn
好的 学习了!
好的 学习了!