XPressME Integration Kit

Trac


Ignore:
Timestamp:
Dec 28, 2008, 2:28:17 AM (15 years ago)
Author:
toemon
Message:

最近の記事内容ブロック 実装
概要処理の部分と、閲覧数の部分は未完です。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/plugins/xpressme/include/custom_functions.php

    r51 r54  
    218218// Retrieves post views given a post ID or post object.  
    219219function xpress_post_views_count($post_id=0,$format= '',$show = true) { 
    220         global $table_prefix; 
     220        global $xoops_db; 
    221221 
    222222        static $post_cache_views; 
     
    230230        if($post_id==0) return null; 
    231231        if(!isset($post_cache_views[$post_id])){ 
    232         $sql = "SELECT post_views FROM " . $table_prefix . "views" . " WHERE post_id=$post_id"; 
    233         if (!$result = $GLOBALS["xoopsDB"]->query($sql)) { 
     232        $sql = "SELECT post_views FROM " . get_xoops_prefix() . "views" . " WHERE post_id=$post_id"; 
     233        $post_views = $xoops_db->get_var($sql); 
     234        if (!$post_views) { 
    234235                $post_cache_views[$post_id] = 0; 
    235236        }else{ 
    236                 $row = $GLOBALS["xoopsDB"]->fetchArray($result); 
    237                 $post_cache_views[$post_id] = $row["post_views"]; 
     237                $post_cache_views[$post_id] = $post_views; 
    238238        } 
    239239        } 
Note: See TracChangeset for help on using the changeset viewer.