Joomla文档中文翻译 - 如何将文章创建日期与作者放在同一行
如需转载,请注明官方英文文档及本人译文的出处,谢谢。查看官方英文文档: How to position the creatdate and author fields in same row
我们需要编辑如下文件(或使用自定义模板覆盖的方式复制粘帖该文件至自定义模板中,然后编辑;关于模板覆盖,可以参见“Joomla文档中文翻译 - 如何通过模板覆盖的方式修改Joomla的系统输出”):
joomla根路径/components/com_content/content.html.php
将其中的801行至839行代码:
/**
* Writes Author name
*/
function Author( &$row, &$params ) {
if ( ( $params->get( 'author' ) ) && ( $row->author != '' ) ) {
?>
<tr>
<td width="70%" align="left" valign="top" colspan="2">
<span class="small">
<?php echo _WRITTEN_BY . ' '.( $row->created_by_alias ? $row->created_by_alias : $row->author ); ?>
</span>
</td>
</tr>
<?php
}
}
/**
* Writes Create Date
*/
function CreateDate( &$row, &$params ) {
$create_date = null;
if ( intval( $row->created ) != 0 ) {
$create_date = mosFormatDate( $row->created );
}
if ( $params->get( 'createdate' ) ) {
?>
<tr>
<td valign="top" colspan="2" class="createdate">
<?php echo $create_date; ?>
</td>
</tr>
<?php
}
}
替换为:
/**
* Writes Author name
*/
function Author( &$row, &$params ) {
if ( ( $params->get( 'author' ) ) && ( $row->author != '' ) ) {
?>
<tr>
<td width="35%" align="left" valign="top" class="authoralias">
<span class="small">
<?php echo _WRITTEN_BY . ' '.( $row->created_by_alias ? $row->created_by_alias : $row->author ); ?>
</span>
</td>
<?php
}
}
/**
* Writes Create Date
*/
function CreateDate( &$row, &$params ) {
$create_date = null;
if ( intval( $row->created ) != 0 ) {
$create_date = mosFormatDate( $row->created );
}
if ( $params->get( 'createdate' ) ) {
?>
<td width="35%" align="right" valign="top" class="createdate">
<?php echo $create_date; ?>
</td>
</tr>
<?php
}
}
最后,可以按照你想要的方式调整修改模板样式表(CSS)中的.createdate,例如:
.createdate {
/* see primary style css */
height: 20px;
vertical-align: top;
vertical-align: top;
padding-bottom: 5px;
padding-top: 0px;
}
搞定。
译者:viiiix.com
| < Prev | Next > |
|---|

评论刷新