Keyword

Category template not being picked up by Archive module

  • BNR Investment Group
  • BNR Investment Group's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 1 month ago #87815 by BNR Investment Group
Category template not being picked up by Archive module was created by BNR Investment Group
I've got a blog category set up on a site using a subtemplate for the category and all child categories. It works great, displays properly everywhere I want it to except the Archive Module. When I select any link from there it does not load the assigned template, it goes back to the default. Ideas?

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

More
14 years 1 month ago #87816 by william white
I see the same thing on my test site
The joomlabooo with custom override url is like
/index.php?option=com_k2&view=itemlist&layout=category&task=category&id=7&Itemid=23
and the k2_tools archive link displays like
/index.php?option=com_k2&view=itemlist&task=date&month=8&year=2010&catid=7&Itemid=23
If you could find the building part of the module and add "layout=category" into it that may fix it
Is this the same as you are seeing?
Also, can you "override" the module by placing a copy of it in /html/com_k2/modules and editing it?
This may be more questions that answers

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

  • BNR Investment Group
  • BNR Investment Group's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 1 month ago #87817 by BNR Investment Group
Replied by BNR Investment Group on topic Category template not being picked up by Archive module
Hmm. Adding the "layout=category" didn't make a difference so I started poking around in the code that builds item lists. There are 2 files I looked at view.html.php and view.raw.php in com_k2/views/itemlists/. Both of them have something in common in the display function. For each task K2 has to set the layout, for the category view is has this -

$this->setLayout('category');

For search, date, and tag is has -

$this->setLayout('generic');

The display is definitely the generic layout, but changing the line to category actually kills the page - no articles are listed. Not sure why it wouldn't work by changing that line, I need to dig a little deeper.

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

More
14 years 1 month ago #87818 by william white
ill foward this link to another programmer i know, maby he will have an idea

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

More
14 years 1 month ago #87819 by Jiliko.net
Hi,

Where this archive module can be found ?

Olivier

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

  • BNR Investment Group
  • BNR Investment Group's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 1 month ago #87820 by BNR Investment Group
Replied by BNR Investment Group on topic Category template not being picked up by Archive module
The archive module is really the K2 Tools module, one of the options is Archive, it creates links to a category by date similar to a Wordpress archive.

Olivier Nolbert said:Hi,
Where this archive module can be found ?

Olivier

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

More
13 years 6 months ago #87821 by Jose Ramon
Hi Brent.
did you resolve this?
Y have the same problem with K2Tools in "archive" mode.
can you tell me anything?
Thanks.

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

  • BNR Investment Group
  • BNR Investment Group's Avatar Topic Author
  • Offline
  • Senior Member
More
13 years 6 months ago #87822 by BNR Investment Group
Replied by BNR Investment Group on topic Category template not being picked up by Archive module
I ended up using a work around since the site did not have a high volume of items. We faked it by using a menu and tags.

 

I looked in the the issue at the time and I am not sure why it was not pulling up the selected template. At this time, I don't have an answer, I have not gone back to figure it out yet.

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

More
13 years 6 months ago #87823 by Jose Ramon
Well, I have a solution.I'll try to tell you what I have made.First, layout is "generic" when task == 'date'  (file "\components\com_k2\views\itemlist\view.html.php", line 215).When showing a category, I have modified the "template" (files "category.php" and "category_item.php" in "components/com_k2/templates/default).Exists a file "generic.php" in "components/com_k2/templates/" which is the template when layout is generic. So, I have modified this file ("components/com_k2/templates/generic.php") so it shows the items as "category.php" and "category_item.php" do.

 

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

  • BNR Investment Group
  • BNR Investment Group's Avatar Topic Author
  • Offline
  • Senior Member
More
13 years 6 months ago #87824 by BNR Investment Group
Replied by BNR Investment Group on topic Category template not being picked up by Archive module
That does work, but there is a problem with doing it that way. First, you should never edit the files in default. K2 is designed to support multiple sub-templates. Any time you want a new look for any K2 page, you make a copy of default then name it something else. You put that copy in JOOMLA/templates/YOUR TEMPLATE/HTML/com_k2. You will then be able to see the new folder in the category subtemplate selection. This allows you to keep adding new styles to use for each category.

 

The generic.php file should also have the same ability, but for some reason it does not. In the K2 tools module there is actually a bit of code that selects the generic file. I have tried replacing that with the code used to select custom subtemplates but it does not work. Like I said, I didn't have time to figure out why so I just created a work around. If it works for you, go with it, just know that you can have multiple subtemplate files for basically everything else.

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


Powered by Kunena Forum