Radial Software

Home Tips Joomla Removing Headers from Category Lists

Removing Headers from Category Lists

Joomla! is a fantastic tool that provides a standardised look and feel to your website, which you can change through the use of templates and/or menu options.

However, I have a minor irritation with the way 'Category Lists' are displayed in version 1.5. Under certain circumstances the 'Filter', 'Display #' and 'Article Title' fields would always appear, regardless of any settings specified in the Menu Options.

Let me give you an example:

  • I define a top-level 'Menu Item' with a 'Section Layout' type.
  • I then defined another 'Menu Item', this time with a 'Category Layout' type.
  • I subsequently set Title, Filter and Pagination to 'Hide' in the Menu Item options.

The top-level menu shows the Categories available, as a list, in the main view and also presents a new side-menu with the same Categories to aid future navigation. So far so good - the Categories can be clicked directly in the main view or via the side-menu - they should both send you to the same place.

However, now the problems start to appear - if I  use the side-menu things aren't too bad. The fields I asked to be hidden (Title, Filter, Pagination) do not appear (although there is still an index-number listed to the left of each element which I don't like).

Things get much worse though if I avoid the side-menu and click on the Category title directly instead - this should have the same effect as clicking on the side-menu, but it actually renders quite differently. Instead I see all the fields I'm trying to hide (Title, Filter, Pagination)!

I referred to Google, but couldn't find any immediate answers, so I started looking at the Joomla! code. What I wanted was to never show any headings on a Category List view anywhere on my site - as it turns out this can be achieved quite easily with a couple of well placed comments in the core code...

I realise that changing the core Joomla! code is not recommended, but I could see no other way of solving the problem - here's how.

First you need to gain access to the Joomla files on your website - I have the ability to login directly using SSH, but you should be able to achieve the same result via FTP if necessary (using get, edit, then put).

The file you need to change is in the following directory:

    ./components/com_content/views/category/tmpl/default_items.php

You then need to make the following changes:

  *** default_items.php.original
  --- default_items.php
  ***************
  *** 13,18 ****
  --- 13,19 ----
    </script>
    <form action="<?php echo $this->action; ...
    <table width="100%" border="0" ...
  + <!--
    <?phpif ($this->params->get('filter') ...
    <tr>
          <td colspan="5">
  ***************
  *** 64,74 ****
  --- 65,78 ----
          <?php endif; ?>
    </tr>
    <?php endif; ?>
  + -->
    <?php foreach ($this->items as $item) : ?>
    <tr class="sectiontableentry<?php echo ...
  + <!--
          <td align="right">
                  <?php echo $this->pagination ...
          </td>
  + -->
          <?php if ($this->params->get('show_title')) ...
          <?php if ($item->access ...
          <td>

Don't worry if the above doesn't make sense - all it's saying is that you need to add (this 'plus' signs) two sets of HTML comments (the '<!--' and '-->' bits). The first comment starts at line 16 and finishes at line 68, while the second comment starts at line 71 and finishes at line 75.

All this change does is comment out the PHP code and XHTML tags that generate the Title, Pagination and Filters fields, as well as removing that annoying index number that was appearing to the left of every item.

If anyone knows a cleaner way to do this using the Joomla! CMS then please let me know.



 
Comments (9)
9 Thursday, 19 March 2009 12:22
Al Parcs
thanks a lot!!!!!!!!!! you solved a trouble that made me despair for hours!!!!! THANKS AGAIN!!!!
8 Tuesday, 10 March 2009 13:24
Mannaz
Thanks so much for this. Its removed one of the parts of the design I hated the most
7 Thursday, 26 February 2009 11:12
Eddie
Thank for the quick reply Duncan.

You're right... what a noob I am.

Just fixed it and worked fine. I'll try now the override option.
6 Wednesday, 25 February 2009 17:07
Duncan
Hello Eddie,

I suspect you've cut/pasted the code above, complete with '+' characters. However, these plus signs are for illustration only and are not part of the code! They simply show where new content has been added by placing a '+' sign in front of them...

Remove the '+' signs from 'default_items.php' and you should be OK.

Having said that, you may wish to consider using 'overrides' (as suggested above by Kristo Tuisk), but this may depend on the version of Joomla you're using.
5 Wednesday, 25 February 2009 15:18
Eddie
Found this post very interesting.

I just followed what you've suggested and and changed the code. Pagination, filter field and index numbers are gone, but now I've some "+++++" signals between the category description and the articles. Where is my mistake?

thanks
4 Monday, 16 February 2009 21:17
Christian Kurmann
Hi I've just been looking at this too. While I realize this will work (and I haven't found any other way), the default_item.php in question contains param calls which should do the trick. This is regardless of using the override or not. Basically If you want to change things like which columns are displayed, the php needs to be edited (best done in a override) otherwise you should define params according to the names defined in the default_items.php file.

"params->get('filter') || $this->params->get('show_pagination_limit')) : ?>"

Now my Problem ;-). Even though I can see the params 'filter' and 'show_title' etc. and have even created param options in the templateDetails.xml thus getting them into the params.ini file in my template root, nothing happens. I still get the bl**dy filter and header.
3 Friday, 12 September 2008 11:52
Kristo Tuisk
btw. if you want to make it more "cleaner" then you could use overrides. This particular problem can be solved like so: 1. go to templates/YOUR TEMPLATE/ folder and make new folder called html 2. under html make new folder com_content 3. under com_content make new folder category 4. copy original default_items.php from /components/com_content/views/category/tmpl/ to your newly created folder: templates/YOUR TEMPLATE/html/com_content/category/ 5. edit the file and vóila, all done. This works atleast in joomla 1.5.6
2 Friday, 12 September 2008 11:47
Kristo Tuisk
Excellent. I was wondering about this myself aswell. This helped me out !
1 Wednesday, 23 July 2008 17:55
Andres
Just a note to let you know that you can create a new template with this change.. I believe that you are suppose to override the tmpl

Add your comment

Your name:
Comment:

Opinions

Favorite Programming Language
 

Search


Online

We have 4 guests online

Services

We have significant experience in developing software products for business users in many different sectors - if your business needs an automated solution

Read more...

News

The UK Government has announced that it intends to increasingly adopt 'open-source' software, in preference to traditional 'propriety' software.

Read more...