The first method:
1. Modify the include/inc_arcpart_view.php file
Find the function ParseTemplet() function
Modified to:
function ParseTemplet()
{
if(!is_array($this->dtp->CTags)) return "";
foreach($this->dtp->CTags as $tagid=>$ctag)
{
$tagname = $ctag->GetName();
//countclass statistic column articles
if( $tagname == "countclass" ){
$tid = $ctag->GetAtt("typeid");
$row = $this->dsql->GetOne("Select count(ID) as dd From #@__archives where typeid='$tid' and arcrank<>-1");
$this->dtp->Assign($tagid,$row['dd']);
}
……
2. Call method on the web page
{dede:countclass typeid=column number/}
For example:
{dede:countclass typeid='2′/}
The second method (provided by the genuine hand 339709):
1. Modify the include/inc_functions.php file and add the function as follows:
function GetTotalArc($tid){
$dsql = new DedeSql(false);
$row = $dsql->GetOne("Select count(ID) as dd From #@__archives where typeid='$tid'");
return $row['dd'];
}
2. Calling methods
[field:id function='GetTotalArc(@me)'/]
Original articles, please indicate the source when reprinting.
1. Modify the include/inc_arcpart_view.php file
Find the function ParseTemplet() function
Modified to:
function ParseTemplet()
{
if(!is_array($this->dtp->CTags)) return "";
foreach($this->dtp->CTags as $tagid=>$ctag)
{
$tagname = $ctag->GetName();
//countclass statistic column articles
if( $tagname == "countclass" ){
$tid = $ctag->GetAtt("typeid");
$row = $this->dsql->GetOne("Select count(ID) as dd From #@__archives where typeid='$tid' and arcrank<>-1");
$this->dtp->Assign($tagid,$row['dd']);
}
……
2. Call method on the web page
{dede:countclass typeid=column number/}
For example:
{dede:countclass typeid='2′/}
The second method (provided by the genuine hand 339709):
1. Modify the include/inc_functions.php file and add the function as follows:
function GetTotalArc($tid){
$dsql = new DedeSql(false);
$row = $dsql->GetOne("Select count(ID) as dd From #@__archives where typeid='$tid'");
return $row['dd'];
}
2. Calling methods
[field:id function='GetTotalArc(@me)'/]
Original articles, please indicate the source when reprinting.