Cms类可以在模板页中任何位置调用,调用方式如:@Cms.SiteName
<a href="@Cms.Domain"><img src="@Cms.Logo" alt="@Cms.SiteName"/></a>
@if (Cms.IsMobile) { <p>Mobile Content</p> } else { <p>PC Content</p> }
属性名称 | 属性说明 | 返回类型 | 对应设定(返回)值 | 本站返回值示例 |
---|---|---|---|---|
SiteName |
站点名称 | String | 站点设置->站点名称 | ZMCMS营销管理系统 |
Domain |
站点域名 | String | 站点管理->站点编辑 | https://www.zmpress.net/ |
Logo |
站点LogoURL路径 | String | 站点设置->站点Logo | |
Ico |
站点图标URL路径 | String | 站点设置->站点Ico | |
Direction |
文字方向 | String | 站点管理->站点编辑 | ltr |
Language |
站点语言 | String | 站点管理->语言标识 | zh-CN |
Lic |
客户端授权码 | String | 用户客户端授权判断 | zu5yczvmcw |
Theme |
站点模板目录URL | String | 域名(CDN域名)/theme/模板名称 | https://www.zmpress.net/theme/cms |
RealTheme |
站点模板目录Url路径 | String | 域名/theme/模板名称 | https://www.zmpress.net/theme/cms |
PageName |
页面类型标识 | String | 值:home/category/product/article/shoppingcart | home |
ClientIp |
客户端IP地址 | String | 访客IP地址 | 44.200.117.166 |
IsMobile |
是否为移动设备 | Boolean | False | |
IsTablet |
是否为平板设备 | Boolean | False | |
IsDesktop |
是否为桌面设备 | Boolean | True | |
InlineCss |
是否内联CSS | Boolean | 系统->站点设置->内联核心CSS(图片优化/性能) | False |
DisableContextMenu |
是否屏蔽右键菜单 | Boolean | 站点设置->阅读&询盘 | false |
IsEnableBasket |
是否允许购物车 | Boolean | False | |
IsEnableQuantity |
是否允许购物数量选择 | Boolean | False | |
GoogleAnalyticsId |
Google统计Id | String | ||
GoogleVerifyKey |
Google Webmaster认证Key | String | ||
BaiduVerifyKey |
百度站长工具认证Key | String | ||
BaiduMapAppId |
百度地图AppId | String | ||
Version |
系统版本号 | String | 230912 | |
IsLogin |
会员是否登录 | Boolean | ||
MemberName |
会员登录名 | String | ||
CompanyName |
公司名称 | String | 浙江鸿格网络科技有限公司 | |
CompanyLogo |
公司LOGO | String | ||
CompanyAddress |
公司地址 | String | 浙江省永嘉县瓯北镇 | |
Phone |
电话号码 | String | +86 13587721433 | |
Email |
电子邮件 | String | info@zmpress.com | |
Fax |
传真 | String | ||
WhatsApp |
WhatsApp帐号 | String | ||
Line |
Line | String | ||
QQ |
String | 80247894 | ||
Weixin |
String | /uploads-hg/2109/developer.jpg | ||
Youtube |
String | # | ||
Facebook |
String | # | ||
Twitter |
String | # | ||
Linkedin |
String | # | ||
Pinterest |
String | # | ||
Instagram |
String | # | ||
Reddit |
String | |||
OnlineShop |
String | |||
LiveUrl |
String |
方法名称 | 描述 | 说明 |
---|---|---|
局部调用 | ||
如果网站所有页面中有大量公共的内容(例如网站顶部/底部区域等),可将这部分内容独立出来,采用局部调用的方式 | ||
Load(string partialViewName) |
调用局部模板 | @Cms.Load("header") |
Load(string partialViewName, T arg) |
调用局部模板 | |
Load(string partialViewName, T arg, T2 arg2) |
调用局部模板 | |
Load(string partialViewName, T arg, T2 arg2, T3 arg3) |
调用局部视图 | |
分类获取 | ||
HasChilds(int categoryId) |
判断分类Id下是否有子类 | |
HasChilds(string categoryAlias) |
判断分类别名下是否有子类 | |
ColAll(int categoryId=0) |
按分类Id获取其所有子类 | |
ColAll(string alias) |
按分类别名获取其下所有子类 | |
Col(int categoryId) |
按分类Id获取其分类信息 | |
Col(string alias) |
按分类别名获取其分类信息 | |
ColChilds(int categoryId=0) |
按分类Id获取其下直接子类 | |
ColChilds(string alias) |
按分类Id获取其下直接子类 | |
GetGroup(string groupName) |
按分组获取分类列表 | |
链接生成 | ||
Link(Content content,string cssClass=null) 例 |
生成内容链接 | |
获取 @foreach(var item in Model.List) { @Cms.link(item) } |
||
Link(CategoryBase category,string cssClass=null) |
生成分类链接 | |
Link(Content content,string fragment,object htmlAttributes) |
生成内容链接 | |
Link(CategoryBase category,string fragment,object htmlAttributes) |
生成分类链接 | |
Url(Content content,string fragment=null) |
生成内容Url地址 | |
Url(CategoryBase category,string fragment=null) |
生成分类链接地址 | |
Url(string categoryAlias) |
生成分类链接(如分类不存在,则返回#) | |
获取内容 | ||
Top(ProductAttr attr,int top,string categoryAlias=null,bool child=true) |
按分类Id和属性取前N条商品 | |
Top(ProductAttr attr,int top,int categoryId=0,bool child=false) |
按分类别名和属性取N条商品 | |
Top(ArticleAttr attr,int top,string alias,bool child=false) |
按分类Id和属性取前N条文章 | |
Top(ArticleAttr attr,int top,int categoryId,bool child=false) |
按分类别名和属性取前N条文章 | |
社交媒体与其它 | ||
SocialFollow(string cssClass = null) |
社交媒体个人主页 | |
SocialShare(string cssClass = null) |
社交分享按钮 | |
Filesize(string virtualFilePath) |
生成文件路径 | |
ConvertUrl(string virtualUrl) |
转换Url | |
SubString(string str, int length) |
截取字符串 | |
Raw(string str) |
输出原生HTML | |
Format(string str) |
将字符串中的换行符替换为<br/>标签 | |
GetAdvert(string identName,string viewPath=null) |
调用广告 | |
属性名称 | 属性说明 | 返回类型 |
---|---|---|
Id |
分类Id | Int |
Name |
分类名称 | String |
Alias |
分类别名 | String |
ParentId |
父类分级Id | Int |
Depth |
Int | 分类深度 |
Thumb |
分类缩略图例 | String |
获取缩略图片列表 @item.Url:图片路径 @item.Caption:图片名称 @item.Sumary:图片摘要 当图片名称值未填写时,则取默认栏目名称 @foreach(var item in Model.Thumbs) { <img src="@item.Url" alt="@item.Caption"/> <p>@item.Summary</p> } |
||
Thumbs |
分类缩略图列表 | List<PhotoItem> |
Video |
分类视频地址 | string |
VideoPoster |
分类视频封面图片 | string |
Content |
分类内容 | HtmlString |
AttributeGroupId |
分类属性组Id | Int |
RootId |
分类所属一级分类Id | Int |
Title |
分类标题 | String |
Keywords |
分类关键词 | String |
CurrentCategory |
当前分类信息 | CategoryBase |
Description |
分类描述 | String |
List |
分类列表 | List<Content> |
Attributes |
分类属性列表 | List<sss> |
CurrentUrl |
分类页当前Url | String |
方法名称 | 属性说明 | |
---|---|---|
Banner(string viewPath = null) |
获取分类Banner图片设置(调用规则阅读后台栏目banner设置说明) | |
BreadCrumb(string cssClass = null, bool self = true) |
生成面包屑导航 | |
AttriuteUrl(int attributeId, int valueId) |
生成属性值链接 | |
AttributeIgnoreUrl(int attributeId) |
取消属性选择链接 | |
PagingSimple(string cssClass = "pager", string prevText = "《", string nextText = "》") |
生成简单上下页 | |
Paging(string cssClass = "pagination", int pageItem = 10, string prevText = "《", string nextText = "》") | 生成分页列表 | |
属性名称 | 返回类型 | 属性说明 |
---|---|---|
Id |
商品Id号 | Int |
CategoryId |
商品所属分类Id | Int |
FieldList 例 |
商品所有扩展字段 | Dictionary<string,string> |
获取 @foreach(var item in Model.FieldList) { 字段名:@item.Key 字段值:@item.Value } |
||
AttributeGroupId |
商品所属属性Id | Int |
Name |
商品名称 | String |
Alias |
商品别名 | String |
JumpUrl |
商品页跳转地址 | String |
Number |
商品编号 | String |
Unit |
单位 | String |
Ad |
商品广告词 | String |
Price |
商品价格 | Decimal |
Stock |
商品库存 | Int |
SaleCount |
销量 | Int |
Thumbs |
商品缩略图列表 | List<string> |
Thumb |
商品第一张缩略图 | String |
Video |
产品视频地址 | string |
VideoPoster |
产品视频封面图片 | string |
Summary |
商品摘要 | String |
IsTop |
商品是否置顶 | Boolean |
IsHot |
是否热门商品 | Boolean |
IsRcommend |
是否推荐商品 | Boolean |
IsNew |
是否新品 | Boolean |
IsPromotion |
是否促销 | Boolean |
Visit |
商品查看次数 | Int |
CreateTime |
商品创建时间 | DateTime |
CurrentCategory |
商品前分类信息 | CategoryBase |
商品方法 | ||
Banner(string viewPath = null) |
获取商品所属分类Banner图片设置(调用规则阅读后台栏目banner设置说明) | |
GetUnions(int top) |
取当前商品前后各N条数据,如Top值为2,则取前后各2条。共4条记录 | List<ProductBase> |
Download(string field) |
下载 | |
BreadCrumb(string cssClass = "breadcrumb", bool self = false) |
面包屑导航 | |
GetPrevs(int top) |
取当前商品前N条记录 | |
Prev() |
上一条商品 | |
PrevUrl() |
上一条商品Url | |
Next() |
下一个商品 | |
NextUrl() |
下一个商品Url | |
属性名称 | 属性说明 | 返回类型 | ||
---|---|---|---|---|
Id | 文章Id号 | Int | ||
CategoryId | 文章所属分类Id | Int | ||
CategoryId |
商品所属分类Id | Int | ||
FieldList 例 |
文章所有扩展字段 | Dictionary<string,string> | ||
获取 @foreach(var item in Model.FieldList) { 字段名:@item.Key 字段值:@item.Value } |
||||
AttributeGroupId | 文章所属属性Id | Int | ||
Name | 文章标题 | HtmlString | ||
Alias | 文章别名 | String | ||
JumpUrl | 文章跳转地址 | String | ||
Thumbs | 文章缩略图列表 | List<String> | ||
Thumb | 文章第一张缩略图 | String | ||
Video |
文章视频地址 | string | ||
VideoPoster |
文章视频封面图片 | string | ||
Summary | 文章摘要 | String | ||
IsTop | 是否置顶的文章 | Boolean | ||
IsHot | 是否热门文章 | Boolean | ||
IsRcommend | 是否推荐文章 | Boolean | ||
Visit | 文章浏览次数 | Int | ||
CreateTime | 文章创建时间 | DateTime | ||
CurrentCategory 新 |
文章分类信息 | CategoryBase | ||
文章详情方法 | ||||
Banner(string viewPath = null) |
获取文章所属分类Banner图片设置(调用规则阅读后台栏目banner设置说明) | |||
GetUnions(int top) |
取当前文章前后各N条数据,如Top值为2,则取前后各2条。共4条记录 | List<ProductBase> | ||
Download(string field) | 下载 | |||
BreadCrumb(string cssClass = "breadcrumb", bool self = false) | 面包屑导航 | |||
GetPrevs(int top) | 取当前文章前N条记录 | |||
Prev() | 上一篇文章 | |||
PrevUrl() | 上一篇文章Url | |||
Next() | 下一篇文章 | |||
NextUrl() | 下一篇文章Url | |||
自2020年11月15日开始,我们在默认框架中集成了页面滚动特效,无需任何Css代码,即可完成页面滚动对应的特殊效果
友情提示:过度使用特效会降低页面性能
名称 | 功能 | 默认值 |
---|---|---|
data-animated | 定义一个动画 | - |
data-countup | 定义一个数字累加的效果(必须启用data-animated 启用该项勿定义其后任何参数) | - |
data-reset | 是否重复执行 | - |
data-delay | 延迟执行时间(毫秒) | 0 |
data-distance | 动画元素起始执行的距离 | '0px' |
data-duration | 动画完成所需时间(毫秒) | 600 |
data-easing | 动画开始值和结束值 之间的过渡方式 | 'cubic-bezier(0.5, 0, 0, 1)' |
data-opacity | 动画开始之前的不透明度 | 0 |
data-origin | 动画来自方向(top|right|bottom|left) | 'bottom' |
data-rotate | 显示之前的旋转元素 | ' { x: 0,y:0,z: 0 }' |
data-scale | 元素显示之前的缩放比例 | 1 |