Changeset 355 for trunk/search.php


Ignore:
Timestamp:
Feb 8, 2004, 2:28:18 AM (20 years ago)
Author:
gweltas
Message:

Template migration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/search.php

    r354 r355  
    6969include('include/page_header.php');
    7070
    71 $handle = $vtp->Open( './template/'.$user['template'].'/search.vtp' );
     71$template->set_filenames( array('search'=>'search.tpl') );
    7272initialize_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
    7890//-------------------------------------------------------------- errors display
    7991if ( sizeof( $error ) != 0 )
    8092{
    81   $vtp->addSession( $handle, 'errors' );
     93  $template->assign_block_vars('errors',array());
    8294  for ( $i = 0; $i < sizeof( $error ); $i++ )
    8395  {
    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]));
    8797  }
    88   $vtp->closeSession( $handle, 'errors' );
    8998}
    90 //------------------------------------------------------------------------ form
    91 // search field
    92 $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 words
    102 $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 link
    128 $vtp->setGlobalVar( $handle, 'back_url', add_session_id( './category.php' ) );
    129 //----------------------------------------------------------- html code display
    130 $code = $vtp->Display( $handle, 0 );
    131 echo $code;
    13299//------------------------------------------------------------ log informations
    133100pwg_log( 'search', $title );
    134101mysql_close();
     102$template->pparse('search');
    135103include('include/page_tail.php');
    136104?>
Note: See TracChangeset for help on using the changeset viewer.