Keyword

Skipping articles in category list view

More
8 years 6 months ago #151731 by Brent
I have a module that shows the latest articles on the site. Below that is category list view for K2, so what I would like to skip the first 5 articles because they are already shown above in the module. Any suggestions on how to do this?

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

More
8 years 6 months ago #151739 by Lefteris
Replied by Lefteris on topic Skipping articles in category list view
Hi,

You need to create an override for the module layout. Then set the module limit to the number of items you want to display plus 5.

Finally edit the layout and between lines 22 and 23 (github.com/getk2/k2/blob/master/modules/mod_k2_content/tmpl/Default/default.php#L22-L23 ) add the following code:
<?php if($key < 4) continue; ?>

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
8 years 6 months ago #151757 by Brent
Replied by Brent on topic Skipping articles in category list view
That's awesome - thanks so much! I wanted to actually impact the home page view, so I did essentially what you said to the templates/default/category.php.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 6 months ago #151787 by Krikor Boghossian
Replied by Krikor Boghossian on topic Skipping articles in category list view
Remember to use ovverrides instead of editing core files:
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
8 years 3 months ago - 8 years 3 months ago #155432 by twoborg
Replied by twoborg on topic Skipping articles in category list view
Hi,

I need to refresh this Topic.

I need the same thing as the original poster needed but I don't think the solution provided works for me.

I hava a Category Displayed with two modules above the category articles:

look here

First module from the top displays 4 most recent articles, second module displays 3 most viewed articles.

and the more of the good stuff represents the actual category display.

I would like not to show the first 4 articles in the category display as they are already shown in the first module.


EDIT: Forgot to menion - Joomla 3.5.1 and k2: 2.6.9 (some of plugins I used are not compatible with 2.7.0)
Last edit: 8 years 3 months ago by twoborg. Reason: forgot something

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 3 months ago #155451 by Krikor Boghossian
Replied by Krikor Boghossian on topic Skipping articles in category list view
Did you apply the code to the right overridden file?
www.joomlaworks.net/blog/item/194-k2-inheritance-sub-templating

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
8 years 3 months ago - 8 years 3 months ago #155533 by twoborg
Replied by twoborg on topic Skipping articles in category list view
Yes in Categroy.php ... and the first page of the pagination works as desired. but the problem occures on the second and further pages.
The $Key value is set to zero for every page rendering of the pagination which leads to unwanted result ...

First 4 articles of every page are left out, and I don't want that...

I need this to happen only for the first page ...

And also if I want to display only 9 articles (3x3) box. I have to set 13 articles in the Category config. Again it works nice for the first page.
Assuming we fix the display ofthe articles on the second and third page, I will get 13 Articles on the rest of the pagination pages.
Last edit: 8 years 3 months ago by twoborg. Reason: Forgot somethnig

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

  • JoomlaWorks Support Team
  • JoomlaWorks Support Team's Avatar
  • Offline
  • Elite Member
More
8 years 3 months ago #155618 by JoomlaWorks Support Team
Replied by JoomlaWorks Support Team on topic Skipping articles in category list view
Hi,

I do not know exactly what code you have apply but I assume that you have an if statement to control this filtering. When you navigate through pagination there is a variable "limistart" that controls what data should appear in each page. This variable has always a zero value in the first page so give it a try with the following snippet
if(..... && JRequest::getInt('limitstart') == 0)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum