- Posts: 20
COMMUNITY FORUM
Categories View in Front Page
- pocasolta
-
Topic Author
- Offline
- Junior Member
I have a site with the following categories:
*PRODUCTS
*--- PRODUCTS_CAT_1
*--- PRODUCTS_CAT_2
*
subProd_Cat_1
*
subProd_Cat_2
*--- PRODUCTS_CAT_3
*NEWS
*COMPANY
for the PRODUCTS category I use a k2 template folder called 'products', and the same goes for 'NEWS' and 'COMPANY'
all the PRODUCTS's children categories inherit its template.
everything is working fine, but I have something that is driving me crazy and don't know how to achieve:
I have the main menu with these options: HOME | PRODUCTS | NEWS | COMPANY
the products, news and company menu items are of k2 category type and each one points to its category.
for the HOME (default) menu item I am showing various modules and it's working ok, but I also need to show a div with all the PRODUCTS subCategories (only 1 level down)... it's got to have just the name (with link) and the image for each category. Just like a frontpage for a product catalog, and it has to be a different layout (much simple) than when I select the PRODUCTS item menu.
I tried creating a fake k2 category, on top of PRODUCTS and giving this category a different template, and then changing the 'category.php' file.
I iterate through every child category using this code:
____ $childs = K2ModelItemlist::getCategoryFirstChilds($this->subCategories[0]->id, ""); (with this sentence I'm getting all the PRODUCT child categories)
and then a 'for' sentence iterating through each subcategory. I can create a div for every cat here with the name and the image, but the link is blank...
I am sure there is a better and maybe easier way to achieve this.
could anyone please help me out here?
thanks!
Please Log in or Create an account to join the conversation.
- pocasolta
-
Topic Author
- Offline
- Junior Member
- Posts: 20
anyone knows how could I personalize the category view for the front page only?
Please Log in or Create an account to join the conversation.
- rashmani
-
- Offline
- New Member
- Posts: 10
haven't tried my self, just an idea: have you tried creating a new K2 Tool component, assign a module location to it and setting parameters to list a category's entried on e level down only? Again, I haven't tried this but if I remember well that should be the way to go.
rash*
pocasolta said:hi again, anyone knows how could I personalize the category view for the front page only?
Please Log in or Create an account to join the conversation.
- pocasolta
-
Topic Author
- Offline
- Junior Member
- Posts: 20
I tried what you propose but, as far as I know, with the K2 Tool component I can only get a category list with just the names of the categories. I'd also need to show the text and image for each category.
cheers.
Please Log in or Create an account to join the conversation.
- rashmani
-
- Offline
- New Member
- Posts: 10
Another solution (or if the above doesn't solve) could be to edit .php files in template folder and add intro text, image, etc. (you can copy necessary code from the other files in the same folder).
I'll try to make a test later today to see if I'm pointing you in the right direction (by copying the K2 Tools comp and ...).
rash*
pocasolta said:hello rash, thanks for the reply, I tried what you propose but, as far as I know, with the K2 Tool component I can only get a category list with just the names of the categories. I'd also need to show the text and image for each category.
cheers.
Please Log in or Create an account to join the conversation.
- pocasolta
-
Topic Author
- Offline
- Junior Member
- Posts: 20
I followed jour last idea and I think I now have what I needed! =)
Now I have a new functionality for the k2 tools module: Category Showcase:
What I've done is: I added another feature to the k2 tools module by copying the 'Categories List (Menu)' functionality to a new one: 'Categories showcase'.
This new functionality renders the categories into div's instead of a list, and inside every category's div there's the category name and the category image.
I also added a new parameter to this feature: columns count. With this parameter I can set how many categories per row must be painted.
To do so I modified three files from the '/modules/mod_k2_tools' folder:
* mod_k2_tools.xml :new functionality and new parameter for this functionality
* mod_k2_tools.php :modification to call the correct new method
* helper.php :all the code for this new functionality, based on the code for the 'Categories List (Menu)' option.
I attach the files. I hope it can be useful for someone with the same needs.
Maybe the best approach would be to create a stand-alone module so I don't mess with the original source,...
thanks again! ,' )
Please Log in or Create an account to join the conversation.
- rashmani
-
- Offline
- New Member
- Posts: 10
Thank you.
rash*
pocasolta said:hi again rash,
I followed jour last idea and I think I now have what I needed! =)
Now I have a new functionality for the k2 tools module: Category Showcase:
What I've done is: I added another feature to the k2 tools module by copying the 'Categories List (Menu)' functionality to a new one: 'Categories showcase'.
This new functionality renders the categories into div's instead of a list, and inside every category's div there's the category name and the category image.
I also added a new parameter to this feature: columns count. With this parameter I can set how many categories per row must be painted.
To do so I modified three files from the '/modules/mod_k2_tools' folder:
* mod_k2_tools.xml :new functionality and new parameter for this functionality
* mod_k2_tools.php :modification to call the correct new method
* helper.php :all the code for this new functionality, based on the code for the 'Categories List (Menu)' option.
I attach the files. I hope it can be useful for someone with the same needs.
Maybe the best approach would be to create a stand-alone module so I don't mess with the original source,...
thanks again! ,' )
Please Log in or Create an account to join the conversation.
- Matthieu Brunet
-
- Offline
- Junior Member
- Posts: 28
But I'm affraid of beeing obliged to do change the file at every update of k2. Maybe it would be a nice (and quick) feature request. It would be even better to be a little more MVC, by mooving all of the HTML code in the view.
Please Log in or Create an account to join the conversation.
- Matthieu Brunet
-
- Offline
- Junior Member
- Posts: 28
So here is my code.
To install it, you just have to upload it in your module directory. I think there is not a lot of work left to install it via the joomla module installer.
The language file miss.
Please Log in or Create an account to join the conversation.
- Steve McLure
-
- Offline
- New Member
- Posts: 4
Please Log in or Create an account to join the conversation.
- Matthieu Brunet
-
- Offline
- Junior Member
- Posts: 28
Go to tools->module->add
Please Log in or Create an account to join the conversation.
- Steve McLure
-
- Offline
- New Member
- Posts: 4
i have been experimenting with the k2 content module, and there are many position choices EXCEPT i can't find the choice that puts the items right in the central main content area... the position where ARTICLES appear if you select the FRONT PAGE option when you publish them using Joomla 1.5 without K2.
Please Log in or Create an account to join the conversation.
- Matthieu Brunet
-
- Offline
- Junior Member
- Posts: 28
Please Log in or Create an account to join the conversation.
- pocasolta
-
Topic Author
- Offline
- Junior Member
- Posts: 20
I'm glad it was useful to you! =)
a little after I posted it, I also converted this to a standalone module... I attach it here because I think I did some minor fixes/upgrades to the html part I first posted.
best wishes
Please Log in or Create an account to join the conversation.
- Aleksandar Nedeljkovic
-
- Offline
- New Member
- Posts: 1
can you tell me how to setup to show categories in 2 or more columns? I wrote in field "Select column count", but something does not work ok. Categories is shows one below another category in only one column.
Thank you in advanced.
Please Log in or Create an account to join the conversation.
- Matthieu Brunet
-
- Offline
- Junior Member
- Posts: 28
www.arcadie-sa.fr
The number of columns is only css. So you need to change the css of your template to achieve this. If you want a particular order, maybe you need some php ajustement in the template too. It' a little far in my mind right know, so I can't be more specific, sorry.
Please Log in or Create an account to join the conversation.