The MU forums have moved to WordPress.org

Search not working for a non-VHOSt installation? (9 posts)

  1. debrouille
    Member
    Posted 18 years ago #

    Hello,

    i cant' get the search function working for both the main blog (the goal is to search over all blogs) and in each blog (goal: search within posts of the blog where the search is performed)
    In both case i get the

    "Fatal Error
    Could Not Find Blog!
    etc.."
    error.

    Anybody having this work for a non-VHOST installation?

    Thanks for any hint...

    PS: i;m NOT looking for an external search service like google, the search should be performed within the server...

  2. andrea_r
    Moderator
    Posted 18 years ago #

    Got a link?

  3. drmike
    Member
    Posted 18 years ago #

    Which search function are we talking about anyway?

    Doesn't that error also lead you to a page that suggests a list of question you should answer so we can help you?

  4. dsader
    Member
    Posted 18 years ago #

    debrouille, time to edit your sidebars/widgets(wherever you find a searchform):

    find:
    <form method="get" id="searchform" action="<?php echo $_SERVER['PHP_SELF']; ?>">

    and change to:
    <form method="get" id="searchform" action="<?php echo get_bloginfo('url'), $_SERVER['PHP_SELF']; ?>">

    I call this my "searchform hack" and is always a must do when "massaging" new themes.

    If you use widgets, don't forget the search widget buried in widgets.php.

    D. Sader

  5. mrjcleaver
    Member
    Posted 18 years ago #

    I don't understand. Do you mean that without this hack it searches across all blogs on the site, but that this creates a per-blog search?

  6. dsader
    Member
    Posted 18 years ago #

    No. To search across all blogs, I use a google widget.(gsearch.php widget).

    The search of the home blog is a search function built into whatever theme you build your home upon and will only search the home blog. Ditto for each blog.

    However, as a non-vhost, I must edit each and every theme, including the home theme, as above, to enable searchforms built into the theme. The hack enables the searchform to search posts/comments/pages in the blog. Without the hack, every search on any blogs lands on the home blog with an I can't find your blog error.

  7. mrjcleaver
    Member
    Posted 18 years ago #

    So, is there a case where this code may be usefully be included in wpmu?

  8. dsader
    Member
    Posted 18 years ago #

    This "hack" is for themes, addons. The code needed to fix wpmu so searchform actions work in vhost and non-vhost would be something else in wpmu core files. That I don't know how to do.

  9. debrouille
    Member
    Posted 18 years ago #

    Thank you dsader, your hack
    replace:
    <form method="get" id="searchform" action="<?php echo $_SERVER['PHP_SELF']; ?>">

    by:
    <form method="get" id="searchform" action="<?php echo get_bloginfo('url'), $_SERVER['PHP_SELF']; ?>">

    worked! After i sorrected it a little bit: should be
    <form method="get" id="searchform" action="<?php echo get_bloginfo('url'); ?>">

    But i'm still looking for a solution to search sidewide (across all blogs)... ans i still don't want a google widget ;-)

About this Topic

  • Started 18 years ago by debrouille
  • Latest reply from debrouille