• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

我的模板分析引擎类PHP的.net开发方法--功能介绍篇

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
        从一开始接触asp.net我就不领微软的情,对其提供和包装的各大控件给人们带来的方便性视而不见,一直想实现自己的模板分析方案,但工作中一直是别人安排我做什么我就得做什么,根本没时间做自己想做的事情,所以自己的模板方案迟迟未能实现。不过最近因为项目的需要,我终于有机会实现它了。

以下是我实现的模板文件Skin-test.html
{repeater rptTables}
    {headerTemplate}
        
<div id="miniBox">
            
<div class="hd">
                
<div class="l">1</div>
                
<div class="title">{repeater rptTables2}{headerTemplate}55555{/headerTemplate}{/repeater}</div>
                
<div class="r">3</div>
            
</div>
    {/headerTemplate}
    {itemTemplate}
            
<div class="it1">
                
<div class="l">
                    
<input id="{eval TableId}" type="checkbox" />
                    
<href="EditTable.aspx?tableid={eval TableId}">{eval TableName}</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid={eval TableId}">{lang Edit}</a>
                    
<href="EditTable.aspx?tableid={eval TableId}">{lang Delete}</a>
                
</div>
            
</div>
    {/itemTemplate}
    {alternatingItemTemplate}
            
<div class="it2">
                
<div class="l">
                    
<input id="{eval TableId}" type="checkbox" />
                    
<href="EditTable.aspx?tableid={eval TableId}">{eval TableName}</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid={eval TableId}">{lang Edit}</a>
                    
<href="EditTable.aspx?tableid={eval TableId}">{lang Delete}</a>
                
</div>
            
</div>
    {/alternatingItemTemplate}
    {footerTemplate}
            
<div class="ft">
                
<select id="Select1">
                    
<option value="">{lang Action}</option>
                    
<option value="">{lang Delete}</option>
                    
<option value="">{lang Build}</option>
                
</select>
            
</div>
            {repeater rptTables3}{headerTemplate}55555{/headerTemplate}{itemTemplate}{eval TableId}{/itemTemplate}{/repeater}
        
</div>
    {/footerTemplate}
{/repeater}

以下是分析这个模板的代码:
PageSetting p = ResourceManager.GetPageSetting(context.Request.CurrentExecutionFilePath);

                    
string txt = Skins.GetSkin(p.SkinFile);

                    IUI.ITemplate tmp 
= UIFactory.DataAccess.CreateTemplate();
                    tmp.InstantiateIn(
ref txt);

                    
if (tmp.ContainsKey("rptTables"))
                    context.Response.Write(tmp.Render());

以下是执行的结果:

<div id="miniBox">
            
<div class="hd">
                
<div class="l">1</div>
                
<div class="title">55555</div>
                
<div class="r">3</div>
            
</div>
    
            
<div class="it1">
                
<div class="l">
                    
<input id="8f035f73-a025-4aaa-a9ab-9f6d475ee762" type="checkbox" />
                    
<href="EditTable.aspx?tableid=8f035f73-a025-4aaa-a9ab-9f6d475ee762">table 0</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid=8f035f73-a025-4aaa-a9ab-9f6d475ee762">edit</a>
                    
<href="EditTable.aspx?tableid=8f035f73-a025-4aaa-a9ab-9f6d475ee762">delete</a>
                
</div>
            
</div>
    
            
<div class="it1">
                
<div class="l">
                    
<input id="6571e446-7c50-48a7-8195-167cddab6966" type="checkbox" />
                    
<href="EditTable.aspx?tableid=6571e446-7c50-48a7-8195-167cddab6966">table 1</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid=6571e446-7c50-48a7-8195-167cddab6966">edit</a>
                    
<href="EditTable.aspx?tableid=6571e446-7c50-48a7-8195-167cddab6966">delete</a>
                
</div>
            
</div>
    
            
<div class="it1">
                
<div class="l">
                    
<input id="944a4cbc-3442-4d12-9c84-95f31d463e32" type="checkbox" />
                    
<href="EditTable.aspx?tableid=944a4cbc-3442-4d12-9c84-95f31d463e32">table 2</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid=944a4cbc-3442-4d12-9c84-95f31d463e32">edit</a>
                    
<href="EditTable.aspx?tableid=944a4cbc-3442-4d12-9c84-95f31d463e32">delete</a>
                
</div>
            
</div>
    
            
<div class="it1">
                
<div class="l">
                    
<input id="879b8f82-0d97-4c44-8996-9eb3ab676481" type="checkbox" />
                    
