- Posts: 14
COMMUNITY FORUM
Display 2 entries, epenultimate and antepenultimat
- borja
- 
				Topic Author 
- Offline
- New Member
		Less
		More
		
			
	
		
			
	
						4 years 9 months ago				#177807
		by borja
	
	
		
			
	
			
			 		
													
	
				Display 2 entries, epenultimate and antepenultimat was created 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.
- JoomlaWorks
- 
				
- Offline
- Admin
		Less
		More
		
			
	
		- Posts: 6229
			
	
						4 years 9 months ago				#177814
		by JoomlaWorks
	
	
		
			
	
			
			 		
													
	
				Replied by JoomlaWorks on topic Display 2 entries, epenultimate and antepenultimat			
			
				Can you rephrase your question please?			
					Please Log in or Create an account to join the conversation.
- borja
- 
				Topic Author 
- Offline
- New Member
		Less
		More
		
			
	
		- Posts: 14
			
	
						4 years 9 months ago				#177826
		by borja
	
	
		
			
	
			
			 		
													
	
				Replied by borja on topic Display 2 entries, epenultimate and antepenultimat			
			
				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.
- JoomlaWorks
- 
				
- Offline
- Admin
		Less
		More
		
			
	
		- Posts: 6229
			
	
						4 years 9 months ago				#177834
		by JoomlaWorks
	
	
		
			
	
			
			 		
													
	
				Replied by JoomlaWorks on topic Display 2 entries, epenultimate and antepenultimat			
			
				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
					K2 templating guide: getk2.org/documentation/tutorials/templating-with-k2-and-the-concepts-of-sub-templates
Please Log in or Create an account to join the conversation.
- borja
- 
				Topic Author 
- Offline
- New Member
		Less
		More
		
			
	
		- Posts: 14
			
	
						4 years 9 months ago				#177836
		by borja
	
	
		
			
	
			
			 		
													
	
				Replied by borja on topic Display 2 entries, epenultimate and antepenultimat			
			
				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
					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.
- JoomlaWorks
- 
				
- Offline
- Admin
		Less
		More
		
			
	
		- Posts: 6229
			
	
						4 years 9 months ago				#177844
		by JoomlaWorks
	
	
		
			
	
			
			 		
													
	
				Replied by JoomlaWorks on topic Display 2 entries, epenultimate and antepenultimat			
			
				Change this line:
to:			
					        <?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
        ?>Please Log in or Create an account to join the conversation.