
今週は何となく新着情報ブロックに目を向けてみました。
これもうまく使えば簡易ブログのように使えるし、ちょっともったいない感じです。
ただEC-CUBE本体にこれが必要かと言われると微妙だし、
プラグイン機能ができたらそっちで開発するかーという感じで、置き去りにされたのかなと推測します。
まぁ、当面はこのまま本体の付属機能として存続すると思いますので、PC版の新着情報ページなんぞを考えてみました。
1.管理画面>デザイン管理>PC>レイアウト設定 から、「ページを新規入力」ボタンを押す。情報は以下の通り。
名称: 新着情報
URL: http://********/user_data/news.php
共通のヘッダーを使用&共通のフッターを使用
2.以下のようなコードを貼り付けてから、「登録」ボタンを押して、ページを新規作成する。
<!--{*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*}-->
<div id="undercolumn">
<div id="news_area">
<h2>新着情報</h2>
<!--{section name=data loop=$arrNews}-->
<!--{assign var="date_array" value="-"|explode:$arrNews[data].news_date_disp}-->
<dl class="newslist">
<dt><!--{$date_array[0]}-->年<!--{$date_array[1]}-->月<!--{$date_array[2]}-->日</dt>
<dt>
<a
<!--{if $arrNews[data].news_url}--> href="<!--{$arrNews[data].news_url}-->" <!--{if $arrNews[data].link_method eq "2"}--> target="_blank"
<!--{/if}-->
<!--{/if}-->
>
<!--{$arrNews[data].news_title|h|nl2br}--></a>
</dt>
<dd class="mini"><!--{$arrNews[data].news_comment|nl2br}--></dd>
</dl>
<!--{/section}-->
</div>
</div>
3.html/user_data/news.php をエディタで開いて、Actionファンクション内にコードを以下のように挿入。
/**
* Page のアクション.
*
* @return void
*/
function action() {
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = '*, cast(news_date as date) as news_date_disp';
$table = 'dtb_news';
$where = 'del_flg = 0';
$objQuery->setOrder('rank desc');
$this->arrNews = $objQuery->select($col, $table);
}
4.ブラウザから html/user_data/news.php を表示させて、管理画面>コンテンツ管理>新着情報管理 の内容が表示されていることを確認する。











