ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

changemenu JS that comes with advanced search form

March 01, 2011 8:38pm

Subscribe [4]
  • #1 / Mar 01, 2011 8:38pm

    eeart

    257 posts

    The {exp:search:advanced_form} tag generates a bunch of JavaScript code that seems unnecessary. There’s a “changemenu” function with a long list of categories, but I am not using any categories in my advanced search form.

    Is there a way to get rid of this JS?

    The main reason I am asking this is because for a long time we have been seeing the URL http://www.domain.com/!-!/g show up in Google Webmaster Tools. The only place where I can find “/!-!/g” anywhere on our website is in this function. Somehow Google is finding this thing.

    We have spent a lot of time trying to get all errors and suggestions in Webmaster Tools down to zero, and we would really like to get rid of this final /!-!/g link

    Also, the JS code is 7 Kb of text on every page that seems to be completely unnecessary.

  • #2 / Mar 02, 2011 1:00pm

    Sue Crocker

    26054 posts

    Hi, eeart. I don’t know if there is a way to get rid of this or not.. let me pose the question to the dev/testing teams. They are out of town this week though, so it may be a while before I receive a response. Thanks in advance for your patience.

  • #3 / Dec 13, 2011 11:52am

    Paul_B

    86 posts

    Hi - i ended up just hacking the core search module slightly to allow me to add an extra parameter to the advanced search form. If you wrap the following lines around line 1667 in mod.search.php, you can add a ‘disable_js=“yes”’ param to the form and lose that 7kb chunk of code.

    Line 1667 looks like this:

    $res .= $this->search_js_switcher($nested, $data['id']);

    Wrap it with this:

    if ($this->EE->TMPL->fetch_param('disable_js') != 'yes') {
       $res .= $this->search_js_switcher($nested, $data['id']);
      }

    I fully realise that this is terrible practice, but the search was otherwise performing exactly as I wanted and the big chunk of redundant inline javascript was bothering me. If EllisLab could add a param to do this as part of the core module, it would be much appreciated 😊

  • #4 / Dec 19, 2011 2:07pm

    Kevin Smith

    4784 posts

    I would definitely encourage posting this request as an official Feature Request, Paul. And like you say, we can’t exactly condone hacking the core, but I am glad you’re able to find a workaround that works for you.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases