首页 / 建站手册 / 从别家系统搬过来

从别家系统搬过来

把别的系统(PbootCMS 一类)的模板迁过来时,逐条对照该怎么写。含"我们没有的"那几项。

适用范围:把一个用其他系统写的站,搬到这套系统上。

迁移主要就是把模板里的标签换成我们的写法。下面这张表逐条对照, 并且如实标出哪些是"写法不同但一样有"、哪些是"确实还没有"。

列表 / 详情页的字段对照

[list:i] [slide:i] 序号从 1{list.i}(每个循环都有,含轮播、标签、商品、商家)
[list:n] 序号从 0{list.n}
[list:id] 编号{list.id}
[list:scode] 栏目编码{list.cid}(我们的栏目用数字 id,没有另一个"编码")
[list:sortname] 栏目名称{list.sortname}
[list:sortlink] 栏目链接{list.sorturl}
[list:title] 标题{list.title}
[list:date] 发布日期{list.publish_time format="Y-m-d"}
[list:link] 链接{list.url}
[list:content] 内容{list.content html="1"}(html="1" 不能省)
[list:ico] 缩略图{list.thumb_url}
[list:isico] 有没有缩略图{list.has_thumb}('1'/'0')
[list:pics] 多图{list.gallery}(列表要加 media="1")或 {naicha:gallery}
[list:ispics]{list.has_gallery}
[list:visits] 访问数{list.hits}
[list:istop] 是否置顶{list.top}
[list:author] 作者{list.author}(没设作者时是空串)
[list:enclosure] 附件{list.files}
[list:ext_xxx] 扩展字段{list.xxx}(直接写字段名,引擎会自动去扩展字段里找)
[list:subtitle] 副标题;[list:source] 来源;[list:titlecolor] 标题颜色;[list:outlink] 外部链接;[list:keywords] [list:description]在内容模型里加一个字段就叫这个名字(「内容模型 → 字段」),加完模板里直接写 {list.subtitle} 即可 —— 不需要改代码。 "每篇内容各填一次"的东西,在这套系统里都属于内容模型字段。
[list:isrecommend] 推荐;[list:isheadline] 头条同样加字段(类型选「开关」,值为 1/0)。; 按它筛选:{naicha:list field="isrecommend" op="eq" fvalue="1"}
[list:subscode] 副栏目一篇内容可以同时属于多个栏目({detail.cats}), 但没有"副栏目"这个单一编码
[list:enclosuresize] 附件大小{list.files} 里有文件信息,大小要自己算

栏目的字段对照

[sort:scode] 栏目编码{sort.id} / {sort.alias}
[sort:name] 栏目名称{sort.name}
[sort:link] 栏目链接{sort.url}
[sort:pcode] 父栏目编码{sort.pid}
[sort:parentname] 父栏目名称{sort.parentname}
[sort:parentlink]{sort.parenturl}
[sort:tcode] 顶级栏目编码用 {naicha:sort id="{sort.pid}"} 再取一层
[sort:topname] 顶级栏目名称{sort.topname}
[sort:toplink]{sort.topurl}
[sort:type] 栏目类型{sort.type}(list 列表 / page 单页)
[sort:listtpl] 列表模板{sort.template}
[sort:contenttpl] 详情模板{sort.detail_template}
[sort:ico] 栏目缩略图{sort.cover}
[sort:title] [sort:keywords] [sort:description]{sort.seo_title} {sort.seo_keywords} {sort.seo_desc}
[sort:rows] 栏目内容数{sort.rows}
[sort:soncount] 子栏目数{sort.soncount}
[nav:parent] 取同级 / 子级菜单先 {naicha:nav} 遍历,再按 {nav.children} 展开一层; 要"当前栏目的同级"用 {naicha:nav} 配 {naicha:if} 比 {sort.pid}

标签名的对照

