Keyword

Sub category display

  • Marty Peet
  • Marty Peet's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 2 months ago #79955 by Marty Peet
Sub category display was created by Marty Peet
Hi, building a site, trying to integrate k2 into it as much as is possible. Joomla 1.5.15, k2 2.2, Apache 2.0.54, PHP 5.2.6, MySQL 4.1.25. I've created a couple of templates and am attempting to customise the display of a top level directory with a number of sub categories that contain a number of items. The current output from a menu link (Langri Tangpa Home > Overview) is here tinyurl.com/y8lmrzs

I have a couple of questions, can anyone tell me why there is such a large gap between the sub-category descriptions? If you scroll down so that you can see all the white space and hit the refresh button you can see the content initially quite close to the content above it. I think the CSS kicks it and pushes it way down, anyone know why?

Second question is, anyone have any idea where I can grab the code (for each probably) that would list ALL the items in each sub-category on this one page? This is a CUSTOMER request, I've tried to talk them out of it to no avail... even if they have 100's of items in 100's of sub-categories they want them displayed

Third question, is there any reason anyone can think of why my templates DON'T implement or use the item.php file that is part of my template? It DEFINITELY uses the category.php and category_item.php files, but not the item.php. For that it loads the item.php from the k2 folder. I've noticed a php section 'Load category_item.php by default' Could the same strategy be used to load the item.php file that I require?

Thanks for any/all help provided

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

More
15 years 2 months ago #79956 by renegadesk
Replied by renegadesk on topic Sub category display
Question 1: I've had a look at the page in Chrome and it looks like you only have one sub-category, so I'm not exactly sure what you mean about "such a large gap between sub-category descriptions". Could you explain what you mean a bit further hear please?

Question 2: You don't need code to list all the items on this page, as this is configurable through K2.
- Go to the top level category for this page in K2 i.e. Programs.
- To display all items in sub cats, the Parameter section you will need to look at is "Category item layout"
- Under "layout grid" make sure there is at least a number higher then 0 for "leading count"
- Under "Other layout options" make sure "Catalog mode" is set to "No".

That should do the job for you. I will admit that I am fairly new to K2 but I have got my head around it pretty quick and this is the parameter options that I altered to do what you are trying to achieve. They may be another config option somewhere that may affect how it is displaying on your site so post back if my idea doesn't work and I'll look around a bit more.

Question 3: Can't help with this as I haven't looked into the custom K2 templates as yet. Will post back if I come up with a solution for you. Oh and now that I think of it, maybe your custom template is affecting the display in your Question 2.

Good luck.

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

  • Marty Peet
  • Marty Peet's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 2 months ago #79957 by Marty Peet
Replied by Marty Peet on topic Sub category display
Thanks for your reply, will try the leading greater then 0 thing and get back to you. Question 1, I've viewed that page in Firefox/Chrome and IE 8. They ALL display with a big, white gap between the subcategories. Maybe it's because of my 0 setting for leading? I'll try it out and see what haps. I see a page with an image Programs left hand side, then a heading Category Overview, right side, 2 paragraphs of text, heading Program Sub-categories, heading Teachings with the Lamas right hand side, text, View items... BIG block of white then next heading Beginners Courses etc, etc. still not sure about the custom templates item.php file, but thanks again for your reply

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

  • Marty Peet
  • Marty Peet's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 2 months ago #79958 by Marty Peet
Replied by Marty Peet on topic Sub category display
Well, that was rather interesting. Turned off catalog mode and added leading of 1. The page now has, from the top down, a description of my top level category, next descriptions of ALL secondary level categories STILL with large white spaces between them, and then at the bottom of the page individual items (item view in category view) What I'd like is to have each of the items listed underneath it's particular category introduction and no white space... probably have to start moving sections of code?

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

More
15 years 2 months ago #79959 by juro
Replied by juro on topic Sub category display
I have the same problem ... Just moving code isn't enough though, in components/com_k2/views/view.html.php, in the foreach loop on line 96, you'll have to populate the subcategory array item.

