3

Web サイトで Joomla Smart Search を使用しています。記事のイントロ画像といくつかの追加フィールドを検索結果に表示したいと考えています。

Joomla Smart Search は html タグを削除するので、この余分なフィールドを削除したい

4

4 に答える 4

2

www\plugins\finder\contentcontent.php を開き、 getListQuery検索 し、最後に->select list add ->select('a.images AS image');を追加します。ファイルを保存して閉じる

www\components\com_finder\views\search\tmplでdefault_result.phpを開き、タグの後にclass="result-title を検索して、次の行を追加します。

<?php $image=json_decode($this->result->image); ?>
<?php $aimage=$image->image_intro; ?>   
<div class="search-img">
<a href="<?php echo JRoute::_($route); ?>">
<img src="/<?php echo $aimage; ?>" >
</a>
</div>

保存して閉じる

スマート検索をパージして再インデックス化することを忘れないでください

于 2014-08-25T13:44:05.073 に答える
0

実はとても簡単な解決策があります。K2 は ID の md5 ハッシュに基づいて画像を保存します。

これを追加:

<div class="search-img">
<img src="<?php echo JURI::base().'media/k2/items/cache/'.md5("Image".$this->result->id).'_M.jpg'; ?>" />
</div>

default_result.php の html オーバーライドに対応する k2 アイテムが表示されます (ここでは中解像度)。

于 2015-07-23T01:38:49.153 に答える
0

解決策を見つけました。絶対に望んでいたわけではありませんが、うまくいきます。ソリューションは、検索結果の記事の「続きを読む」内のイントロテキストとすべて (画像、リンク、および必要なものすべて) を表示します。

このソリューションはhttp://forum.joomla.org/viewtopic.php?p=2324152で見つかり、次のように述べています。

"You'll need to create a layout override for the components/com_finder/views/search /tmpl/default_result.php layout file using the steps described at http://docs.joomla.org/Understanding_Output_Overrides Once you've created the layout override, you should change"

<?php echo JHtml::_('string.truncate', $this->result->description, $this->params->get('description_length', 255)); ?>

in the layout file to:

<?php echo $this->result->summary; ?>

The location should be templates/template_name/html/com_finder/search/default_result.php

于 2013-05-20T12:35:31.507 に答える