Actions

Difference between revisions of "How to position the createdate and author fields in same row"

From Joomla! Documentation

(New page: Edit the following file : /components/com_content/content.html.php Replace this code - lines 801 to 839. <source lang="php"> - * * Writes Author name: function Author( &$row, &$params ...)
 
m (Replaced category by template)
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
{{JVer|1.0}}
 +
 +
{{CoreHackNotice}}
 +
 
Edit the following file : /components/com_content/content.html.php
 
Edit the following file : /components/com_content/content.html.php
  
Line 102: Line 106:
 
[[Category:Tips and tricks]]
 
[[Category:Tips and tricks]]
 
[[Category:Tips and tricks 1.0]]
 
[[Category:Tips and tricks 1.0]]
 +
[[Category:Tutorials]]

Latest revision as of 18:08, 29 January 2011

Joomla 1.0

Stop hand nuvola.svg.png
Warning!

This is a core hack. Files you change as described on this page will be overwritten during updates of Joomla!. For more information, see Core hack.

Edit the following file : /components/com_content/content.html.php

Replace this code - lines 801 to 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>
&nbsp;&nbsp;
</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
}
}

with the following code:

/**
* 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>
&nbsp;&nbsp;
</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
}
}

Finally, edit the file templates/yourtemplate/css/template_css.css and modify the .createdate class as you want:

.createdate {
/* see primary style css */
height: 20px;
vertical-align: top;
vertical-align: top;
padding-bottom: 5px;
padding-top: 0px;
}