Changeset 355 for trunk/search.php
- Timestamp:
- Feb 8, 2004, 2:28:18 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/search.php
r354 r355 69 69 include('include/page_header.php'); 70 70 71 $ handle = $vtp->Open( './template/'.$user['template'].'/search.vtp');71 $template->set_filenames( array('search'=>'search.tpl') ); 72 72 initialize_template(); 73 $tpl = array( 'search_title','search_return_main_page','submit', 74 'search_comments' ); 75 templatize_array( $tpl, 'lang', $handle ); 76 //----------------------------------------------------------------- form action 77 $vtp->setGlobalVar( $handle, 'form_action', add_session_id( './search.php' ) ); 73 74 $template->assign_vars(array( 75 'L_TITLE' => $lang['search_title'], 76 'L_COMMENTS' => $lang['search_comments'], 77 'L_RETURN' => $lang['search_return_main_page'], 78 'L_SUBMIT' => $lang['submit'], 79 'L_SEARCH'=>$lang['search_field_search'].' *', 80 'L_SEARCH_OR'=>$lang['search_mode_or'], 81 'L_SEARCH_AND'=>$lang['search_mode_and'], 82 83 'F_ACTION' => add_session_id( 'search.php' ), 84 'F_TEXT_VALUE' => isset($_POST['search'])?$_POST['search']:'', 85 86 'U_HOME' => add_session_id( 'category.php' ) 87 ) 88 ); 89 78 90 //-------------------------------------------------------------- errors display 79 91 if ( sizeof( $error ) != 0 ) 80 92 { 81 $ vtp->addSession( $handle, 'errors');93 $template->assign_block_vars('errors',array()); 82 94 for ( $i = 0; $i < sizeof( $error ); $i++ ) 83 95 { 84 $vtp->addSession( $handle, 'li' ); 85 $vtp->setVar( $handle, 'li.li', $error[$i] ); 86 $vtp->closeSession( $handle, 'li' ); 96 $template->assign_block_vars('errors.error',array('ERROR'=>$error[$i])); 87 97 } 88 $vtp->closeSession( $handle, 'errors' );89 98 } 90 //------------------------------------------------------------------------ form91 // search field92 $vtp->addSession( $handle, 'line' );93 $vtp->setVar( $handle, 'line.name', $lang['search_field_search'].' *' );94 $vtp->addSession( $handle, 'text' );95 $vtp->setVar( $handle, 'text.size', '40' );96 $vtp->setVar( $handle, 'text.name', 'search' );97 if (isset($_POST['search']))98 $vtp->setVar( $handle, 'text.value', $_POST['search'] );99 $vtp->closeSession( $handle, 'text' );100 $vtp->closeSession( $handle, 'line' );101 // mode of search : match all words or at least one of this words102 $vtp->addSession( $handle, 'line' );103 $vtp->addSession( $handle, 'group' );104 105 $vtp->addSession( $handle, 'radio' );106 $vtp->setVar( $handle, 'radio.name', 'mode' );107 $vtp->setVar( $handle, 'radio.value', 'OR' );108 $vtp->setVar( $handle, 'radio.option', $lang['search_mode_or'] );109 if (!isset($_POST['mode']) || $_POST['mode'] == 'OR' )110 {111 $vtp->setVar( $handle, 'radio.checked', ' checked="checked"' );112 }113 $vtp->closeSession( $handle, 'radio' );114 115 $vtp->addSession( $handle, 'radio' );116 $vtp->setVar( $handle, 'radio.name', 'mode' );117 $vtp->setVar( $handle, 'radio.value', 'AND' );118 $vtp->setVar( $handle, 'radio.option', $lang['search_mode_and'] );119 if ( isset($_POST['mode']) && $_POST['mode'] == 'AND' )120 {121 $vtp->setVar( $handle, 'radio.checked', ' checked="checked"' );122 }123 $vtp->closeSession( $handle, 'radio' );124 125 $vtp->closeSession( $handle, 'group' );126 $vtp->closeSession( $handle, 'line' );127 //---------------------------------------------------- return to main page link128 $vtp->setGlobalVar( $handle, 'back_url', add_session_id( './category.php' ) );129 //----------------------------------------------------------- html code display130 $code = $vtp->Display( $handle, 0 );131 echo $code;132 99 //------------------------------------------------------------ log informations 133 100 pwg_log( 'search', $title ); 134 101 mysql_close(); 102 $template->pparse('search'); 135 103 include('include/page_tail.php'); 136 104 ?>
Note: See TracChangeset
for help on using the changeset viewer.