1

I have inserted the Joomla search module in an article.

Now I wish that this module would allow me to search only in the article in which it is present and not throughout the site!

Is it possible?

  • What sort of results are you expecting the search module to show when used if it's only for 1 article? – Lodder Apr 20 '15 at 9:33
  • I have to search only within a site Faqs! ok? – Valentino Piolanti Apr 20 '15 at 9:47
1

No, it is not possible. Joomla "Search module" search through content areas in CMS database. It does not search in a published article, on the browser side.

1

No, the Joomla search module will not work to search within a single article. But there are several ways you can make your FAQ more user friendly, depending on how complex it is. Here's a couple of ideas:

  1. Tell the users to press Ctrl + F (or simply F3) to open the in-page search box to search on the current page. This works on all browsers (as far as I know).
  2. Implement a in-page search box using JavaScript. I found the following code that should work, although it's quite old (the site talks about Netscape, a browser from the era of the dinosaurs...):

    var TRange=null;
    
    function findString (str) {
     if (parseInt(navigator.appVersion)<4) return;
     var strFound;
     if (window.find) {
    
      // CODE FOR BROWSERS THAT SUPPORT window.find
    
      strFound=self.find(str);
      if (!strFound) {
       strFound=self.find(str,0,1);
       while (self.find(str,0,1)) continue;
      }
    }
     else if (navigator.appName.indexOf("Microsoft")!=-1) {
    
      // EXPLORER-SPECIFIC CODE
    
      if (TRange!=null) {
       TRange.collapse(false);
       strFound=TRange.findText(str);
       if (strFound) TRange.select();
      }
      if (TRange==null || strFound==0) {
       TRange=self.document.body.createTextRange();
       strFound=TRange.findText(str);
       if (strFound) TRange.select();
    }
     }
     else if (navigator.appName=="Opera") {
      alert ("Opera browsers not supported, sorry...")
      return;
     }
     if (!strFound) alert ("String '"+str+"' not found!")
     return;
    }
    
  3. Use a knowledgebase extension that has built-in search function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.