Do you guys know of a library where there's sample queries to retrieve info like how many pages are in a specific site ect?

What I mean is a custom select statement.

Thanks, Dan


1 Answer 1


I'll give you an example in PHP (within EE of course) here, this will count all posts in a channel, and I assume you drive your pages of a channel too :

  //count all Open posts in Channel 1, of site ID 1
  $res = ee()->db->select("COUNT(*) AS 'total'")
  $totalChannel1Posts = 0;
  if ( $res->num_rows() > 0 ) {
    $res = array_unshift($res->result_array());
    $totalChannel1Posts = $res['total'];

Is that any help?? Of course you can work out the query itself from the above too.

Otherwise, are you looking for some sort of site crawler? Because EE itself has no concept of a 'page', but rather templates that could be static or dynamic pages, a router and channels to store similar data, which in turn use a dynamic template to provide a new 'page' with entry specific data...

You might be best off using something like google to count your pages!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.