[英]Drupal - where is text “Submitted by” coming from?
我的頭版新聞由Views
插件顯示。 我發現視圖項目(新聞)的模板在哪里。 我用node--news.tpl.php
覆蓋了它,在這里我可以更改新聞項目的html。 但是還有:
<?php if ($display_submitted): ?>
<span class="submitted"><?php print $submitted; ?></span>
<?php endif; ?>
返回的一段代碼: Submitted by Incredible on Tue, 03/10/2015 - 19:40
在內容設置中只是:
作者 : 不可思議
發表於 : 2015-03-10 19:40:15 +0100
字符串來自哪里提交,我該如何編輯?
$ submitted變量是在默認的節點預處理功能template_preprocess_node()中設置的 :
$variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date']));
您可以通過在主題的template.php文件中實現hook_preprocess_HOOK()來覆蓋默認值,如下所示:
function MYTHEME_preprocess_node(&$variables) {
$variables['submitted'] = // Your username logic here.
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.