source: branches/version-2_11-dev/data/Smarty/templates/sphone/frontparts/bloc/news.tpl @ 21050

Revision 21050, 5.2 KB checked in by 468, 13 years ago (diff)

#1413 スマートフォン版テンプレートファイル変更(HTML5対応)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-smarty-template; charset=UTF-8
Line 
1<!--{*
2 * This file is part of EC-CUBE
3 *
4 * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
5 *
6 * http://www.lockon.co.jp/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 *}-->
22<!-- ▼新着情報 -->
23
24<section id="news_area">
25<h2 class="title_block">新着情報</h2>
26<ul class="newslist">
27  <!--{section name=data loop=$arrNews max=3}-->
28  <li>
29    <a #windowcolumn href="javascript:getNewsDetail(<!--{$arrNews[data].news_id}-->);">
30    <span class="news_title"><!--{$arrNews[data].news_title|h}--></span></a><br />
31    <span class="news_date"><!--{$arrNews[data].news_date_disp|date_format:"%Y年 %m月 %d日"}--></span>
32  </li>
33  </a>
34  <!--{/section}-->
35</ul>
36
37<!--{if $newsCount > 3}-->
38<div class="btn_area">
39<p><a href="javascript: void(0);" class="btn_more" id="btn_more_news" onClick="getNews(3); return false;">もっとみる(+3件)</a></p>
40</div>
41<!--{/if}-->
42</section>
43<!-- ▲新着情報 -->
44
45
46<script>
47var newsPageNo = 2;
48
49function getNews(limit) {
50    $.mobile.pageLoading();
51    var i = limit;
52   
53    $.ajax({
54        url: "<!--{$smarty.const.HTTP_URL}-->frontparts/bloc/news.php",
55        type: "POST",
56           data: "mode=getList&pageno="+newsPageNo+"&disp_number="+i,
57           cache: false,
58           dataType: "json",
59           error: function(XMLHttpRequest, textStatus, errorThrown){
60            alert(textStatus);
61            $.mobile.pageLoading(true);
62           },
63           success: function(result){
64             for (var j = 0; j < i; j++) {
65                 if (result[j] != null) {
66                    var news = result[j];
67                    var maxCnt = $("#news_area ul.newslist li").length - 1;
68                    var newsEl = $("#news_area ul.newslist li").get(maxCnt);
69                    newsEl = $(newsEl).clone(true).insertAfter(newsEl);
70                    maxCnt++;
71                   
72                     //件名をセット
73                     $($("#news_area ul.newslist li a span.news_title").get(maxCnt)).text(news.news_title);
74                     
75                     //リンクをセット
76                     $($("#news_area ul.newslist li a").get(maxCnt)).attr("href", "javascript:getNewsDetail(" + news.news_id + ");");
77                     
78                     //年月をセット
79                     var newsDateDispArray = news.news_date_disp.split("-"); //ハイフンで年月日を分解
80                     var newsDateDisp = newsDateDispArray[0] + "年 " + newsDateDispArray[1] + "月 " + newsDateDispArray[2] + "日";
81                     $($("#news_area ul.newslist li span.news_date").get(maxCnt)).text(newsDateDisp);
82                 }
83             }
84
85             //すべての新着情報を表示したか判定
86             var newsPageCount = result.news_page_count;
87             if (parseInt(newsPageCount) <= newsPageNo) {
88                 $("#btn_more_news").hide();
89             }
90             
91             newsPageNo++;
92             
93             $.mobile.pageLoading(true);
94           }
95    });
96}
97
98function getNewsDetail(newsId) {
99    $.mobile.pageLoading();
100    $.ajax({
101        url: "<!--{$smarty.const.HTTP_URL}-->frontparts/bloc/news.php",
102        type: "GET",
103           data: "mode=getDetail&news_id="+newsId,
104           cache: false,
105           dataType: "json",
106           error: function(XMLHttpRequest, textStatus, errorThrown){
107               alert(textStatus);
108               $.mobile.pageLoading(true);
109           },
110           success: function(result){
111             if (result[0] != null) {
112                 var news = result[0];
113                var maxCnt = 0;
114               
115                 //件名をセット
116                 $($("#windowcolumn dl.view_detail dt a").get(maxCnt)).text(news.news_title);
117                 if (news.news_url != null) {
118                     $($("#windowcolumn dl.view_detail dt a").get(maxCnt)).attr("href", news.news_url);
119                 } else {
120                     $($("#windowcolumn dl.view_detail dt a").get(maxCnt)).attr("href", "#");
121                 }
122                 
123                 //年月をセット
124                 //var newsDateDispArray = news.news_date_disp.split("-"); //ハイフンで年月日を分解
125                 //var newsDateDisp = newsDateDispArray[0] + "年 " + newsDateDispArray[1] + "月 " + newsDateDispArray[2] + "日";
126                 //$($("#windowcolumn dl.view_detail dt").get(maxCnt)).text(newsDateDisp);
127
128                //コメントをセット
129                 $("#newsComment").text(news.news_comment);
130             }
131             
132             $.mobile.pageLoading(true);
133             $.mobile.changePage('#windowcolumn', 'slideup');
134           }
135    });
136}
137</script>
Note: See TracBrowser for help on using the repository browser.