Ejemplo n.º 1
0
 //查找匹配的URL
 private string get_url_rewrite(string channel_id, int id)
 {
     Hoto.BLL.url_rewrite   bll   = new Hoto.BLL.url_rewrite();
     Hoto.Model.url_rewrite model = bll.GetInfo(channel_id, "detail");
     if (model != null)
     {
         return(linkurl(model.name, id));
     }
     return("");
 }
Ejemplo n.º 2
0
 //查找匹配的URL
 private string get_url_rewrite(string channel_id, int id)
 {
     Hoto.BLL.url_rewrite bll = new Hoto.BLL.url_rewrite();
     Hoto.Model.url_rewrite model = bll.GetInfo(channel_id, "detail");
     if (model != null)
     {
         return linkurl(model.name, id);
     }
     return "";
 }
Ejemplo n.º 3
0
        private SiteUrls()
        {
            Urls  = new ArrayList();
            Paths = new NameValueCollection();

            Hoto.BLL.url_rewrite          bll = new Hoto.BLL.url_rewrite();
            List <Hoto.Model.url_rewrite> ls  = bll.GetList("");

            foreach (Hoto.Model.url_rewrite model in ls)
            {
                Paths.Add(model.name, model.path);
                model.page        = model.page.Replace("^", "&");
                model.querystring = model.querystring.Replace("^", "&");
                Urls.Add(model);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 返回URL重写统一链接地址
        /// </summary>
        public string linkurl(string _key, params object[] _params)
        {
            Hashtable ht = new Hoto.BLL.url_rewrite().GetList();

            Hoto.Model.url_rewrite model = ht[_key] as Hoto.Model.url_rewrite;
            if (model == null)
            {
                return("");
            }
            try
            {
                string _result     = string.Empty;
                string _rewriteurl = string.Format(model.path, _params);
                switch (config.staticstatus)
                {
                case 1:     //URL重写
                    _result = config.webpath + _rewriteurl;
                    break;

                case 2:     //全静态
                    _rewriteurl = _rewriteurl.Substring(0, _rewriteurl.LastIndexOf(".") + 1);
                    _result     = config.webpath + HotoKeys.DIRECTORY_REWRITE_HTML + "/" + _rewriteurl + config.staticextension;
                    break;

                default:     //不开启
                    string _originalurl = model.page;
                    if (!string.IsNullOrEmpty(model.querystring))
                    {
                        _originalurl = model.page + "?" + Regex.Replace(_rewriteurl, model.pattern, model.querystring, RegexOptions.None | RegexOptions.IgnoreCase);
                    }
                    _result = config.webpath + _originalurl;
                    break;
                }
                return(_result);
            }
            catch
            {
                return("");
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 返回URL重写统一链接地址
 /// </summary>
 public string linkurl(string _key, params object[] _params)
 {
     Hashtable ht = new Hoto.BLL.url_rewrite().GetList();
     Hoto.Model.url_rewrite model = ht[_key] as Hoto.Model.url_rewrite;
     if (model == null)
     {
         return "";
     }
     try
     {
         string _result = string.Empty;
         string _rewriteurl = string.Format(model.path, _params);
         switch (config.staticstatus)
         {
             case 1: //URL重写
                 _result = config.webpath + _rewriteurl;
                 break;
             case 2: //全静态
                 _rewriteurl = _rewriteurl.Substring(0, _rewriteurl.LastIndexOf(".") + 1);
                 _result = config.webpath + HotoKeys.DIRECTORY_REWRITE_HTML + "/" + _rewriteurl + config.staticextension;
                 break;
             default: //不开启
                 string _originalurl = model.page;
                 if (!string.IsNullOrEmpty(model.querystring))
                 {
                     _originalurl = model.page + "?" + Regex.Replace(_rewriteurl, model.pattern, model.querystring, RegexOptions.None | RegexOptions.IgnoreCase);
                 }
                 _result = config.webpath + _originalurl;
                 break;
         }
         return _result;
     }
     catch
     {
         return "";
     }
 }
Ejemplo n.º 6
0
        private SiteUrls()
        {
            Urls = new ArrayList();
            Paths = new NameValueCollection();

            Hoto.BLL.url_rewrite bll = new Hoto.BLL.url_rewrite();
            List<Hoto.Model.url_rewrite> ls = bll.GetList("");
            foreach (Hoto.Model.url_rewrite model in ls)
            {
                Paths.Add(model.name, model.path);
                model.page = model.page.Replace("^", "&");
                model.querystring = model.querystring.Replace("^", "&");
                Urls.Add(model);
            }
        }