Keyword

Display 2 entries, epenultimate and antepenultimat

More
2 weeks 6 days ago #177807 by borja
how can i show in the module k2_content, penultime and antepenultimate? I imagine that i have to define a search.

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 6 days ago #177814 by Fotis
Can you rephrase your question please?

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

More
2 weeks 4 days ago #177826 by borja
I explain agin. The default module k2_content, i can choose to show the last entries but in my case, i would like to show not the last entries, indeed i want to show the penultimate(the previous of the last one) and antepenultimate(the previous of the previous of the last one), the last one i don´t need it. How can i change the filter? The query? Where? Is is possible? I was thinking in changing the template and with a counter,just show the penultimate and the antepenultimate.

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 4 days ago #177834 by Fotis
You can adjust the sub-template to skip one item at the start of the loop and one at the end, it's not hard.

K2 templating guide: getk2.org/documentation/tutorials/templating-with-k2-and-the-concepts-of-sub-templates

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

More
2 weeks 4 days ago #177836 by borja
Hello,


Thank you. "ITem Ordering" in the module and add a new option and that was the reason of askig. I know how to do what you say me(i did it last week for an additional change to the template). I will try. the problem is that myknowledge of php is almost null. Just with a counter and skipping the first item and if the counter is 0 skip. How can I code that?


Best regards,

Borja

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 2 days ago #177844 by Fotis
Change this line:
        <?php foreach ($items as $key=>$item):  ?>

to:
        <?php foreach ($items as $key=>$item):
        if ($key == 0 || $key == (count($items) - 1)) continue; // skip the first and last K2 item from the foreach loop
        ?>

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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


Powered by Kunena Forum