Jump to content

[SOLVED] Multiple $pages->find with limit and pagination on only one element


Peter Troeger
 Share

Recommended Posts

Hello Community ?

Has anyone ever tried having multiple elements on one page that get their info with $pages->find('selector, limit=n') and tried using pagination on one of these elements without effecting the other?

I have a slider on a page where I display content with pagination. But when I go to page two, the slider content also goes to page two, which I don't want it to do ?

Any tips are greatly appreciated!

Thanks!

-Peter

Edited by Peter Troeger
solved
Link to comment
Share on other sites

Well, I have this in the sidebar:

<?php $aktuelles = $pages->find('template=blog-post, limit=4');
							
							foreach($aktuelles as $aktuell) {
								$aktuell_body = $aktuell->get('summary|body');
								$aktuell_title = $aktuell->title;
								$aktuell_url = $aktuell->url;
								$cat = $pages->get('/'.$pages->get('id='.$aktuell->categories[0])->name.'/');
								echo '<div>
									<div class="post">
										<p class="date">'.$aktuell_title.'</p> 
										<div class="text">';
											$aktuell_body = strip_tags($aktuell_body, '<a><strong><em><i>');
											echo truncate_words($aktuell_body, 22); 
										echo '</div>
									</div>';
									
									if($aktuell->categories!='') echo '<a href="'.$cat->url.'">'.__('Weitere Informationen unter ').$cat->title.'</a>';
									
								echo '</div>';
							}
							
?>

and this is the main content with the pagination:

<?php
$children = $page->children('limit=3');
foreach($children as $child) {
			$title = $child->title;
			$url = $child->url;
			
			echo '<h2><a href="'.$url.'">'.$title.'</a></h2>';
			$grandchildren = $child->children();
			foreach($grandchildren as $grandchild) {
				$grandchild_title = $grandchild->title;
				$grandchild_body = $grandchild->body;
				$grandchild_date = $grandchild->date_freeform;
				echo '<section class="mitteilung veranstaltung">
				<h3>'.$grandchild_title.'</h3>
				<p class="date"><em>'.$grandchild_date.'</em></p>
				<p>'.$grandchild_body.'</p>
				</section>';
			}
			
		}
	?> 
			
			
<?php echo $children->renderPager(); ?>	

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...