Page 1 of 1

{SHOW_PAGE}- rep tag for paginated contentparts

Posted: Wed 24. Sep 2008, 15:49
by jsw_nz
Just a simple RT to derive page x of total when using paginated content parts
basically returns a string - no links - just had a need for this:

Code: Select all

<?php
$paginate_count = 0;
if($content['CpPages']) {
	$page_number = $content['aId_CpPage'];
	if($page_number==0){
		$page_number=1;
	}
	foreach($content['CpPages'] as $key => $value) {
		$paginate_count ++;
	}
	$page_string = "<span style=\"text-align:right;\">page ".$page_number." of ".$paginate_count."</span>";
	$content['all'] = str_replace('{SHOW_PAGE}', $page_string, $content['all']);
}else{
	$content['all'] = str_replace('{SHOW_PAGE}', "", $content['all']);
}
?>
cheers
:D