.:. article count / anzahl der db einträge - any suggestions

Use GitHub to post feature requests for phpwcms.
Locked
User avatar
lady_witchcraft
Posts: 94
Joined: Sun 14. Nov 2004, 19:19
Location: Austria
Contact:

.:. article count / anzahl der db einträge - any suggestions

Post by lady_witchcraft »

hy guys :lol:

searched the forum but i can't find anything about counting db records... any suggestions or hints?! i'd like to display the number of total articles in DB on my page http://rezepte.kultschmiede.org

thx in advance and greets from "snowy" austria :D
-------------------------------------------------------------------------

servus ihr lieben :lol:

habe lange im forum gesucht, finde aber leider nichts zB replacement tag um die anzahl der DB-records auszugeben - irgenwelche vorschläge, tipps oder hinweise?! würde nämlich gerne sowas in die richtung "derzeit sind xxxx beiträge erfasst!" auf meiner seite ausgeben http://rezepte.kultschmiede.org

herzlichen dank im voraus und grüsse aus dem verschneiten österreich :D
... it's not bad luck, it's a bug ...
brans

Post by brans »

create
phpwcms_template/inc_script/frontend_render/reptag_article_count.php
and insert

Code: Select all

function count_articles_in_db() { 
$count = '';
 if (!$count) {
   $sql  = "SELECT count(*) FROM ".DB_PREPEND."phpwcms_article ";
   $sql .= "WHERE article_public=1 AND article_aktiv=1 AND article_deleted=0 ";
   $sql .= "AND article_begin<=NOW() AND article_end>=NOW() ";  
   $result = mysql_query($sql, $dbcon);
   $count = mysql_result($result, 0, 0);     
   mysql_free_result($result);
} 
return $count 
}
if( ! (strpos($content["all"],'{ARTICLE_COUNT}')===false)) {
      $content["all"] = str_replace('{ARTICLE_COUNT}', count_articles_in_db(), $content["all"]);
}
will count all articles that are:
- public
- active
- whose start date is </= now
- whose end date is >/= now
- that are not set to "deleted"
Locked