UDT - Count total active pages of your CMSMS site

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

UDT - Count total active pages of your CMSMS site

Post by blast2007 »

After searching in forum I can't find a tag like this one.
It's a stupid tag, but sometimes could be useful.

Tag {total_pages_count}

Code: Select all

// Count total active pages including mainpage, link
global $gCms;
$db = &$gCms->db;
$q = "SELECT COUNT(*) as cnt FROM " . cms_db_prefix() . "content WHERE (type='content' OR type='link') AND active = 1 OR default_content = 1 AND show_in_menu = 1";
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
    echo 'DB error: '. $db->ErrorMsg()."<br/>";
}
$count = $dbresult->FetchRow();
echo $count['cnt'];
Regards
blast
cubix
Power Poster
Power Poster
Posts: 314
Joined: Mon Jul 09, 2007 10:00 am

Re: UDT - Count total active pages of your CMSMS site

Post by cubix »

im sure somone might find a use.

the SystemInfo module has the same functionality (on the admin side)

http://dev.cmsmadesimple.org/projects/sysinfo/
Post Reply

Return to “Tips and Tricks”