Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Show images in search override for Joomla

uzielweb May 18th, 2020 (edited) 1,097 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  <?php
  2. // go to your search override in templates/yourtemplate/html/con_search/default.php
  3. // put this code above <?php foreach ($this->results as $result) : ?>
  4.  
  5.     $article = JTable::getInstance("content");
  6.     $article->load($result->id);
  7.     preg_match('/(?<!_)src=([\'"])?(.*?)\\1/',$article->introtext.$article->fulltext, $imagematches);
  8. $imagematch = $imagematches[2];
  9. $articleImages = json_decode($article->get('images'));
  10. $articleImage =  ($articleImages->image_intro) ? $articleImages->image_intro : $articleImages->image_fulltext ;
  11. if($articleImage == ''){
  12.     $articleImage = $imagematch;
  13. }  
  14. // go to result text section, find by "result text" end change with above
  15. ?>
  16. <dd class="result-text">
  17.         <div class="row">
  18.     <?php if ($articleImage) :?>
  19.             <div class="col-sm-3">
  20.                 <img src="<?php echo $articleImage;?>" />
  21.             </div>
  22.     <?php endif;?>  
  23.             <div class="col">
  24.                 <?php echo $result->text; ?>
  25.             </div>
  26.         </div>
  27.     </dd>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top