section description not showing, bug in com_content


Author Message
mcbyte

Posted: 3/27/2009
Quote message 

I found a bug with the generated template for Joomla:

when I link a menu item to a "section as a blog", and that section contains a description text but no image, the description text is not shown.

Checking in the code, i found that in the com_content/section/blog.php there is a check if show_description is enabled or show_description_image is enabled (line 12), then if both are not empty, in my case text is not empty but image is empty so the whole section is not shown.
 
jennifer

Posted: 3/27/2009
Quote message 

I dont have the original artisteer generated com_content over-rides as I deleted them a long time ago and replaced with my own.

Can you post all of taht part of the code?

It should look something like
<div class="blog<?php echo $this->params->get('pageclass_sfx'); ?>">


<?php if ($this->params->def('show_description', 1) || $this->params->def('show_description_image', 1)) : ?>
<div class="contentdescription<?php echo $this->params->get('pageclass_sfx'); ?>">

<?php if ($this->params->get('show_description_image') && $this->section->image) : ?>
<img src="<?php echo $this->baseurl . $cparams->get('image_path').'/'.$this->section->image; ?>" class="image_<?php echo $this->section->image_position; ?>" />
<?php endif; ?>

<?php if ($this->params->get('show_description') && $this->section->description) :
echo $this->section->description;
endif; ?>

<?php if ($this->params->get('show_description_image') && $this->section->image) : ?>
<div class="wrap_image">&nbsp;</div>
<?php endif; ?>

</div>

 
Pit

Posted: 4/18/2009
Quote message 

Hello I hace the same problem. The blog.php inside html\com_content\section looks like this


<?php defined('_JEXEC') or die('Restricted access'); $cparams =& JComponentHelper::getParams('com_media'); ?> <?php if ($this->params->get('show_page_title')) : ?> <div class="Post">     <div class="Post-body"> <div class="Post-inner">  <h2 class="PostHeaderIcon-wrapper"> <span class="PostHeader"> 	<?php echo $this->escape($this->params->get('page_title')); ?> </span> </h2>   </div>      </div> </div>  <?php endif; ?> <?php if (($this->params->def('show_description', 1) || $this->params->def('show_description_image', 1))   && strlen($this->section->description) > 0 && strlen($this->section->image) > 0) :?> <div class="Post">     <div class="Post-body"> <div class="Post-inner">  <div class="PostContent">  	<?php if ($this->params->get('show_description_image') && $this->section->image) : ?> 		<img src="<?php echo $this->baseurl . '/' . $cparams->get('image_path') . '/'. $this->section->image;?>" align="<?php echo $this->section->image_position;?>" hspace="6" alt="" /> 	<?php endif; ?> 	<?php if ($this->params->get('show_description') && $this->section->description) : ?> 		<?php echo $this->section->description; ?> 	<?php endif; ?>  </div> <div class="cleared"></div>   </div>      </div> </div>  <?php endif; ?> <?php if ($this->params->def('num_leading_articles', 1)) : ?> <table class="blog<?php echo $this->params->get('pageclass_sfx'); ?>" cellpadding="0" cellspacing="0"> <tr> 	<td valign="top"> 	<?php for ($i = $this->pagination->limitstart; $i < ($this->pagination->limitstart + $this->params->get('num_leading_articles')); $i++) : ?> 		<?php if ($i >= $this->total) : break; endif; ?> 		<div> 		<?php 			$this->item =& $this->getItem($i, $this->params); 			echo $this->loadTemplate('item'); 		?> 		</div> 	<?php endfor; ?> 	</td> </tr> </table> <?php else : $i = $this->pagination->limitstart; endif; ?>  <?php $startIntroArticles = $this->pagination->limitstart + $this->params->get('num_leading_articles'); $numIntroArticles = $startIntroArticles + $this->params->get('num_intro_articles', 4); if (($numIntroArticles != $startIntroArticles) && ($i < $this->total)) : ?> 		<table width="100%"  cellpadding="0" cellspacing="0"> 		<tr> 		<?php 			$divider = ''; 			if ($this->params->get('multi_column_order')) : // order across, like front page 			for ($z = 0; $z < $this->params->def('num_columns', 2); $z ++) : 				if ($z > 0) : $divider = " column_separator"; endif; ?> 				<?php 				$rows = (int) ($this->params->get('num_intro_articles', 4) / $this->params->get('num_columns')); 				$cols = ($this->params->get('num_intro_articles', 4) % $this->params->get('num_columns')); 				?> 					<td valign="top" 						width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%" 						class="article_column<?php echo $divider ?>"> 						<?php 						$loop = (($z < $cols)?1:0) + $rows;  						for ($y = 0; $y < $loop; $y ++) : 							$target = $i + ($y * $this->params->get('num_columns')) + $z; 							if ($target < $this->total && $target < ($numIntroArticles)) : 								$this->item =& $this->getItem($target, $this->params); 								echo $this->loadTemplate('item'); 							endif; 						endfor; 						?></td> 						<?php endfor;  						$i = $i + $this->params->get('num_intro_articles', 4) ;  			else : // otherwise, order down, same as before (default behaviour) 				for ($z = 0; $z < $this->params->get('num_columns'); $z ++) : 				if ($z > 0) : $divider = " column_separator"; endif; ?> 				<td valign="top" width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%" class="article_column<?php echo $divider ?>"> 				<?php for ($y = 0; $y < ($this->params->get('num_intro_articles', 4) / $this->params->get('num_columns')); $y ++) : 					if ($i < $this->total && $i < ($numIntroArticles)) : 						$this->item =& $this->getItem($i, $this->params); 						echo $this->loadTemplate('item'); 						$i ++; 					endif; 				endfor; ?> 				</td> 		<?php endfor;  		endif; ?>  		</tr> 		</table> <?php endif; ?> <?php if ($this->params->def('num_links', 4) && ($i < $this->total)) : ?> <div class="Post">     <div class="Post-body"> <div class="Post-inner">  <div class="PostContent">  			<?php 				$this->links = array_splice($this->items, $i - $this->pagination->limitstart); 				echo $this->loadTemplate('links'); 			?>  </div> <div class="cleared"></div>   </div>      </div> </div>  <?php endif; ?>  <?php if ($this->params->def('show_pagination', 2)) : ?> <div class="Post">     <div class="Post-body"> <div class="Post-inner">  <div class="PostContent">  		<?php echo $this->pagination->getPagesLinks(); ?>  </div> <div class="cleared"></div>   </div>      </div> </div>  <?php endif; ?> <?php if ($this->params->def('show_pagination_results', 1)) : ?> <div class="Post">     <div class="Post-body"> <div class="Post-inner">  <div class="PostContent">  		<?php echo $this->pagination->getPagesCounter(); ?>  </div> <div class="cleared"></div>   </div>      </div> </div>  <?php endif; ?>


