The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun May 27, 2012 12:33 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Mar 12, 2008 8:38 pm
Posts: 32
Hello, I need to display the title after the category. I have been reading about it and it seems that I have to change the default_item.php in com_content in the html folder of my template, but when I change this position nothing happens (and if I change the same file but in com_content folder from the core, the result is the same).

I think that I am doing something wrong, because I understand php, but only a little (as english too! hahahha, I must sound like a monkey, please forgive my english).

Somebody can tellme what I must to change?? I want something very simple, the articles must display something like that:

category
TITLE
Introtext
Readmore.

in the frontpage. In the k2 site they have the category before the title and there is a lot of sites with it, but I can`t do it. Please help me to do this.

Thank you very much.

ah! I am using a custom template (I made it)


Top
 Profile  
 
PostPosted: Sun May 27, 2012 4:39 am 
Joomla! Intern
Joomla! Intern

Joined: Fri Feb 24, 2012 11:24 pm
Posts: 87
Location: MN, USA
I believe you want to edit /components/com_content/views/article/tmpl/default.php

Take this segment of code (approx line 35 - 44)
Code:
<?php if ($params->get('show_title')) : ?>
   <h2>
   <?php if ($params->get('link_titles') && !empty($this->item->readmore_link)) : ?>
      <a href="<?php echo $this->item->readmore_link; ?>">
      <?php echo $this->escape($this->item->title); ?></a>
   <?php else : ?>
      <?php echo $this->escape($this->item->title); ?>
   <?php endif; ?>
   </h2>
<?php endif; ?>


and move it down to about line 112 (101 if you cut the previous code already) right under the end of the Show Category if statement. Final will look like

Code:
<?php if ($params->get('show_category')) : ?>
   <dd class="category-name">
   <?php    $title = $this->escape($this->item->category_title);
   $url = '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catslug)).'">'.$title.'</a>';?>
   <?php if ($params->get('link_category') and $this->item->catslug) : ?>
      <?php echo JText::sprintf('COM_CONTENT_CATEGORY', $url); ?>
   <?php else : ?>
      <?php echo JText::sprintf('COM_CONTENT_CATEGORY', $title); ?>
   <?php endif; ?>
   </dd>
<?php endif; ?>
<?php if ($params->get('show_title')) : ?>
   <?php if ($params->get('link_titles') && !empty($this->item->readmore_link)) : ?>
      <a href="<?php echo $this->item->readmore_link; ?>">
      <?php echo $this->escape($this->item->title); ?></a>
   <?php else : ?>
      <?php echo $this->escape($this->item->title); ?>
   <?php endif; ?>
<?php endif; ?>



Of course do module overwriting instead of editing the core file if you like.

_________________
Douglas A. Crosby
Owner of daCrosby, LLC
http://www.daCrosby.com


Top
 Profile  
 
PostPosted: Mon May 28, 2012 3:34 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Mar 12, 2008 8:38 pm
Posts: 32
Hello brn2drv99, thank you very much, I can`t find that code, here is my /components/com_content/views/article/tmpl/default.php

could you show me where I have to paste the code??

Code:

<?php // no direct access
defined('_JEXEC') or die('Restricted access');

$canEdit   = ($this->user->authorize('com_content', 'edit', 'content', 'all') || $this->user->authorize('com_content', 'edit', 'content', 'own'));
?>
<?php if ($this->params->get('show_page_title', 1) && $this->params->get('page_title') != $this->article->title) : ?>
   <div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
      <?php echo $this->escape($this->params->get('page_title')); ?>
   </div>
<?php endif; ?>
<?php if ($canEdit || $this->params->get('show_title') || $this->params->get('show_pdf_icon') || $this->params->get('show_print_icon') || $this->params->get('show_email_icon')) : ?>
<table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">

   <?php endif; ?>
   <?php if (!$this->print) : ?>
      <?php if ($this->params->get('show_pdf_icon')) : ?>
      <td align="right" width="100%" class="buttonheading">
      <?php echo JHTML::_('icon.pdf',  $this->article, $this->params, $this->access); ?>
      </td>
      <?php endif; ?>

      <?php if ( $this->params->get( 'show_print_icon' )) : ?>
      <td align="right" width="100%" class="buttonheading">
      <?php echo JHTML::_('icon.print_popup',  $this->article, $this->params, $this->access); ?>
      </td>
      <?php endif; ?>

      <?php if ($this->params->get('show_email_icon')) : ?>
      <td align="right" width="100%" class="buttonheading">
      <?php echo JHTML::_('icon.email',  $this->article, $this->params, $this->access); ?>
      </td>
      <?php endif; ?>
      <?php if ($canEdit) : ?>
      <td align="right" width="100%" class="buttonheading">
         <?php echo JHTML::_('icon.edit', $this->article, $this->params, $this->access); ?>
      </td>
      <?php endif; ?>
   <?php else : ?>
      <td align="right" width="100%" class="buttonheading">
      <?php echo JHTML::_('icon.print_screen',  $this->article, $this->params, $this->access); ?>
      </td>
   <?php endif; ?>
