protected void ForEach(string templateName, IEnumerable items, string separator = "",
                               params object[] args)
        {
            TemplateWrapper template = new TemplateWrapper(templateName);

            int index = 0;

            foreach (var item in items)
            {
                if (index > 0)
                {
                    Write(separator);
                }

                template.StartSession();

                template.SetAttribute("it", item);
                template.SetAttribute("index", index);
                for (int i = 0; i < args.Length; i += 2)
                {
                    template.SetAttribute((string)args[i], args[i + 1]);
                }

                string txt = template.Render();

                if (txt != null)
                {
                    Write(txt);
                }

                index++;
            }
        }
예제 #2
0
		protected void ForEach(string templateName, IEnumerable items, string separator = "",
		                       params object[] args)
		{
			TemplateWrapper template = new TemplateWrapper(templateName);

			int index = 0;
			foreach (var item in items)
			{
				if (index > 0)
					Write(separator);

				template.StartSession();

				template.SetAttribute("it", item);
				template.SetAttribute("index", index);
				for (int i = 0; i < args.Length; i += 2)
					template.SetAttribute((string) args[i], args[i + 1]);

				string txt = template.Render();

				if (txt != null)
					Write(txt);

				index++;
			}
		}
예제 #3
0
		protected void Include(string templateName, object item, params object[] args)
		{
			TemplateWrapper template = new TemplateWrapper(templateName);

			template.StartSession();

			template.SetAttribute("it", item);
			template.SetAttribute("index", 0);
			for (int i = 0; i < args.Length; i += 2)
				template.SetAttribute((string) args[i], args[i + 1]);

			string txt = template.Render();

			if (txt != null)
				Write(txt);
		}
        protected void Include(string templateName, object item, params object[] args)
        {
            TemplateWrapper template = new TemplateWrapper(templateName);

            template.StartSession();

            template.SetAttribute("it", item);
            template.SetAttribute("index", 0);
            for (int i = 0; i < args.Length; i += 2)
            {
                template.SetAttribute((string)args[i], args[i + 1]);
            }

            string txt = template.Render();

            if (txt != null)
            {
                Write(txt);
            }
        }