The code inside blog_item.php inside html\com_content\section looks like this

<?php // no direct access defined('_JEXEC') or die('Restricted access'); ?> <?php $canEdit = ($this->user->authorize('com_content', 'edit', 'content', 'all') || $this->user->authorize('com_content', 'edit', 'content', 'own')); ?> <?php if ($this->item->state == 0) : ?> <div class="system-unpublished"> <?php endif; ?>  <?php $metadata = array(); ?> <div class="Post">     <div class="Post-body"> <div class="Post-inner"> <div class="PostMetadataHeader"> <?php if ($this->item->params->get('show_title')) : ?> <h2 class="PostHeaderIcon-wrapper"> <?php if ($this->item->params->get('link_titles') && $this->item->readmore_link != '') : ?> 		<a href="<?php echo $this->item->readmore_link; ?>" class="PostHeader"> 			<?php echo $this->escape($this->item->title); ?></a> 		<?php else : ?> 			<?php echo $this->escape($this->item->title); ?> 		<?php endif; ?> </h2> <?php endif; ?>  </div> <div class="PostHeaderIcons metadata-icons"> <?php if ($this->item->params->get('show_create_date')) : ?> <?php ob_start(); ?><?php echo JHTML::_('image.site', 'PostDateIcon.png', null, null, null, JText::_("PostDateIcon"), array('width' => '18', 'height' => '18')); ?> <?php echo JHTML::_('date', $this->item->created, JText::_('DATE_FORMAT_LC2')); ?> <?php $metadata[] = ob_get_clean(); ?> <?php endif; ?> <?php if (($this->item->params->get('show_author')) && ($this->item->author != "")) : ?> <?php ob_start(); ?><?php echo JHTML::_('image.site', 'PostAuthorIcon.png', null, null, null, JText::_("PostAuthorIcon"), array('width' => '18', 'height' => '18')); ?> <?php JText::printf('Author: %s', ($this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author) ); ?> <?php $metadata[] = ob_get_clean(); ?> <?php endif; ?>  <?php if ($this->item->params->get('show_url') && $this->item->urls)  $metadata[] = '<a href="http://' . $this->item->urls . '" target="_blank">' . $this->item->urls . '</a>'; $joomlaIcons = array(); if ($this->item->params->get('show_pdf_icon'))  $joomlaIcons[] = JHTML::_('icon.pdf', $this->item, $this->item->params, $this->access); if ( $this->item->params->get( 'show_print_icon' ))  $joomlaIcons[] = JHTML::_('icon.print_popup', $this->item, $this->item->params, $this->access); if ($this->item->params->get('show_email_icon'))  $joomlaIcons[] = JHTML::_('icon.email', $this->item, $this->item->params, $this->access); if (0 != count($joomlaIcons))  $metadata[] = '<span class="metadata-icons">' . implode('&nbsp;', $joomlaIcons) . '</span>'; if ($canEdit)   $metadata[] = JHTML::_('icon.edit', $this->item, $this->item->params, $this->access); echo implode(' | ', $metadata); ?>  </div> <div class="PostContent"> <?php  if (!$this->item->params->get('show_intro')) : 	echo $this->item->event->afterDisplayTitle; endif; ?> <?php echo $this->item->event->beforeDisplayContent; ?> <?php if (($this->item->params->get('show_section') && $this->item->sectionid) || ($this->item->params->get('show_category') && $this->item->catid)) : ?> <table class="contentpaneopen<?php echo $this->item->params->get( 'pageclass_sfx' ); ?>"> <tr> 	<td> 		<?php if ($this->item->params->get('show_section') && $this->item->sectionid && isset($this->item->section)) : ?> 		<span> 			<?php if ($this->item->params->get('link_section')) : ?> 				<?php echo '<a href="'.JRoute::_(ContentHelperRoute::getSectionRoute($this->item->sectionid)).'">'; ?> 			<?php endif; ?> 			<?php echo $this->item->section; ?> 			<?php if ($this->item->params->get('link_section')) : ?> 				<?php echo '</a>'; ?> 			<?php endif; ?> 				<?php if ($this->item->params->get('show_category')) : ?> 				<?php echo ' - '; ?> 			<?php endif; ?> 		</span> 		<?php endif; ?> 		<?php if ($this->item->params->get('show_category') && $this->item->catid) : ?> 		<span> 			<?php if ($this->item->params->get('link_category')) : ?> 				<?php echo '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catslug, $this->item->sectionid)).'">'; ?> 			<?php endif; ?> 			<?php echo $this->item->category; ?> 			<?php if ($this->item->params->get('link_category')) : ?> 				<?php echo '</a>'; ?> 			<?php endif; ?> 		</span> 		<?php endif; ?> 	</td> </tr> </table> <?php endif; ?> <?php if (isset ($this->item->toc)) : ?> 	<?php echo $this->item->toc; ?> <?php endif; ?> <div class="article"> <?php echo $this->item->text; ?> </div> <?php if ( intval($this->item->modified) != 0 && $this->item->params->get('show_modify_date')) : ?> <p class="modifydate"> <?php echo JText::_( 'Last Updated' ); ?> ( <?php echo JHTML::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC2')); ?> ) </p> <?php endif; ?> <?php if ($this->item->params->get('show_readmore') && $this->item->readmore) : ?> <p>  <a class="Button" href="<?php echo $this->item->readmore_link; ?>">   <span class="btn">    <span class="t"><?php if ($this->item->readmore_register) : 				echo str_replace(' ', '&nbsp;', JText::_('Register to read more...')); 			elseif ($readmore = $this->item->params->get('readmore')) : 				echo str_replace(' ', '&nbsp;', $readmore); 			else : 				echo str_replace(' ', '&nbsp;', JText::sprintf('Read more...')); 			endif; ?></span>    <span class="r"><span></span></span>    <span class="l"></span>   </span>  </a> </p> <?php endif; ?>  </div> <div class="cleared"></div>  </div>      </div> </div>   <?php if ($this->item->state == 0) : ?> </div> <?php endif; ?> <span class="article_separator">&nbsp;</span> <?php echo $this->item->event->afterDisplayContent; ?>


What I have to change? Thanks in advance