using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.IO;
using System.Data;
using Fm.Bussiness;

namespace Fm.Tags
{
    public class Temp_Search:System.Web.UI.Page
    {
        public_select ps = new public_select();
        protected void Page_Load(object sender, EventArgs e)
        {

            //获取栏目ID
            string  kw = "";
            int pid = 0;
            if (Request.QueryString["kw"] != null && Request.QueryString["page"] != null)
            {
                kw =Request.QueryString["kw"].ToString();
                pid = int.Parse(Request.QueryString["page"].ToString());
            }

            Response.Write(Get_List(kw, pid));
        }
        public string Get_List(string kw, int pid)
        {
            //实例化相关操作类
            ATL.IO.IOStream stream = new ATL.IO.IOStream();//加载Ayong工具库
            GlobalTags gb = new GlobalTags();//公共标签类
            SearchTags st = new SearchTags();
           // public_select ps = new public_select();
            //获取栏目信息
          //  DataView column = ps.Getps("Fm_column", "*", "cl_id=" + cid + "");
            //获取默认搜索页模板
            Xml_work xml = new Xml_work();
            DataTable dt = xml.Xml_Reader(Server.MapPath("/config/templates.xml"), "templates");
            string temp = Server.MapPath("./templates/");
            string content = stream.ReadFile(temp + dt.Rows[0]["search"].ToString());
            //解析页面导入标签
            content = gb.Analysis_Include(content, temp);
            // string content = index;
            //栏目标签解析
            content = gb.Analysis_Column(content, 0);
            //导航
            string sitemap = ">站内搜索";
            //获取头部三个标签(标题,关键字,描述)数据
            content = gb.Analysis_Global(kw, "", "", content,sitemap);
            //公共独立标签解析
            content = gb.Analysis_Article(content, 0);
            content = gb.Analysis_Link(content);
            content = gb.Analysis_Freedom(content);
            //搜索页标签解析
            content = st.Analysis_Page(content,pid,kw);
            //Response.Write(temp + "templates/" + column[0]["cl_temp_list"].ToString());
            return content;

        }
    }
}