I failed up to now.

Marty Peet said:Well, that was rather interesting. Turned off catalog mode and added leading of 1. The page now has, from the top down, a description of my top level category, next descriptions of ALL secondary level categories STILL with large white spaces between them, and then at the bottom of the page individual items (item view in category view) What I'd like is to have each of the items listed underneath it's particular category introduction and no white space... probably have to start moving sections of code?

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

  • Marty Peet
  • Marty Peet's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 2 months ago #79960 by Marty Peet
Replied by Marty Peet on topic Sub category display
Hey Roland, thanks for the heads up on where to find the code. I'll keep you up to date if I make any headway... no thoughts on the HUGE whitespace between sub-category descriptions?

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

More
15 years 2 months ago #79961 by renegadesk
Replied by renegadesk on topic Sub category display
Whoa, I've just checked back on the site and can see the enormous div heights that are causing the redonculous amount of white space between sub-cats. Looks like k2 appends heights to the sub category divs so that they are all the same height. I have default template, hardly any descriptive text and most of the options turned off for category display page, and h2 sets my div height to 317px.

... OK I've figured it out. It's to do with your description text for the categories. K2 will load all the categories, look for the category with the biggest height, then append that same height to all of the category divs regardless of how much content they have. I assume this is so that if your category div has a border or background colour, then all the category divs would display the same height to look nice. Doesn't look so nice on your site at the moment though!

Reduce the description text or add a "read more" tag on your categories and you'll fix one of your problems.

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

  • Marty Peet
  • Marty Peet's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 2 months ago #79962 by Marty Peet
Replied by Marty Peet on topic Sub category display
Hey sk, I thought it might be defaulting to the longest/largest category description. Seeing as how this is going to be a 'one off' page/view I think I'll see if I can find where k2 is doing the calculation and stop it. I've attempted to get my customer to shorten their category descriptions, nada. Inserting a readmore link won't really work for my layout thx for your feedback

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

  • Marty Peet
  • Marty Peet's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 2 months ago #79963 by Marty Peet
Replied by Marty Peet on topic Sub category display
Thought I might try a different angle, created a menu link (Our Programs > Curriculum Overview) The link is to multiple categories. I created a custom template to manipulate the placement of images. Now all I need is php to pull the introtext/image for the parent/top level category to the top of the page, any ideas?

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

More
15 years 2 months ago #79964 by Elisa F.
Replied by Elisa F. on topic Sub category display
I had the same problem (large whitespace) I solved it by creating an own css file in my Templates Folder with the argument:

.clr {clear:both;height:0;line-height:0;display:block;float:none;}
.clearList {display:none;}

so the .clr container is not displayed

Greetings

Elisa

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

More
15 years 1 month ago #79965 by Steve Adams
Replied by Steve Adams on topic Sub category display
Hi Roland,

Did you make any progress with sub-category item titles? This seems to be a common mod request, not sure why it was omitted from K2 sub-category parameters when it is default in vanilla joomla. Also, are you sure components/com_k2/views/view.html.php exists in K2.2?

Thanks

Roland Jungwirth said:I have the same problem ... Just moving code isn't enough though, in components/com_k2/views/view.html.php, in the foreach loop on line 96, you'll have to populate the subcategory array item.
I failed up to now.

Marty Peet said:Well, that was rather interesting. Turned off catalog mode and added leading of 1. The page now has, from the top down, a description of my top level category, next descriptions of ALL secondary level categories STILL with large white spaces between them, and then at the bottom of the page individual items (item view in category view) What I'd like is to have each of the items listed underneath it's particular category introduction and no white space... probably have to start moving sections of code?

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

  • Marty Peet
  • Marty Peet's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 1 month ago #79966 by Marty Peet
Replied by Marty Peet on topic Sub category display
Hey Elisa, this appears to be the CSS that is already in the k2.css file?

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

