<?php

include_once( ROOT . 'lib/biz.function.php' );


if( isset( $_REQUEST['tag'] ))
{
	$tag = $_REQUEST['tag'];

	if( intval( $_REQUEST['page'] ) < 1 ) $page = 1 ; else $page = $_REQUEST['page'];
	$page_num = intval( _conf( 'CONTENT_PER_PAGE' ) );

	$start = ( $page-1 ) * $page_num;

	$page_all = ceil( get_content_num_by_tag(  1 , $tag ) /$page_num );
	$pager = get_pager( $page , $page_all , Array( 'a' , 'search_text' , 'tag' ) );

	$t = _tpl();
	$t->set( 'title' , "书刊列表" );
	$t->set( 'top_title' , "书刊列表" );
	$t->set( 'lines' , get_content_by_tag( 1 , $tag , $start , $page_num ) );
	$t->set( 'pager' , $pager );
	echo $t->autoFetch( __FILE__ );
}
else
{
	$text = _s( $_REQUEST['search_text']  );
	if( intval( $_REQUEST['page'] ) < 1 ) $page = 1 ; else $page = $_REQUEST['page'];
	$page_num = intval( _conf( 'CONTENT_PER_PAGE' ) );

	$start = ( $page-1 ) * $page_num;

	$page_all = ceil( get_content_num_by_search_text(  1 , $text ) /$page_num );
	$pager = get_pager( $page , $page_all , Array( 'a' , 'search_text' , 'tag' ) );

	$t = _tpl();
	$t->set( 'title' , "书刊列表" );
	$t->set( 'top_title' , "书刊列表" );
	$t->set( 'lines' , get_content_by_search_text( 1 , $text , $start , $page_num ) );
	$t->set( 'pager' , $pager );
	echo $t->autoFetch( __FILE__ );
}





?>