</tr>
</table>
<?php endif; ?>

<?php  if (!$this->params->get('show_intro')) :
   echo $this->article->event->afterDisplayTitle;
endif; ?>
<?php echo $this->article->event->beforeDisplayContent; ?>
<table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php if (($this->params->get('show_section') && $this->article->sectionid) || ($this->params->get('show_category') && $this->article->catid)) : ?>
<tr>
   <td>
      <?php if ($this->params->get('show_section') && $this->article->sectionid && isset($this->article->section)) : ?>
      <span>
         <?php if ($this->params->get('link_section')) : ?>
            <?php echo '<a href="'.JRoute::_(ContentHelperRoute::getSectionRoute($this->article->sectionid)).'">'; ?>
         <?php endif; ?>
         <?php echo $this->escape($this->article->section); ?>
         <?php if ($this->params->get('link_section')) : ?>
            <?php echo '</a>'; ?>
         <?php endif; ?>
            <?php if ($this->params->get('show_category')) : ?>
            <?php echo ' - '; ?>
         <?php endif; ?>
      </span>
      <?php endif; ?>
      <?php if ($this->params->get('show_category') && $this->article->catid) : ?>
      <span>
         <?php if ($this->params->get('link_category')) : ?>
            <?php echo '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->article->catslug, $this->article->sectionid)).'">'; ?>
         <?php endif; ?>
         <?php echo $this->escape($this->article->category); ?>
         <?php if ($this->params->get('link_category')) : ?>
            <?php echo '</a>'; ?>
         <?php endif; ?>
      </span>
      <?php endif; ?>
   </td>
</tr>
<?php endif; ?>
<?php if (($this->params->get('show_author')) && ($this->article->author != "")) : ?>
<tr>
   <td valign="top">
      <span class="small">
         <?php JText::printf( 'Written by', ($this->escape($this->article->created_by_alias) ? $this->escape($this->article->created_by_alias) : $this->escape($this->article->author)) ); ?>
      </span>
      &nbsp;&nbsp;
   </td>
</tr>
<?php endif; ?>

<?php if ($this->params->get('show_create_date')) : ?>
<tr>
   <td valign="top" class="createdate">
      <?php echo JHTML::_('date', $this->article->created, JText::_('DATE_FORMAT_LC2')) ?>
   </td>
</tr>
<?php endif; ?>

<?php if ($this->params->get('show_url') && $this->article->urls) : ?>
<tr>
   <td valign="top">
      <a href="http://<?php echo $this->article->urls ; ?>" target="_blank">
         <?php echo $this->escape($this->article->urls); ?></a>
   </td>
</tr>
<?php endif; ?>

<tr>
<td valign="top">
<?php if (isset ($this->article->toc)) : ?>
   <?php echo $this->article->toc; ?>
<?php endif; ?>
<?php echo $this->article->text; ?>
</td>
</tr>

<?php if ( intval($this->article->modified) !=0 && $this->params->get('show_modify_date')) : ?>
<tr>
   <td class="modifydate">
      <?php echo JText::sprintf('LAST_UPDATED2', JHTML::_('date', $this->article->modified, JText::_('DATE_FORMAT_LC2'))); ?>
   </td>
</tr>
<?php endif; ?>
</table>
<span class="article_separator">&nbsp;</span>
<?php echo $this->article->event->afterDisplayContent; ?>



thank you very much!


Top
 Profile  
 
PostPosted: Wed May 30, 2012 5:07 am 
Joomla! Intern
Joomla! Intern

Joined: Fri Feb 24, 2012 11:24 pm
Posts: 87
Location: MN, USA
My mistake, I was looking at a Joomla 2.5 file not 1.5.

Cut this section from about line 6-10
Code:
<?php if ($this->params->get('show_page_title', 1) && $this->params->get('page_title') != $this->article->title) : ?>
   <div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
      <?php echo $this->escape($this->params->get('page_title')); ?>
   </div>
<?php endif; ?>


And paste this at what is now line 76 (between <?php endif; ?> and <?php if (($this->params->get('show_author')) && ($this->article->author != "")) : ?> )

Code:
<?php if ($this->params->get('show_page_title', 1) && $this->params->get('page_title') != $this->article->title) : ?>
<tr>
   <td>
   <div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
      <?php echo $this->escape($this->params->get('page_title')); ?>
   </div>
   </td>
</tr>
<?php endif; ?>

Note the added <tr> <td> and closing tags.

_________________
Douglas A. Crosby
Owner of daCrosby, LLC
http://www.daCrosby.com


Top
 Profile  
 
PostPosted: Wed May 30, 2012 7:17 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Mar 12, 2008 8:38 pm
Posts: 32
thank you very much!!! it works perfect!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 



Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group