开发者

How to modify Joomla default search module?

开发者 https://www.devze.com 2022-12-17 13:47 出处:网络
I want to remove the label \"Search\" in Joomla search module (default search module). I have modified the default_form.php from the directory /joomla15/components/com_search/views/search/tmpl/

I want to remove the label "Search" in Joomla search module (default search module). I have modified the default_form.php from the directory /joomla15/components/com_search/views/search/tmpl/ and even removed the following code but it makes no difference on开发者_如何学JAVA the site:

<label for="search_searchword">
    <?php echo JText::_( 'Search Keyword' ); ?>:
</label>

Actually i am using an image button for the Search and I dont want the label to be displayed. What should I do to remove it?


You shouldn't be hacking Joomla Core Files. If you want to change a view from a component, you should use Template Overrides.

Second, if you're modifying your search component, you have to remember that the extensions in Joomla are divided in "Components", "Plugins" and "Modules". Every module is an extension, but not every extension is a module. It's a little different from other CMS's you may be used to.

That's why you can't change your search "module". You're searching for it's templates in components folder when you should be looking into "modules" folder as well.

There's a search module, that appears in all pages. This module is in JOOMA_PATH/modules/mod_search/tmpl/default.php, and you should be copying it to JOOMA_PATH/templates/TEMPLATE_NAME/html/mod_search/default.php to add your modifications. This is way, when updating your Joomla installation, you're not going to lose your customizations.


I never used Joomla! so I just guess but maybe there's some kind of template cache? Try to clear it.

But what you're trying to do is a very bad practice. This label makes your forms more available (for screen readers etc.). Don't try to remove this element - just hide it using CSS:

#mySearchForm label {
    display: none;
}


Search module ---> basic options---> box label (type 1 or two space, then the "search..." will disappear)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号