<href="EditTable.aspx?tableid=879b8f82-0d97-4c44-8996-9eb3ab676481">table 3</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid=879b8f82-0d97-4c44-8996-9eb3ab676481">edit</a>
                    
<href="EditTable.aspx?tableid=879b8f82-0d97-4c44-8996-9eb3ab676481">delete</a>
                
</div>
            
</div>
    
            
<div class="it1">
                
<div class="l">
                    
<input id="03452077-97b0-4236-b316-4856e3afde71" type="checkbox" />
                    
<href="EditTable.aspx?tableid=03452077-97b0-4236-b316-4856e3afde71">table 4</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid=03452077-97b0-4236-b316-4856e3afde71">edit</a>
                    
<href="EditTable.aspx?tableid=03452077-97b0-4236-b316-4856e3afde71">delete</a>
                
</div>
            
</div>
    
            
<div class="it1">
                
<div class="l">
                    
<input id="277c9626-1667-4f94-8e9a-b4f94d7e4843" type="checkbox" />
                    
<href="EditTable.aspx?tableid=277c9626-1667-4f94-8e9a-b4f94d7e4843">table 5</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid=277c9626-1667-4f94-8e9a-b4f94d7e4843">edit</a>
                    
<href="EditTable.aspx?tableid=277c9626-1667-4f94-8e9a-b4f94d7e4843">delete</a>
                
</div>
            
</div>
    
            
<div class="it1">
                
<div class="l">
                    
<input id="afe35db0-d07a-44fe-88be-db5ded717916" type="checkbox" />
                    
<href="EditTable.aspx?tableid=afe35db0-d07a-44fe-88be-db5ded717916">table 6</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid=afe35db0-d07a-44fe-88be-db5ded717916">edit</a>
                    
<href="EditTable.aspx?tableid=afe35db0-d07a-44fe-88be-db5ded717916">delete</a>
                
</div>
            
</div>
    
            
<div class="it1">
                
<div class="l">
                    
<input id="3a2f445e-44c4-4144-84da-b08e2fb90d3b" type="checkbox" />
                    
<href="EditTable.aspx?tableid=3a2f445e-44c4-4144-84da-b08e2fb90d3b">table 7</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid=3a2f445e-44c4-4144-84da-b08e2fb90d3b">edit</a>
                    
<href="EditTable.aspx?tableid=3a2f445e-44c4-4144-84da-b08e2fb90d3b">delete</a>
                
</div>
            
</div>
    
            
<div class="it1">
                
<div class="l">
                    
<input id="8d555e36-c4c7-4219-8f67-8305db9ae8d2" type="checkbox" />
                    
<href="EditTable.aspx?tableid=8d555e36-c4c7-4219-8f67-8305db9ae8d2">table 8</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid=8d555e36-c4c7-4219-8f67-8305db9ae8d2">edit</a>
                    
<href="EditTable.aspx?tableid=8d555e36-c4c7-4219-8f67-8305db9ae8d2">delete</a>
                
</div>
            
</div>
    
            
<div class="it1">
                
<div class="l">
                    
<input id="0edd6e3e-d1fc-4842-9832-d2e037f770ea" type="checkbox" />
                    
<href="EditTable.aspx?tableid=0edd6e3e-d1fc-4842-9832-d2e037f770ea">table 9</a>
                
</div>
                
<div class="r">
                    
<href="EditTable.aspx?tableid=0edd6e3e-d1fc-4842-9832-d2e037f770ea">edit</a>
                    
<href="EditTable.aspx?tableid=0edd6e3e-d1fc-4842-9832-d2e037f770ea">delete</a>
                
</div>
            
</div>
    
            
<div class="ft">
                
<select id="Select1">
                    
<option value="">action</option>
                    
<option value="">delete</option>
                    
<option value="">Build</option>
                
</select>
            
</div>
            555558f035f73-a025-4aaa-a9ab-9f6d475ee7626571e446-7c50-48a7-8195-167cddab6966944a4cbc-3442-4d12-9c84-95f31d463e32879b8f82-0d97-4c44-8996-9eb3ab67648103452077-97b0-4236-b316-4856e3afde71277c9626-1667-4f94-8e9a-b4f94d7e4843afe35db0-d07a-44fe-88be-db5ded7179163a2f445e-44c4-4144-84da-b08e2fb90d3b8d555e36-c4c7-4219-8f67-8305db9ae8d20edd6e3e-d1fc-4842-9832-d2e037f770ea
        
</div>


 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
php开发_图片验证码发布时间:2022-07-10
下一篇:
php笔记之-laravel-Redis入门操作发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap