0
Welcome Guest! Login
0 items Join Now

SOLVED: How to make search results links open in new window?

    • nemmar's Avatar
    • nemmar
    • Sr. Rocketeer
    • Posts: 221
    • Thanks: 0

    SOLVED: How to make search results links open in new window?

    Posted 12 years 10 months ago
    • Hi,

      I have a Joomla 2.5.4 site with an RT Reflex template site. I would like to know how to make the Joomla search results page (not the RokAjaxSearch) have the links open in a new window ("target=_blank" attribute).

      I found this article on the Joomla.org forums but it's old and the code in the core hack page is different in Joomla 2.5.4
      forum.joomla.org/viewtopic.php?f=473&t=327526

      My site default_results.php page has this code in it instead so I don't know where/how to edit it properly:
      <?php
      /**
       * @package     Joomla.Site
       * @subpackage  com_search
       * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
       * @license     GNU General Public License version 2 or later; see LICENSE.txt
       */
       
      // no direct access
      defined('_JEXEC') or die;
      ?>
       
      <dl class="search-results<?php echo $this->pageclass_sfx; ?>">
      <?php foreach($this->results as $result) : ?>
          <dt class="result-title">
              <?php echo $this->pagination->limitstart + $result->count.'. ';?>
              <?php if ($result->href) :?>
                  <a href="<?php echo JRoute::_($result->href); ?>"<?php if ($result->browsernav == 1) :?> target="_blank"<?php endif;?>>
                      <?php echo $this->escape($result->title);?>
                  </a>
              <?php else:?>
                  <?php echo $this->escape($result->title);?>
              <?php endif; ?>
          </dt>
          <?php if ($result->section) : ?>
              <dd class="result-category">
                  <span class="small<?php echo $this->pageclass_sfx; ?>">
                      (<?php echo $this->escape($result->section); ?>)
                  </span>
              </dd>
          <?php endif; ?>
          <dd class="result-text">
              <?php echo $result->text; ?>
          </dd>
          <?php if ($this->params->get('show_date')) : ?>
              <dd class="result-created<?php echo $this->pageclass_sfx; ?>">
                  <?php echo JText::sprintf('JGLOBAL_CREATED_DATE_ON', $result->created); ?>
              </dd>
          <?php endif; ?>
      <?php endforeach; ?>
      </dl>
       
      <div class="pagination">
          <?php echo $this->pagination->getPagesLinks(); ?>
      </div>


      - UPDATE: I solved this by editing the Reflex template search results page with the target="_blank" attribute and it works fine. Template file edited:
      Templates > rt_reflex > html > com_search > search > default_results.php
    • Last Edit: 12 years 10 months ago by nemmar.
    • NOTE to forum mods: Right-Click is disabled on my site but source code is visible. Unfortunately, I have some images on my site that are licensed and the agreement is that right-click be disabled. I use the F12 key for Firebug instead of right-click. Sorry for the inconvenience.
    • Who?'s Avatar
    • Who?
    • Preeminent Rocketeer
    • Posts: 25562
    • Thanks: 613
    • Joomla freelancer

    Re: SOLVED: How to make search results links open in new window?

    Posted 12 years 10 months ago
    • Since you are asking for a Joomla core hack, please post your question in the official Joomla forum 8)
    • Check my services at: Mihha-Vision

Time to create page: 0.044 seconds