Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6252135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:44:36+00:00 2026-05-24T13:44:36+00:00

I am trying to create a a box in a template in Joomla! that

  • 0

I am trying to create a a box in a template in Joomla! that will display all of the keywords and link them to their appropriate search page. I have a menu item set, however, I don’t want to hard-code the menu item into the template, so I want to use the JRoute object to generate the SEF url.

I am using this function:

JRoute::_('index.php?option=com_search&searchword='.$keyword);

or this:

JRoute::_('index.php?option=com_search&view=search&searchword='.$keyword);

however, this generates a url like this:

/component/search/?searchword=africa

when it ought to create a search url like this:

/searchmenuitem?searchword=africa

I have searched extensivly online and havn’t found a solution to this problem. Any ideas would be greatly appreciated.

Ok, so some additional information for you.. I am only experiencing the problem when I try and route the URL from a template in com_content. If I try and route the url from a template in com_search everything works perfectly. So, what is it about com_content that is causing this to not work properly?

thanks!
david

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:44:38+00:00Added an answer on May 24, 2026 at 1:44 pm

    In joomla administration page go to the menu item you’ve chosen for the search results page and get the id of that menu item (itemId).

    Than you can try using:

    JRoute::_('index.php?option=com_search&view=search&Itemid=256&searchword=asdsadasdsa');
    

    or even

    JRoute::_('index.php?Itemid=256&searchword=asdsadasdsa');
    

    both should result in: /searchmenuitem.html?searchword=asdsadasdsa

    EDIT:
    To make it more comforable you could add itemId as a param to your template.

    There is another way, where u can get the itemId from the database (this method is required on multilingual websites). Let me know if you want it.

    EDIT2:
    Here it is:

    $db   =& JFactory::getDBO();
    $lang =& JFactory::getLanguage()->getTag();
    $uri  = 'index.php?option=com_search&view=search';
    
    $db->setQuery('SELECT id FROM #__menu WHERE link LIKE '. $db->Quote( $uri .'%' ) .' AND language='. $db->Quote($lang) .' LIMIT 1' );
    
    $itemId = ($db->getErrorNum())? 0 : intval($db->loadResult());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a Dialog box that will display a video (quick tutorial)
I am trying to create a dialog box that will appear only if the
I am trying create a search box which will search datatables. The search box
I'm trying to create a chat box for my game. The user type's their
I'm trying create a box in my Django app that displays text (and possibly
Trying to create a box that contains sentences (with spaces) and can have a
I am trying to create this dropdown box that slides down and has the
I am trying to create a text box that grows every time a letter
I'm trying to create a box on the side of a page that displays
I am trying to create a search box to look for invoices in database.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.