{SHOW_PAGE}- rep tag for paginated contentparts

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

{SHOW_PAGE}- rep tag for paginated contentparts

Post 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
Post Reply