More
15 years 1 month ago #79967 by Elisa F.
Replied by Elisa F. on topic Sub category display
Hi! Yes, but not the "display:none;" Argument

Marty Peet said:Hey Elisa, this appears to be the CSS that is already in the k2.css file?

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

  • Marty Peet
  • Marty Peet's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 1 month ago #79968 by Marty Peet
Replied by Marty Peet on topic Sub category display
Hey Elisa, quickest reply I've ever had!!! ;-] My k2.css has both lines in it, I probably read your reply earlier and implemented it ;-[ thank's for your input.

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

More
15 years 1 month ago #79969 by MC
Replied by MC on topic Sub category display
Solved!

I had this problem a while back while bug fixing for a client and was scratching my head how to solve it. When viewing in Firebug the style height appended to the div was there but when viewing source it wasn't so thought it must be a javascript thing.

This is a core hack so not the best way, but here goes...

1. Go to /components/com_k2/js/k2.js
2. Around line 90 there is a load function, all you need to do is comment out the whole thing (code below)
3. Job done!

//window.addEvent('load', function(){
// Equal block heights for the "default" view
// if($$('.subCategory')){
// var blocks = $$('.subCategory');
// var maxHeight = 0;
// blocks.each(function(item){
// maxHeight = Math.max(maxHeight, parseInt(item.getStyle('height')));
// });
// blocks.setStyle('height', maxHeight);
// }
// });

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

  • Marty Peet
  • Marty Peet's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 1 month ago #79970 by Marty Peet
Replied by Marty Peet on topic Sub category display
BRILLIANT!!! thanks MC

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

More
14 years 10 months ago #79971 by Taylor Warnick
Replied by Taylor Warnick on topic Sub category display
finally found this! thanks MC

MC said:Solved!
I had this problem a while back while bug fixing for a client and was scratching my head how to solve it. When viewing in Firebug the style height appended to the div was there but when viewing source it wasn't so thought it must be a javascript thing.

This is a core hack so not the best way, but here goes...

1. Go to /components/com_k2/js/k2.js
2. Around line 90 there is a load function, all you need to do is comment out the whole thing (code below)
3. Job done!

//window.addEvent('load', function(){
// Equal block heights for the "default" view
// if($$('.subCategory')){
// var blocks = $$('.subCategory');
// var maxHeight = 0;
// blocks.each(function(item){
// maxHeight = Math.max(maxHeight, parseInt(item.getStyle('height')));
// });
// blocks.setStyle('height', maxHeight);
// }
// });

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

More
14 years 9 months ago #79972 by Justin Herrin
Replied by Justin Herrin on topic Sub category display
Hi Marty - did you ever get your question #2 answered? I'm looking for a way to do this as well. I have been trying to build my own template to do it, and I'm almost there, but it still needs that final bit of code that I can't figure out.

What I have displays my page like this...

Page Title - Parent Category title
- Subcategory 1 title
-- Subcategory 1 Item 1
-- Subcategory 1 Item 2
-- Subcategory 2 Item 1
-- Subcategory 2 Item 2

- Subcategory 2 title
-- Subcategory 1 Item 1
-- Subcategory 1 Item 2
-- Subcategory 2 Item 1
-- Subcategory 2 Item 2


As you can see, ALL items are showing under each subcategory, instead of just that specific subcategory's items. A bit frustrating so say the least.

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

  • Marty Peet
  • Marty Peet's Avatar Topic Author
  • Offline
  • Premium Member
More
14 years 9 months ago #79973 by Marty Peet
Replied by Marty Peet on topic Sub category display
I came up with this solution using the Tabs n Slides plugin

new.template.s50284.gridserver.com/index.php?option=com_k2&view=itemlist&layout=category&task=category&id=5&Itemid=4

Click on the Browse Experts tab, click on the slide titles. The titles are individual categories within the parent category Experts, each item in those sub-category is listed.

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


Powered by Kunena Forum