| Displaying the Joomla Search Results Page with the Correct Template and Modules |
| Wednesday, 05 January 2011 15:19 |
|
Recently, we built a website that had one template for the home page, and a second template for every other page on the website. We used Joomla's core search functionality for the search on the website. The search module displays on every page of the website. There was no link from the menu to the search page. When you searched for something on an inside page, the inside page template loaded for the search results page. Everything worked great! But if you used the search on the home page, the home page template loaded for the search results page instead. It really looked awful, because the home page template was not designed for a long content area, the way the inside page template was designed. What to do? Turns out there's a very simple solution. First of all, create a hidden menu. This is a menu that exists in Joomla, but it is not displayed on the website, because the module for that menu is not published (or it doesn't exist). Now, create a search page on the hidden menu. In the Menu Manager for the hidden menu, click New, and then pick Search from the list of menu item types. Configure the search results page. Save this new menu item. Assign modules for the page, if needed, in the Module Manager. You could also assign a specific template to this page if required, if the template you wanted to use was not the default template for the site. Otherwise, the default template would be used to display this page. And that's it!!! Joomla is smart enough to use this menu item as the display page for search results, when the search is run from any page of the website. This should get your search results displaying in the correct template, with the correct modules. Thanks to Grumpy Bill Tomczak for the tip! Jen Kramer is the president of 4Web, a New England based consultancy specializing in highly customized Joomla websites. Jen has authored many lynda.com instructional videos and written a book on the topic. |
If you want Joomla training delivered to the comfort of your own home, then you need to join Joomlashack University - an affordable online Joomla training course taught by the world's leading experts in Joomla education.