4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: henary on December 12, 2010, 01:55:58 PM

Title: [MOD] Erweiterte suche nach cat_description und der cat_subtitel
Post by: henary on December 12, 2010, 01:55:58 PM
Hallo,

Basierend auf dieser Modifkation  http://www.4homepages.de/forum/index.php?topic=28587.0

habe mir erlaubt, die Suche zu erweitern, damit auch die cat_description und der cat_subtitel (MOD von mir http://www.4homepages.de/forum/index.php?topic=8979) durchsucht wird.

Folgendes ist ggü. dem Original von #1 zu ändern:

bei 1.) ist Anstelle Einzufügen:
//########################## Start Mod Search by Cat name ###############################
$search_catname = isset($HTTP_POST_VARS['search_catname']) ? trim($HTTP_POST_VARS['search_catname']) : trim($HTTP_GET_VARS['search_catname']);
$search_catname = un_htmlspecialchars(stripslashes(trim($search_catname)));
if (!empty($search_catname)) {
  $search_catname = str_replace('*', '%', trim($search_catname));
  $sql = "SELECT cat_id, cat_name, cat_description, cat_subtitel
          FROM ".CATEGORIES_TABLE."
          WHERE (cat_name LIKE '$search_catname') or (cat_description LIKE '$search_catname') or (cat_subtitel LIKE '$search_catname')";
  $result = $site_db->query($sql);
  $search_id['cat_ids'] = "";
  $countids= 0;
   if ($result) {
    while ($row = $site_db->fetch_array($result)) {
      $search_id['cat_ids'] .= (($search_id['cat_ids'] != "") ? ", " : "").$row['cat_id'];
      $countids++;
    }
    $site_db->free_result($result);
   }
   $show_result =1;
  }
  $site_template->register_vars(array(
  "countids" => $countids));
//########################## End Mod Search by Cat name ##################################



bei 1.6) ist Anstelle Einzufügen:
//########################## Start Mod Search by Cat name ###############################
if((!empty($search_id['cat_ids'])) && (isset($search_catname))){
  $search_categories = "";
  $sql = "SELECT  cat_id,cat_name, cat_description, cat_subtitel
          FROM  ".CATEGORIES_TABLE."
          WHERE $sql_where_query_cat
          ORDER BY cat_name ".$config['cat_sort']."
         ";
  $result = $site_db->query($sql);

  $cattable_width = ceil((intval($config['cat_table_width'])) / $config['cat_cells']);
  if ((substr($config['cat_table_width'],-1)) == "%") {
    $cattable_width .= "%";
  }
  $categories = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
  $categories .= "<tr>\n";
  $categories .= "<td class=\"head1\">\n";
  $categories .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">\n";
  $categories .= "<tr>\n";
  $categories .= "<td class=\"head1\" valign=\"top\">".$lang['categories']."</td>\n";
  $categories .= "</tr>\n";
  $categories .= "<tr>\n";
  $categories .= "<td class=\"row2\" valign=\"top\">\n";
  $categories .= "\n<table width=\"".$config['cat_table_width']."\" border=\"0\" cellpadding=\"".$config['cat_table_cellpadding']."\" cellspacing=\"".$config['cat_table_cellspacing']."\">\n";

  $count = 0;
  while ($row = $site_db->fetch_array($result)) {

    if ($count == 0) {
      $categories  .= "<tr>\n";
    }
    $categories .= "<td valign=\"top\" width=\"".$cattable_width."\" class=\"catbgcolor\">\n";

    $site_template->register_vars(array(
      "cat_id" => $row['cat_id'],
      "cat_name" => format_text($row['cat_name'], 2),
      "cat_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$row['cat_id']),
      "cat_is_new" => "",
      "num_images" => $cat_cache[$row['cat_id']]['num_images']
     ));

    $categories .= $site_template->parse_template("category_bit");
    $categories .= "</td>\n";

    $count++;
    if ($count == $config['cat_cells']) {
      $categories .= "</tr>\n";
      $count = 0;
    }
  }

  if ($count > 0)  {
    $leftover = ($config['cat_cells'] - $count);
    if ($leftover >= 1) {
      for ($i = 0; $i < $leftover; $i++) {
        $categories .= "<td width=\"".$cattable_width."\">\n&nbsp;\n</td>\n";
      }
      $categories .= "</tr>\n";
    }
  }
  $categories .= "</table>\n";
  $categories .= "</td>\n</tr>\n</table>\n</td>\n</tr>\n</table>";

  $content = $categories.$content;
   unset($categories);
}
//########################## End Mod Search by Cat name ############################


bei 2.) ist Anstelle Einzufügen:
//########################## Start Mod Search by Cat name #############################
$lang['search_by_catname']="Suche in Kategorienamen und Kategoriebeschreibungen:<br /><span class=\"smalltext\">Benutzen Sie * als Platzhalter.</span>";
$lang['search_found_cats']=" &nbsp; in <span class=\"new\">{countids}</span> Kategorie(n).";
$lang['images'] = "Bilder";
//########################## End Mod Search by Cat name ###############################


Andi, ich hoffe das geht so durch?  :wink:

Bis später & Danke nochmals für diesen MOD!
Henry