改变Joomla分类内容表格宽度、位置(change table width,height for joomla)

作者:Wupei  |  发表时间:  |  所属分类:Joomla

Joomla分类内容的表格的宽度和位置是固定写在程序中的,而且还比较难看,我们就来改一把
修改后的效果:效果演示

在 componentscom_contentcontent.html.php 的 240 行左右

if ( $params->get( 'headings' ) ) {
	?>
	<tr>
		<?php
		if ( $params->get( 'date' ) ) {
			?>
			<td class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" width="30%">
				<?php echo _DATE; ?>
			</td>
			<?php
		}
		if ( $params->get( 'title' ) ) {
			?>
			<td class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>">
				<?php echo _HEADER_TITLE; ?>
			</td>
			<?php
		}
		if ( $params->get( 'author' ) ) {
			?>
			<td class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" align="left" width="20%">
				<?php echo _HEADER_AUTHOR; ?>
			</td>
			<?php
		}
		if ( $params->get( 'hits' ) ) {
			?>
			<td align="center" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" width="10%">
				<?php echo _HEADER_HITS; ?>
			</td>
			<?php
		}
		?>
	</tr>
	<?php
}

改变为:

if ( $params->get( 'headings' ) ) {
	?>
	<tr>
		<?php
		if ( $params->get( 'date' ) ) {
			?>
			<td class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" width="15%"align="center">
				<?php echo _DATE; ?>
			</td>
			<?php
		}
		if ( $params->get( 'title' ) ) {
			?>
			<td class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" align="left">
				<?php echo _HEADER_TITLE; ?>
			</td>
			<?php
		}
		if ( $params->get( 'author' ) ) {
			?>
			<td class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" align="center" width="15%">
				<?php echo _HEADER_AUTHOR; ?>
			</td>
			<?php
		}
		if ( $params->get( 'hits' ) ) {
			?>
			<td align="center" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" width="5%">
				<?php echo _HEADER_HITS; ?>
			</td>
			<?php
		}
		?>
	</tr>
	<?php
}

这时标题已经和内容的百分比已经设置好了,就是修改了其中的width和align属性值,如果想设置内容的对齐方式的话,再往下看

$k = 0;
foreach ( $items as $row ) {
	$row->created = mosFormatDate ($row->created, $params->get( 'date_format' ));

	// calculate Itemid
	HTML_content::_Itemid( $row );
	?>
	<tr class="sectiontableentry<?php echo ($k+1) . $params->get( 'pageclass_sfx' ); ?>" >
		<?php
		if ( $params->get( 'date' ) ) {
			?>
			<td>
			<?php echo $row->created; ?>
			</td>
			<?php
		}
		if ( $params->get( 'title' ) ) {
			if( $row->access <= $gid ){
				$link = sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->id .'&Itemid='. $Itemid );
				?>
				<td>
				<a href="<?php echo $link; ?>">
				<?php echo $row->title; ?>
				</a>
				<?php
				HTML_content::EditIcon( $row, $params, $access );
				?>
				</td>
				<?php
			} else {
				?>
				<td>
				<?php
				echo $row->title .' : ';
				$link = sefRelToAbs( 'index.php?option=com_registration&task=register' );
				?>
				<a href="<?php echo $link; ?>">
				<?php echo _READ_MORE_REGISTER; ?>
				</a>
				</td>
				<?php
			}
		}
		if ( $params->get( 'author' ) ) {
			?>
			<td align="left">
			<?php echo $row->created_by_alias ? $row->created_by_alias : $row->author; ?>
			</td>
			<?php
		}
		if ( $params->get( 'hits' ) ) {
		?>
			<td align="center">
			<?php echo $row->hits ? $row->hits : '-'; ?>
			</td>
		<?php
	} ?>
</tr>
<?php
	$k = 1 - $k;
}

把响应的 align=”left” 修改为center,right就可以了

Trackback from your site.

请在这里留言: