Page 1 of 1

UDT - Count total active pages of your CMSMS site

Posted: Wed Feb 27, 2008 11:13 pm
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

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

Posted: Wed Feb 27, 2008 11:39 pm
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/