模板标签格式如下:{$list type=23;   row=15;}
   <a href=[url]>[title]</a>
 {/list}正则查找已经完成 就是没有简单的办法处理, 标签开始部分 有参数type=23; row=15; 分别是分类和行数 当然会有更多参数
<a href=[地址]>[标题]</a> 这里是循环的行数替换地址和标题 {/list} 结束标记如何获取到 23  和15 参数赋值给变量    并且循环<a href=[url]>[title]</a> 内容如果有string.Format 反向取值方法就好了。大家给点思路和简便的方法

解决方案 »

  1.   

    类似这样        /// <summary> 
            /// 转换模板所有的标签
            /// </summary>
            public void ReplaceIMLabels()
            {
                string pattern = @"\[NT:unLoop,[^\]]+\][\s\S]*?\[/NT:unLoop\]|\[NT:Loop,[^\]]+\][\s\S]*?\[/NT:Loop\]";
                Regex reg = new Regex(pattern, RegexOptions.Compiled);
                Match m = reg.Match(_tempfinallyconent);
                while (m.Success)
                {
                    string content = m.Value;
                    LabelMass lm = new LabelMass(content,this._classid,this._specialid,this._newsid,this._chid,this._chclassid,this._chspecialid,this._chnewsid);
                    lm.TemplateType = this.MyTempType;
                    lm.ParseContent();
                    string s = lm.Parse();
                    _tempfinallyconent = _tempfinallyconent.Replace(content, s);
                    m = reg.Match(_tempfinallyconent);
                }
            }
      

  2.   

    正则表达式嘛! type=23 就是属性和属性的值。
      

  3.   

    NetCMS 的代码?不行的,他那时处理连贯一行比较规则的标签,如果是那样拆分数组就可以搞定。