コード例 #1
0
ファイル: sidebar.php プロジェクト: 29-takahashi/kadai
<div class="col-xs-12 col-sm-3 text-center">
	<h2>Popularity</h2>
	<?php 
sidebar();
//sidebarランキング関数呼び出し
foreach ($results as $row) {
    h_insert($row);
    //変数代入関数呼び出し
    echo '<a href="news.php?id=' . $news_id . '">';
    echo '<div class="htumbnail text-center">';
    echo '<img src="img/' . $img . '" height="100" width="150" class="img-rounded">';
    echo '<div class="caption">';
    category_icon($category_id);
    //カテゴリーアイコン表示関数呼び出し
    echo '<p>' . $news_title . '</p></div></div></a>';
}
?>
</div>
コード例 #2
0
ファイル: func.php プロジェクト: 29-takahashi/kadai
function news_view()
{
    global $results, $update_date, $news_id, $news_title, $news_detail, $category_id, $category_name, $img, $alt;
    if (isset($_GET["id"])) {
        $news_id = $_GET["id"];
        //人気記事カウントアップ
        $sql = "INSERT INTO click_count(count_id,news_id, click_date) VALUES (NULL, '" . $news_id . "', sysdate())";
        db_start($sql);
        //記事詳細表示
        $sql = "SELECT * FROM news,category,img where news.news_id = {$news_id} AND show_flg = 1 AND news.category_id = category.category_id AND news.news_id = img.news_id";
        //db関数呼び出し
        db_start($sql);
        echo '<div class="col-xs-12 col-sm-9">';
        foreach ($results as $row) {
            //変数代入関数呼び出し
            h_insert($row);
            echo '<div class="thumbnail"><img class="img-responsive" src="img/' . $img . '"><div class="caption"><h2>' . $news_title . '</h2><p>';
            echo date('Y/m/d', strtotime($update_date));
            category_icon($category_id);
            echo '</p><p class="kiji">' . $news_detail . '</p></div></div>';
            echo '<div class="text-right"><a href="news.php"><button class="btn btn-default">ニュース一覧</button></a></div>';
        }
        echo '</div>';
    } else {
        $sql = "SELECT * FROM news,category,img where show_flg = 1 AND news.category_id = category.category_id AND news.news_id = img.news_id";
        db_start($sql);
        echo '<div class="col-xs-12 col-sm-9">';
        foreach ($results as $row) {
            //変数代入関数呼び出し
            h_insert($row);
            echo '<a href="news.php?id=' . $news_id . '"><div class="thumbnail"><img width="250" height="150" src="img/' . $img . '">';
            echo '<div class="caption"><h2>';
            echo mb_substr($news_title, 0, 50) . '</h2><p>';
            echo date('Y/m/d', strtotime($update_date));
            category_icon($category_id);
            echo '</p></div></div></a>';
        }
        echo '</div>';
    }
    $pdo = null;
}