[Phpslash-commit] CVS: phpslash-ft/public_html search.php3,1.44,1.45
Brought to you by:
joestewart,
nhruby
From: Ajay S. <aja...@us...> - 2002-03-17 01:00:11
|
Update of /cvsroot/phpslash/phpslash-ft/public_html In directory usw-pr-cvs1:/tmp/cvs-serv27567/public_html Modified Files: search.php3 Log Message: fixed bugs in search.php3 and it only uses ONE template file instead of five now Index: search.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/search.php3,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** search.php3 6 Mar 2002 04:29:54 -0000 1.44 --- search.php3 17 Mar 2002 01:00:08 -0000 1.45 *************** *** 49,55 **** $db->query($q); $db->next_record(); ! $topic_image_name = $db->Record["image"]; ! $topic_image_width = $db->Record["width"]; ! $topic_image_height = $db->Record["height"]; return ""; --- 49,55 ---- $db->query($q); $db->next_record(); ! $topic_image_name = $db->f('image'); ! $topic_image_width = $db->f('width'); ! $topic_image_height = $db->f('height'); return ""; *************** *** 67,74 **** $db->query($q); $db->next_record(); ! $topic_image_name = $db->Record["image"]; ! $topic_image_width = $db->Record["width"]; ! $topic_image_height = $db->Record["height"]; ! return $db->Record["topic_id"]; } --- 67,74 ---- $db->query($q); $db->next_record(); ! $topic_image_name = $db->f('image'); ! $topic_image_width = $db->f('width'); ! $topic_image_height = $db->f('height'); ! return $db->f('topic_id'); } *************** *** 84,91 **** $db->query($q); $db->next_record(); ! $topic_image_name = $db->Record["image"]; ! $topic_image_width = $db->Record["width"]; ! $topic_image_height = $db->Record["height"]; ! return $db->Record["topic_id"]; } } --- 84,91 ---- $db->query($q); $db->next_record(); ! $topic_image_name = $db->f('image'); ! $topic_image_width = $db->f('width'); ! $topic_image_height = $db->f('height'); ! return $db->f('topic_id'); } } *************** *** 101,105 **** $db->query($q); $db->next_record(); ! return $db->Record["section_id"]; } } else { --- 101,105 ---- $db->query($q); $db->next_record(); ! return $db->f('section_id'); } } else { *************** *** 118,122 **** $db->query($q); $db->next_record(); ! return $db->Record["author_id"]; } } else { --- 118,122 ---- $db->query($q); $db->next_record(); ! return $db->f('author_id'); } } else { *************** *** 136,141 **** /*************/ ! $sl_q = new slashDB; ! $sl_q->debug = false; /*************PAGE START*******************/ --- 136,141 ---- /*************/ ! $db = new slashDB; ! $db->debug = false; /*************PAGE START*******************/ *************** *** 182,186 **** $templ->parse ("topic_block", "each_topic", true); ! $sl_q->query ("SELECT DISTINCT psl_topic.topic_id, topic_name FROM psl_topic, psl_topic_lut --- 182,186 ---- $templ->parse ("topic_block", "each_topic", true); ! $db->query ("SELECT DISTINCT psl_topic.topic_id, topic_name FROM psl_topic, psl_topic_lut *************** *** 188,198 **** ORDER BY topic_name"); ! while ($sl_q->next_record()) { $templ->set_var (array ( ! 'TOPIC_VALUE' => $sl_q->Record['topic_id'], ! 'TOPIC_TEXT' => $sl_q->Record['topic_name'] )); ! if ($search_topic_id == $sl_q->Record['topic_id']) { $templ->set_var ('TOPIC_SELECTED', "selected=\"selected\""); } else { --- 188,198 ---- ORDER BY topic_name"); ! while ($db->next_record()) { $templ->set_var (array ( ! 'TOPIC_VALUE' => $db->f('topic_id'), ! 'TOPIC_TEXT' => $db->f('topic_name') )); ! if ($search_topic_id == $db->f('topic_id')) { $templ->set_var ('TOPIC_SELECTED', "selected=\"selected\""); } else { *************** *** 216,220 **** $templ->parse ("section_block", "each_section", true); ! $sl_q->query ("SELECT DISTINCT psl_section.section_id, section_name FROM psl_section,psl_section_lut --- 216,220 ---- $templ->parse ("section_block", "each_section", true); ! $db->query ("SELECT DISTINCT psl_section.section_id, section_name FROM psl_section,psl_section_lut *************** *** 222,232 **** ORDER BY section_name"); ! while ($sl_q->next_record()) { $templ->set_var (array ( ! 'SECTION_VALUE' => $sl_q->Record['section_id'], ! 'SECTION_TEXT' => $sl_q->Record['section_name'] )); ! if ($search_section_id == $sl_q->Record['section_id']) { $templ->set_var ('SECTION_SELECTED', "selected=\"selected\""); } else { --- 222,232 ---- ORDER BY section_name"); ! while ($db->next_record()) { $templ->set_var (array ( ! 'SECTION_VALUE' => $db->f('section_id'), ! 'SECTION_TEXT' => $db->f('section_name') )); ! if ($search_section_id == $db->f('section_id')) { $templ->set_var ('SECTION_SELECTED', "selected=\"selected\""); } else { *************** *** 250,254 **** $templ->parse ("author_block", "each_author", true); ! $sl_q->query ("SELECT DISTINCT psl_author.author_id, author_name FROM psl_author, psl_story --- 250,254 ---- $templ->parse ("author_block", "each_author", true); ! $db->query ("SELECT DISTINCT psl_author.author_id, author_name FROM psl_author, psl_story *************** *** 256,266 **** ORDER BY author_id"); ! while ($sl_q->next_record()) { $templ->set_var (array ( ! 'AUTHOR_VALUE' => $sl_q->Record['author_id'], ! 'AUTHOR_TEXT' => $sl_q->Record['author_name'] )); ! if ($search_author_id == $sl_q->Record['author_id']) { $templ->set_var ('AUTHOR_SELECTED', "selected=\"selected\""); } else { --- 256,266 ---- ORDER BY author_id"); ! while ($db->next_record()) { $templ->set_var (array ( ! 'AUTHOR_VALUE' => $db->f('author_id'), ! 'AUTHOR_TEXT' => $db->f('author_name') )); ! if ($search_author_id == $db->f('author_id')) { $templ->set_var ('AUTHOR_SELECTED', "selected=\"selected\""); } else { *************** *** 278,296 **** $prev = $min - $maxsearchresults; if ($prev >= 0) { ! $templ->set_file (previous_matches_file, "searchPrevMatches.tpl"); ! $templ->parse (previous_matches, previous_matches_file); ! // TODO make use $_PSL['phpself'] ! $prev_matches_url = "$PHP_SELF?min=" . ($min - $maxsearchresults); /* Only put the necessary stuff on the query URL */ if ($query != "") $prev_matches_url .= "&query=$query"; ! if ($topic != "") ! $prev_matches_url .= "&topic_id=$topic"; ! if ($section != "") ! $prev_matches_url .= "&section_id=$section"; ! if ($author != "") ! $prev_matches_url .= "&author_id=$author"; $templ->set_var (array ( --- 278,298 ---- $prev = $min - $maxsearchresults; + $templ->set_block('searchpage','previous_match'); + $templ->set_block('searchpage','next_match'); + $templ->set_block('searchpage','no_match'); + if ($prev >= 0) { ! ! $prev_matches_url = $_PSL['phpself'] . "?min=" . ($min - $maxsearchresults); /* Only put the necessary stuff on the query URL */ if ($query != "") $prev_matches_url .= "&query=$query"; ! if ($search_topic_id != "") ! $prev_matches_url .= "&topic_id=$search_topic_id"; ! if ($search_section_id != "") ! $prev_matches_url .= "&section_id=$search_section_id"; ! if ($search_author_id != "") ! $prev_matches_url .= "&author_id=$search_author_id"; $templ->set_var (array ( *************** *** 298,303 **** 'PREV_COUNT' => $min )); ! $templ->parse ('MATCHES', 'previous_matches', true); ! } $q = "SELECT DISTINCT story.story_id, --- 300,308 ---- 'PREV_COUNT' => $min )); ! # $templ->parse ('searchpage', 'previous_match',true); ! ! } else { ! $templ->set_var('previous_match',''); ! } $q = "SELECT DISTINCT story.story_id, *************** *** 365,387 **** $q .= "\n ORDER BY story.time DESC LIMIT $min,$maxsearchresults"; ! # echo "<FONT SIZE=2><PRE>$q</PRE></FONT><BR>\n"; ! $sl_q->query ($q); ! /* Should we use num_rows() or sql COUNT? --Daniel Serodio */ ! if ($sl_q->num_rows() != 0) { ! $templ->set_file ('listed_matches', "searchMatch.tpl"); ! $templ->set_block ("listed_matches", "each_match", "match_block"); $shown_matches = 0; ! while ($sl_q->next_record ()) { $templ->set_var (array ( ! 'STORY_URL' => $_PSL['rooturl'] . "/article.php3?story_id=".$sl_q->Record['story_id'], ! 'STORY_TITLE' => $sl_q->Record['title'], ! 'AUTHOR_URL' => str_html($sl_q->Record['url']), ! 'AUTHOR_NAME' => $sl_q->Record['author_name'], ! 'DATE' => $sl_q->Record['dateformat'], ! 'COMMENTCOUNT' => $sl_q->Record['commentcount'] )); $templ->parse ("match_block", "each_match", true); --- 370,392 ---- $q .= "\n ORDER BY story.time DESC LIMIT $min,$maxsearchresults"; ! // echo "<FONT SIZE=2><PRE>$q</PRE></FONT><BR>\n"; ! $db->query ($q); ! $templ->set_block ("searchpage", "each_match", "match_block"); ! ! if ($db->num_rows() != 0) { $shown_matches = 0; + $templ->set_var('no_match',''); ! while ($db->next_record ()) { $templ->set_var (array ( ! 'STORY_URL' => $_PSL['rooturl'] . "/article.php3?story_id=" . $db->f('story_id'), ! 'STORY_TITLE' => $db->f('title'), ! 'AUTHOR_URL' => str_html($db->f('url')), ! 'AUTHOR_NAME' => $db->f('author_name'), ! 'DATE' => $db->f('dateformat'), ! 'COMMENTCOUNT' => $db->f('commentcount') )); $templ->parse ("match_block", "each_match", true); *************** *** 393,398 **** $min += $maxsearchresults; - $templ->set_file ('more_matches_file', "searchMoreMatches.tpl"); - $templ->parse ('more_matches', 'more_matches_file'); $more_matches_url = $_PSL['phpself']."?min=$min"; --- 398,401 ---- *************** *** 400,422 **** if ($query != "") $more_matches_url .= "&query=$query"; ! if ($topic != "") $more_matches_url .= "&topic_id=$topic_id"; ! if ($section != "") $more_matches_url .= "&section_id=$section_id"; ! if ($author != "") $more_matches_url .= "&author_id=$author_id"; $templ->set_var ('MORE_MATCHES_URL', $more_matches_url); ! $templ->parse ('MATCHES', 'listed_matches', true); ! $templ->parse ('MATCHES', 'more_matches', true); } else { ! $templ->parse ('MATCHES', 'listed_matches', true); } } else { // num_rows == 0 ! $templ->set_file ('no_matches', "searchNoMatch.tpl"); ! $templ->parse ('MATCHES', 'no_matches'); ! } $templ->pparse ("OUT", "searchpage"); --- 403,428 ---- if ($query != "") $more_matches_url .= "&query=$query"; ! if ($search_topic_id != "") $more_matches_url .= "&topic_id=$topic_id"; ! if ($search_section_id != "") $more_matches_url .= "&section_id=$section_id"; ! if ($search_author_id != "") $more_matches_url .= "&author_id=$author_id"; $templ->set_var ('MORE_MATCHES_URL', $more_matches_url); ! $templ->parse ('MATCHES', 'searchpage', true); ! $templ->parse ('MATCHES', 'next_match', true); ! } else { ! ! $templ->set_var('next_match',''); ! $templ->parse ('MATCHES', 'searchpage', true); ! } } else { // num_rows == 0 ! $templ->set_var('next_match',''); ! $templ->set_var('match_block',''); } $templ->pparse ("OUT", "searchpage"); |