Turn on/off view Items in Category View

5 years 5 months ago #30298 by iamrobert
Sometimes - clients just want to show the category description - and not show the items at all. My way of doing this is.

1. Open up your template folder
2. In category.xml add:
<field name="show_items" type="list" default="1" label="Show Items" description="Display Items on Category Page">
<option value="0">FLEXI_NO</option>
<option value="1">FLEXI_YES</option>
</field>

3. In category.php, change:
<!-- Start item list display --> 
   <?php echo $this->loadTemplate('items'); ?> 
  <!-- Start item list display -->

To:
  <!-- Start item list display --> 
 <?php if ($this->params->get('show_items', 1)) : ?>
  <?php echo $this->loadTemplate('items'); ?> 
  <?php	endif; ?>
  <!-- Start item list display -->

Please Log in or Create an account to join the conversation.

5 years 5 months ago #30299 by ggppdk
In RC7+ you can use the Joomla way , use 0 items per page in category parameters

or

create an new Joomla menu item , pointing to a category and enable override of category parameters and set 0 items per page


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

5 years 4 months ago #31902 by igcorreia
I usually create an item and point to it. What is the difference since the result is the same?

Please Log in or Create an account to join the conversation.

5 years 4 months ago #31909 by ggppdk
Joomla behavior for zero "limit" is to show only category information.

which reminds me to add parameters to category view for subcategory image and subcategory descriptions (existing code is finished and ready to use them)


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

5 years 4 months ago #31932 by igcorreia
I see. Thanks for the explanation.

Please Log in or Create an account to join the conversation.

5 years 4 months ago #31938 by ggppdk
Also , file:

views/category/view.html.php has FINISHED/TESTED code to create customized subcategory images and descriptions (like in directory view)


I ll copy (a) parameters and (b) layout from directory view (or from FAQ template) to enable this to all templates


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

5 years 4 months ago #31943 by igcorreia
WOW, perfect :D I have asked for that in the past. YEY :D

Please Log in or Create an account to join the conversation.

5 years 4 months ago #31947 by brandonking
FC is getting very close to mega CCK :D

Thank you.

Please Log in or Create an account to join the conversation.

5 years 4 months ago #31952 by Rooney

algardata wrote: I usually create an item and point to it. What is the difference since the result is the same?

Sometimes you need catgory views so that Joomla keeps the right menu connection when a article from the category is displayed. This has been a big issue at least for Joomla 1.5 and older.

Rooney

Joomla 3.7.6, 3.2.1.14-rc

Please Log in or Create an account to join the conversation.

5 years 4 months ago #31954 by igcorreia
I see... But I never create a new view. A new FC VIEW TUTORIAL is very welcome. :D

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.