{pboot:list}{naicha:list}
{pboot:content}{naicha:detail}
{pboot:nav} / {pboot:sort}{naicha:nav} / {naicha:sort}
{pboot:slide}{naicha:banners}(分组用 group="…")
{pboot:link}{naicha:links}
{pboot:pics}{naicha:gallery}
{pboot:tags}{naicha:tags}
{pboot:form} / {pboot:message}{naicha:form}
{pboot:if(…} 式子式{naicha:if var="…" eq="…"} 属性式(见「什么时候显示、什么时候不显示(if)」)
{pboot:loop}{naicha:loop}
时间格式化 style=format="Y-m-d"
长度截取 len= lencn=excerpt="60"(按字数截并去标签)
去 HTML drophtml=1excerpt 本身就带这个效果
公司信息 {pboot:companyname} {pboot:companyphone} …{naicha:companyname} —— 12 项一一对应,写法和他的完全一样
站点信息 {pboot:site*}{naicha:site name="…"} 取站点设置里的键
{pboot:pagetitle} 等{seo.title} {seo.keywords} {seo.desc}
会员地址 {pboot:login} {pboot:ucenter} {pboot:logout}地址是固定的:/user/login /user /user/logout; 登录态用 {naicha:user} + {user.logged}

评论的字段对照

[comment:comment]{comment.content}
[comment:contentid]{comment.content_id}
[comment:id] [comment:pid] [comment:uid]{comment.id} {comment.pid} {comment.uid}
[comment:nickname] [comment:username]{comment.author}
[comment:date]{comment.when} 或 {comment.created_at}
[comment:i] [comment:n]{comment.i} {comment.n}
[comment:likes] [comment:oppose]{comment.likes} {comment.oppose},链接是 {comment.likeslink} {comment.opposelink}
[comment:pusername] [comment:pnickname]{r.parent_author}(回复行里)
[comment:headpic] [comment:pheadpic]{comment.letter}(昵称首字母,做文字头像)
[comment:ip] [comment:os] [comment:puid] [comment:replyaction]没有

「我的评论」的字段对照

[mycomment:comment] [mycomment:contentid]{mycomment.content} {mycomment.content_id}
[mycomment:title]{mycomment.title}(属于哪篇文章)+ {mycomment.url}(点回原文)
[mycomment:date] [mycomment:status]{mycomment.when} {mycomment.status}
[mycomment:likes] [mycomment:oppose]{mycomment.likes} {mycomment.oppose}
[mycomment:delaction]{mycomment.delaction}(POST 提交即删除)
其余(作者、父楼、序号…)与评论一样,前缀换成 {mycomment.…}

留言的字段对照

[message:xxx] 表单里填的一项{msg.xxx}(xxx 就是表单里那一项的字段名)
固定的几个{msg.id} {msg.form} {msg.date} {msg.when}
[message:ip] [message:os] [message:headpic] [message:recontent] [message:replydate]没有

导航 / 轮播 / 友链 / 标签 / 筛选

[nav:*]{naicha:navs} 的 {navitem.id} {navitem.name} {navitem.url};栏目树用 {naicha:nav},字段同栏目表
[nav:rows] [nav:soncount] [nav:def1..3]{sort.rows} {sort.soncount} {sort.def1}
[slide:*]{naicha:banners} 的 {banner.title} {banner.subtitle} {banner.image} {banner.url} {banner.btn_text}
[link:*]{naicha:links} 的 {link.name} {link.url} {link.logo}
[tags:*]{naicha:tags} 的 {tag.name} {tag.count} {tag.url}
[pics:*]{naicha:gallery} 的 {photo.url} {photo.alt} {photo.index}
[select:*] 多条件筛选{naicha:filters}
[checkbox:*]没有

补齐了的

点赞 / 反对{list.likes} {list.likeslink}
评论的赞 / 踩{comment.likes} {comment.likeslink}
评论的行字段{naicha:commentlist}
回复里的父楼作者{r.parent_author}
前台留言列表{naicha:messages}
我的评论{naicha:mycomments}
标签的链接{tag.url}
公司信息{naicha:companyphone} 这一类
上传 / 邮箱验证码{naicha:upload} {naicha:sendemail}
一句话总结:他那边的字段我们都有,只是叫法不同; 副标题、来源、外链、标题颜色、推荐、头条这类"每篇各填一次"的,在我们这边是内容字段, 写 {list.字段名} 就行。唯一没有的是万能 SQL —— 那是刻意不做。
没找到答案? 可以在 联系我们 留言说明使用场景,我们会补充进文档。