Advertisement
pusatdata

Joomla - No Numbers in Category List

Jun 29th, 2014
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. Override:No Numbers in Category List
  2. ====================================
  3.  
  4. You can add an option to turn on and off numbers in the category list by using this core hack. (The alternate method shown in the next section avoids the core hack with an override.)
  5.  
  6. Edit the XML File
  7. Open the following file with your favourite text editor
  8.  
  9. components/com_content/views/category/tmpl/default.xml
  10.  
  11. and add the following code into the parameters section of the XML file:
  12.  
  13. <param name="show_numbers" type="radio" default="1" label="Show Numbers" description="Show/Hide the article numbers">
  14. <option value="0">Hide</option>
  15. <option value="1">Show</option>
  16. </param>
  17. NB: If you don't want the default to be show the numbers, change default="1" to default="0" in the param line.
  18.  
  19. Edit the PHP File
  20. Open the following file with your favourite text editor:
  21.  
  22. components/com_content/views/category/tmpl/default_items.php
  23.  
  24. Change line 42 from
  25.  
  26. <td class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" align="right" width="5%">
  27. <?php echo JText::_('Num'); ?>
  28. </td>
  29. to
  30.  
  31. <?php if ($this->params->get('show_numbers')) : ?>
  32. <td class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" align="right" width="5%">
  33. <?php echo JText::_('Num'); ?>
  34. </td>
  35. <?php endif; ?>
  36. Then scroll down to line 71 (it was line 69, adding above text moves it down 2 lines) and change from
  37.  
  38. <td align="right">
  39. <?php echo $this->pagination->getRowOffset( $item->count ); ?>
  40. </td>
  41. to
  42.  
  43. <?php if ($this->params->get('show_numbers')) : ?>
  44. <td align="right">
  45. <?php echo $this->pagination->getRowOffset( $item->count ); ?>
  46. </td>
  47. <?php endif; ?>
  48. Once saved, this will give you a new option called Show Numbers which will allow you to either show or hide the numbers as you please.
  49.  
  50. If you still want empty columns where the numbers are supposed to be, move the PHP if statements within the <td> tags as follows:
  51.  
  52. Line 42:
  53.  
  54. <td class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" align="right" width="5%">
  55. <?php if ($this->params->get('show_numbers')) echo JText::_('Num'); ?>
  56. </td>
  57. Line 69:
  58.  
  59. <td align="right">
  60. <?php if ($this->params->get('show_numbers')) echo $this->pagination->getRowOffset( $item->count ); ?>
  61. </td>
  62. Removing Category List Numbers with an Override
  63.  
  64. The above option may give you better choices for future development but you can avoid the core hack by using this method.
  65.  
  66. Copy the File
  67. Copy the default_items.php file:
  68.  
  69. /components/com_content/views/category/tmpl/default_items.php
  70.  
  71. to the the html folder of your template:
  72.  
  73. /templates/<yourTemplate>/html/com_content/category/default_items.php
  74.  
  75. Edit the Copied File
  76. Delete or comment out line 43:
  77.  
  78. <?php echo JText::_('Num'); ?>
  79. If you still want an empty column where the numbers were, delete or comment out line 70:
  80.  
  81. <?php echo $this->pagination->getRowOffset( $item->count ); ?>
  82. To eliminate the entire number column, delete or comment out lines 69 through 71:
  83.  
  84. <td align="right">
  85. <?php echo $this->pagination->getRowOffset( $item->count ); ?>
  86. </td>
  87.  
  88.  
  89.  
  90. http://docs.joomla.org/Override:No_Numbers_in_Category_List
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement