if判断标签实例

来源:互联网 发布:java项目描述怎么写 编辑:程序博客网 时间:2024/06/05 20:53

轻开B2C电子商务网站删除商品实例

栏目节点及引入权限检查文件

<chtml><Bag id=sys><we name=NodeID>a0.0</we></Bag></chtml><!-- 栏目节点 --><chtml file="base/ac/checkAcl.htm"/><!-- 引入权限检查文件 -->
权限判断

<chtml><!-- 权限判断 --><if x="@{sys:canDo}" else=1><we x=true><call>act</call><to>@{sys:face}@{sys:curPath}list.html?c=@{show:catalog}</to></we><script>alert("您没有权限!");history.back();</script></if></chtml>
如果@{sys:canDo}=true,执行删除,然后返回列表
<we x=true><call>act</call><to>@{sys:face}@{sys:curPath}list.html?c=@{show:catalog}</to></we>
否则(@{sys:canDo}=false),提示无权操作并退回上一页
<script>alert("您没有权限!");history.back();</script>
删除商品的代码
<chtml id=act onlycall><esql module=base id=show>select we_num,catalog from co_sale where we_id='@{pPage:myid}'</esql><file act=del>htm/images/@{show:we_num}/</file><ESql module=base act=edit>delete from co_sale where we_id='@{pPage:myid}'</ESql></chtml>
完整的代码
<html><chtml><Bag id=sys><we name=NodeID>a0.0</we></Bag></chtml><!-- 栏目节点 --><chtml file="base/ac/checkAcl.htm"/><!-- 引入权限检查文件 --><chtml><!-- 权限判断 --><if x="@{sys:canDo}" else=1><we x=true><call>act</call><to>@{sys:face}@{sys:curPath}list.html?c=@{show:catalog}</to></we><script>alert("您没有权限!");history.back();</script></if></chtml></html><chtml id=act onlycall><esql module=base id=show>select we_num,catalog from co_sale where we_id='@{pPage:myid}'</esql><file act=del>htm/images/@{show:we_num}/</file><ESql module=base act=edit>delete from co_sale where we_id='@{pPage:myid}'</ESql></chtml>
文件在轻开B2C电子商务网站的site/eb目录下(site/eb/show_del.chtml),赶快打开看看,亲自实验一下吧得意

轻开平台资源下载及说明

平台免费下载:http://download.csdn.net/detail/tx18/8381859

最新开发手册下载:http://download.csdn.net/detail/tx18/8411089

开发实例:轻开B2C电子商务网站,免费下载:http://download.csdn.net/detail/tx18/8318585

轻开平台会不定期升级为大家提供更多强大而Easy的功能,请留意最新的开发手册

6 0
原创粉丝点击