用户信息
帖子内容
1 楼
shenbian
注册会员
积分 284
注册 2009-03-21
     
三步让填写留言页面变留言模块首页
JTBC_CMS简明教程--------------------------------------------JTBC&思姆特_主题模板QQ群:429193625----欢迎热心、技术雄厚的JTBC爱好者加入本群 留言本相关  ---------------感谢sheen    教程随时更新,请及时在QQ群:429193625下载最新版本 调用留言:   {$=itransfer("genre=public/guestbook;tpl=gb;type=top;topx=5;lng=-100;")} 设置默认留言链接为签写留言页面 修改:public\guestbook\common\codefile  见红色部分 using jtbc; public partial class module: jpage
{
  private string Module_Add()
  {
    string tmpstr = "";
    ac.cntitle(jt.itake("default.nav_add", "lng"));
    tmpstr = jt.itake("default.add", "tpl");
    tmpstr = com.crValcodeTpl(tmpstr);
    tmpstr = jt.creplace(tmpstr);
    return tmpstr;
  }
  private string Module_List()
  {
    string tmpstr = "";
    string tmpastr, tmprstr, tmptstr;
    int tpage = cls.getNum(request.querystring("page"), 0);
    ac.cntitle(jt.itake("default.nav_list", "lng"));
    tmpstr = jt.itake("default.list", "tpl");
    tmprstr = "";
    tmpastr = cls.ctemplate(ref tmpstr, "{@}");
    string tdatabase = cls.getString(jt.itake("config.ndatabase", "cfg"));
    string tfpre = cls.getString(jt.itake("config.nfpre", "cfg"));
    string tidfield = cls.cfnames(tfpre, "id");
    string tsqlstr = "select * from " + tdatabase + " where " + cls.cfnames(tfpre, "hidden") + "=0 order by " + cls.cfnames(tfpre, "time") + " desc";
    pagi pagi;
    pagi = new pagi();
    pagi.db = db;
    pagi.sqlstr = tsqlstr;
    pagi.pagenum = tpage;
    pagi.rslimit = cls.getNum(jt.itake("config.nlisttopx", "cfg"));
    pagi.pagesize = cls.getNum(jt.itake("config.npagesize", "cfg"));
    pagi.Init();
    object[] tArys = pagi.getDataAry();
    if (tArys != null)
    {
      for (int tis = 0; tis < tArys.Length; tis ++)
      {
        tmptstr = tmpastr;
        object[,] tAry = (object[,])tArys[tis];
        for (int ti = 0; ti < tAry.GetLength(0); ti ++)
        {
          tAry[ti, 0] = (object)cls.getLRStr((string)tAry[ti, 0], tfpre, "rightr");
          tmptstr = tmptstr.Replace("{$" + cls.toString(tAry[ti, 0]) + "}", encode.htmlencode(cls.toString(tAry[ti, 1])));
        }
        config.rsAry = tAry;
        tmptstr = jt.creplace(tmptstr);
        tmprstr += tmptstr;
      }
    }
    tmpstr = tmpstr.Replace(config.jtbccinfo, tmprstr);
    tmpstr = tmpstr.Replace("{$-genre}", config.ngenre);
    tmpstr = tmpstr.Replace("{$-lng}", cls.toString(config.nlng));
    tmpstr = tmpstr.Replace("{$pagi.pagenum}", cls.toString(pagi.pagenum));
    tmpstr = tmpstr.Replace("{$pagi.pagenums}", cls.toString(pagi.pagenums));
    tmpstr = jt.creplace(tmpstr);
    return tmpstr;
  }
  protected void Page_Load()
  {
    PageInit();
    ac.cntitle(jt.itake("default.channel_title", "lng"));
    string tmpstr = "";
    string tType = cls.getString(request.querystring("type"));
    switch(tType)
    {
      case "add":
        tmpstr = Module_Add();
        break;
      case "list":
        tmpstr = Module_List();
        break;
      default:
        tmpstr = Module_Add();
        break;
    }
    PagePrint(tmpstr);
    PageClose();
  }
}
留言成功后跳转页面设置
public\guestbook\common\images\js

defaults = {
  tinterfaceURL: 'default-interface.aspx',
  tAdd: function(_strfname)
  {
    var tstrfname = _strfname;
    var tformObj = $I(tstrfname);
    if (tformObj)
    {
      var tformBeObj = $I(tstrfname + 'BeforeAction');
      if (tformBeObj) eval(tformBeObj.value);
      if (wfront.validator.tCheck(tformObj))
      {
        var tAction = tformObj.action;
        var tstrform = cls.form.tgetValues(tformObj);
        $I('ajaxSubmit').disabled = true;
        cls.tiposts(tAction, tstrform, defaults.tAdds);
      };
    };
  },
  tAdds: function(_strers)
  {
    var tstrers = _strers;
    $I('ajaxSubmit').disabled = false;
    if (wfront.tckBackString(tstrers))
    {
      tstrers = wfront.tckrBackString(tstrers);
      if (tstrers.indexOf('<!--200-->') == -1)
      {
        alert(tstrers);
      }
      else
      {
        alert(tstrers.substr(10));
        location.href = './?type=add';
      };
    };
  }
};



=====================================================最后一步进群咨询
2017-01-04 22:37:10 JTBC&思姆特_主题模板 技术支持群429193625