Jump to content

Counting Number of Pages using a specific Page Reference


Jon
 Share

Recommended Posts

Hello All,

I'am struggling a bit (or maybe approaching this wrong). I've creating a simple events section which has a number of categories setup as pages. I've used a multiple Page Reference in the individual events to selects which categories the event may fall under

I'am in the process of setting up sidebar which lists all the categories which is fine. Now i would like to have the number of events in brackets at the end. However I cant seem to check the page reference for the category page ID, Ive used the following code :-

 

<?php 
$cat = $pages->find("template=event_cat, sort=title, include=hidden");    
foreach ($cat as $cats) {
	$count = $pages->count("template=event, event_cat*={$cats->id},");
	echo "<li class='uk-active'><a href='{$cats->url}'>{$cats->title} ({$count}) </a></li>";
}
?>

Is it something to do with using the ID with *=

Cheers

Jon

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...