0

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
0

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 :

<?php
  //count all Open posts in Channel 1, of site ID 1
  $res = ee()->db->select("COUNT(*) AS 'total'")
             ->from('channel_entries')
             ->where('status','open')
             ->where('channel_id','1')
             ->where('site_id','1')
             ->get();
  $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, privacy policy and cookie policy

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