Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 从Drupal 7中提交的时间标签中删除“pubdate”属性_Html_Drupal 7_Drupal Nodes_Pubdate - Fatal编程技术网

Html 从Drupal 7中提交的时间标签中删除“pubdate”属性

Html 从Drupal 7中提交的时间标签中删除“pubdate”属性,html,drupal-7,drupal-nodes,pubdate,Html,Drupal 7,Drupal Nodes,Pubdate,当前,当一个节点或评论被提交时,它会收到一条提交的文本,上面写着“用户于2015年1月4日星期三提交”—18:07 这方面的加价是: <span>Submitted by *user* on <time pubdate="pubdate" datetime="2015-04-01T18:07:34+0000">Wed, 04/01/2015 - 18:07</time></span> 我需要做的是从标记中删除pubdate属性,因为它在W3C验证

当前,当一个节点或评论被提交时,它会收到一条提交的文本,上面写着“用户于2015年1月4日星期三提交”—18:07

这方面的加价是:

<span>Submitted by *user* on <time pubdate="pubdate" datetime="2015-04-01T18:07:34+0000">Wed, 04/01/2015 - 18:07</time></span>
我需要做的是从标记中删除pubdate属性,因为它在W3C验证中失败

我试图在template.php文件中添加以下代码,但没有成功

function ThemeName_preprocess_node(&$variables) {
    $attributes['datetime'] = '<time'.drupal_attributes($attributes) .'>'.$variables['date'] . '</time>';
}

如何删除SubmittedBy标记中的pubdate属性

需要挂接到preprocess_节点以访问$submitted变量,如下所示:

function THEME-NAME_preprocess_node(&$variables, $hook) {

$variables['pubdate'] = '<time datetime="' . format_date($variables['node']->created, 'custom', 'c') . '">' . $variables['date'] . '</time>';

$variables['submitted'] = t('Submitted by !username on !datetime', array('!username' =>$variables['name'], '!datetime' => $variables['pubdate']));
}