10
2019
03

dtcms一篇文章多个链接解决方法

dtcms一个文章有3个链接,怎么解决:

关于dtcms一篇文章多个连接解决方案如下

int id = DTRequest.GetQueryInt("id");

            int category_id = DTRequest.GetQueryInt("category_id");

            if (category_id != 0 || id != 0)

            {

                int index_ = requestPath.IndexOf('_');

                string channel = requestPath.Substring(0, index_);

                channel = channel.TrimStart('/');

                int channelId = 0;

                if (category_id != 0)

                {

                    if (new BLL.article_category().Exists(category_id))

                    { channelId = new BLL.article_category().GetModel(category_id).channel_id; }

                    else

                    {

                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode(config.webclosereason)));

                        return new Model.channel_site();

                    }

                }

                else

                {

                     if (new BLL.article().Exists(id))

                     { channelId = new BLL.article().GetModel(id).channel_id; }

                     else

                     {

                         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode(config.webclosereason)));

                         return new Model.channel_site();

                     }

                }

                string channelName = new BLL.channel().GetModel(channelId).name;

                if (channelName != channel)

                {

                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode(config.webclosereason)));

                     return new Model.channel_site();

                }

            }

原文链接:https://www.qiquanji.com/post/8791.html

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

微信扫码关注

更新实时通知

« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。