コード例 #1
0
ファイル: search.php プロジェクト: kjunangle/Web-App-engineer
<?php

include 'mysql_connect.php';
include "suggestion-word.php";
if (!empty($_GET['keyword'])) {
    $result = mysql_query("SELECT * FROM product WHERE name LIKE '%" . $_GET['keyword'] . "%'");
    while ($item = mysql_fetch_object($result)) {
        $item->rating = get_review_score($item->id);
        if ($item->rating == null) {
            $item->rating = 0;
        }
        $products[] = $item;
    }
}
echo json_encode($products);
コード例 #2
0
function taqyeem_get_score($post_id = false, $size = 'small')
{
    global $post;
    if (empty($post_id)) {
        $post_id = $post->ID;
    }
    if ($size == 'large') {
        $rate_size = 'large';
    } else {
        $rate_size = 'small';
    }
    $image_style = taqyeem_get_option('rating_image');
    if (empty($image_style)) {
        $image_style = 'stars';
    }
    $summary = 0;
    $get_meta = get_post_custom($post_id);
    if (!empty($get_meta['taq_review_position'][0])) {
        $criterias = unserialize($get_meta['taq_review_criteria'][0]);
        $short_summary = $get_meta['taq_review_total'][0];
        $total_score = $get_meta['taq_review_score'][0];
        ?>
                    <?php 
        $post_ft_type = get_post_meta($post->ID, 'post_ft_type', true);
        $post_review_score = get_review_score($post->ID);
        if (!empty($post_review_score)) {
            ?>
		<div class="review-box-nr"><i class="fa fa-star"></i> <?php 
            echo $post_review_score;
        }
        ?>
</div>
	<?php 
    }
}