OSDN Git Service

Themlerテンプレート対応。一覧のサムネール画像表示可能にする。
authornaoki hirata <naoki@magic3.org>
Tue, 27 Oct 2015 09:53:50 +0000 (18:53 +0900)
committernaoki hirata <naoki@magic3.org>
Tue, 27 Oct 2015 09:53:50 +0000 (18:53 +0900)
include/mos/JRender.php
widgets/custom_search/include/container/custom_searchWidgetContainer.php

index 6106b31..a25ab48 100644 (file)
@@ -364,6 +364,16 @@ $this->item->title = '****';*/
                                        $contentViewInfo->set('link_titles', 1);                // タイトルにリンクを付加(タイトルのリンク作成用)
                                        $contentViewInfo->set('access-view', 1);                // (タイトルのリンク作成用)
                                        //$contentItem->catslug = '';                   // カテゴリーID
+                                       
+                                       // サムネール画像(intro,fulltext)
+                                       if (!empty($contentItem->thumbUrl)){            // サムネールのURLが設定されている場合
+                                               $images = array();
+                                               $images['image_intro'] = $contentItem->thumbUrl;
+                                               $images['float_intro'] = 'left';
+                                               $images['image_intro_caption'] = '';
+                                               $images['image_intro_alt'] = $contentItem->thumbAlt;
+                                               $contentItem->images = json_encode($images);
+                                       }
                                }
                                
                                $this->lead_items = array();
index 6c94a07..fa41bed 100644 (file)
@@ -593,7 +593,7 @@ class custom_searchWidgetContainer extends BaseWidgetContainer
 
                // 画像
                $imageTag = '';
-               if ($this->showImage && !empty($imageUrl)){
+               if ($this->showImage && !empty($imageUrl)){     // サムネール画像を表示する場合
                        $style = '';
                        if ($this->imageWidth > 0) $style .= 'width:' . $this->imageWidth . 'px;';
                        if ($this->imageHeight > 0) $style .= 'height:' . $this->imageHeight . 'px;';
@@ -630,7 +630,11 @@ class custom_searchWidgetContainer extends BaseWidgetContainer
                $viewItem->text                 = $viewItem->introtext; // コンテンツ内容(Joomla!1.5テンプレート用)
                $viewItem->state                = 1;                    // 表示モード(0=新着,1=表示済み)
                $viewItem->url                  = $linkUrl;                                             // リンク先。viewItem->urlはMagic3の拡張値。
-
+               if ($this->showImage && !empty($imageUrl)){     // サムネール画像を表示する場合
+                       $viewItem->thumbUrl     = $imageUrl;
+                       $viewItem->thumbAlt     = $title;
+               }
+               
 //             // 以下は表示する項目のみ値を設定する
 //             if ($this->showEntryAuthor) $viewItem->author           = $author;              // 投稿者
 //             if ($this->showEntryRegistDt) $viewItem->published      = $date;                // 投稿日時