📄 special.aspx.cs
字号:
{
getContent = getContentRuslt(ChID, info.Templet, SpecialID, strPage, 1);
}
break;
case 5:
if (iuserPoint < iPoint || getGroup(userGroupNumber, GroupNumber) == false)
{
PageError("您的G币没达到:" + iPoint + "<li>或者您所在的组不能浏览</li>", "");
}
else
{
getContent = getContentRuslt(ChID, info.Templet, SpecialID, strPage, 1);
}
break;
case 6:
if (iuserPoint < iPoint || Guserpoint < Gpoint || getGroup(userGroupNumber, GroupNumber) == false)
{
PageError("您的积分或G币不足,需要达到积分:" + iPoint + ",G币:" + Gpoint + "<li>或者您所在的组不能浏览</li>", "");
}
else
{
getContent = getContentRuslt(ChID, info.Templet, SpecialID, strPage, 1);
}
break;
}
}
}
}
}
if (Regex.Match(getContent, @"\</head\>[\s\S]*\<body", RegexOptions.IgnoreCase | RegexOptions.Compiled).Success)
{
getContent = Regex.Replace(getContent, "<body", getjs() + "<body", RegexOptions.IgnoreCase | RegexOptions.Compiled);
}
else
{
getContent = getjs() + getContent;
}
getContent = (getContent.Replace(gInstallDir, NetCMS.Publish.CommonData.getUrl())).Replace(gTempletDir, TempletDir);
Response.Write(getContent);
}
protected static string getContentRuslt(int ChID,string Templet, string SpecialID, int strPage,int isPop)
{
string TempletPath = string.Empty;
string SiteRootPath = NetCMS.Common.ServerInfo.GetRootPath();
string strTempletDir = TempletDir;
string gConenent = string.Empty;
TempletPath = Templet;
TempletPath = TempletPath.Replace("/", "\\");
TempletPath = TempletPath.ToLower().Replace("{@dirtemplet}", strTempletDir);
TempletPath = SiteRootPath.Trim('\\') + TempletPath;
Template specialTemplate = null;
if (ChID != 0)
{
specialTemplate = new Template(TempletPath, TempType.Chspecial);
specialTemplate.CHSpecialID = int.Parse(SpecialID);
specialTemplate.ChID = ChID;
}
else
{
specialTemplate = new Template(TempletPath, TempType.Special);
specialTemplate.SpecialID = SpecialID;
}
specialTemplate.GetHTML();
gConenent = replaceTemplate(specialTemplate, SpecialID, strPage, isPop);
return gConenent;
}
protected bool getGroup(string uGroup, string nGroup)
{
return NetCMS.Common.Public.CommgetGroup(uGroup, nGroup);
}
/// <summary>
/// 处理模板
/// </summary>
/// <param name="tempRe">模板实例</param>
public static string replaceTemplate(Template tempRe, string SpecialID, int strPage, int isPop)
{
tempRe.ReplaceLabels();
tempRe.ReplaceIMLabels();
string getPageContent = string.Empty;
string getPageStr = string.Empty;
bool getRight = false;
string FinlContent = string.Empty;
if (tempRe.MyTempType == TempType.Special || tempRe.MyTempType == TempType.Chspecial)
{
FinlContent = tempRe.FinallyContent;
int pos1 = FinlContent.IndexOf("{NT:NewsLIST}");
int pos2 = FinlContent.IndexOf("{/NT:NewsLIST}");
if (pos2 > pos1 && pos1 > -1)
{
#region 处理分页
string PageHead = FinlContent.Substring(0, pos1);
string PageEnd = FinlContent.Substring(pos2 + 18);
string PageMid = FinlContent.Substring(pos1 + 17, pos2 - pos1 - 17);
string pattern = @"\{\$NT\:P[01]\}\{Page\:\d\$[^\$]{0,6}\$\}";
Regex reg = new Regex(pattern, RegexOptions.Compiled);
Match match = reg.Match(PageMid);
if (match.Success)
{
if (NetCMS.Config.verConfig.PublicType == "0" || tempRe.MyTempType == TempType.Chspecial)
{
string PageStr = match.Value;
int posPage = PageStr.IndexOf("}{Page:");
string postResult = PageStr.Substring(posPage + 7);
postResult = postResult.TrimEnd('}');
string[] postResultARR = postResult.Split('$');
string postResult_style = postResultARR[0];
string postResult_color = postResultARR[1];
string postResult_css = postResultARR[2];
string postResult_css1 = "";
if (postResult_css.Trim() != string.Empty)
{
postResult_css1 = " class=\"" + postResult_css + "\"";
}
string[] ArrayCon = reg.Split(PageMid);
int n = ArrayCon.Length;
if (ArrayCon[n - 1] == null || ArrayCon[n - 1].Trim() == string.Empty)
n--;
for (int i = 0; i < n; i++)
{
if (i == (strPage - 1))
{
UltiPublish gpl = new UltiPublish(true);
getPageStr = gpl.getPagelist(postResult_style, i, "", "", postResult_color, postResult_css1, n, SpecialID, "special", isPop);
getPageContent = PageHead + ArrayCon[i] + getPageStr + PageEnd;
getRight = true;
}
if (getRight)
{
break;
}
}
}
FinlContent = getPageContent;
}
else
{
string p1js = "<span style=\"text-align:center;\" id=\"gPtypenowdiv" + DateTime.Now.ToShortDateString() + "\">加载中...</span>";
p1js += "<script language=\"javascript\" type=\"text/javascript\">";
p1js += "pubajax('/configuration/system/public.aspx','NowStr=" + DateTime.Now.ToShortDateString() + "&ruleStr=1','gPtypenowdiv" + DateTime.Now.ToShortDateString() + "');";
p1js += "</script>";
FinlContent = tempRe.FinallyContent.Replace("{NT:NewsLIST}", "").Replace("{/NT:NewsLIST}", "").Replace("{$NT:P1}", p1js);
}
#endregion
}
}
return FinlContent;
}
protected static string getjs()
{
string getajaxJS = "<script language=\"javascript\" type=\"text/javascript\" src=\"" + NetCMS.Publish.CommonData.getUrl() + "/configuration/js/Prototype.js\"></script>\r\n";
getajaxJS += "<script language=\"javascript\" type=\"text/javascript\" src=\"" + NetCMS.Publish.CommonData.getUrl() + "/configuration/js/jspublic.js\"></script>\r\n";
getajaxJS += "<!--Created by NETCMS v1.0 for aspxcms Inc. at " + DateTime.Now + "-->\r\n";
return getajaxJS;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -