Kooboo中怎么新增一个关联的Details 动态页面。

Kooboo中怎么新增一个关联的Details 动态页面。

有几个要点:

1. Sub Page的Parent Page 必须是英文书写。如果是中文会出现找不到页面 500错误

2. 要在Page Mapping中设置 url和page的关联

3. page要改成dynamices的。

Dynamic pages I

A dynamic web page is a kind of web page that has been prepared with fresh information (content and/or layout), for each individual viewing.

Kooboo provides two easy ways to create dynamic pages. You can directly add a data folder to a page, create both a content list page and a content detail page.  A more advanced way is using view and datarule. Please see below steps.

1. Adding data folder to a page.

Go to Start page of Kooboo CMS, select Add sub page to create a new page.

In the page designer, name the page Article click Add a data folder

The data folder selection windows open, select the folder and check List

Click OK and then click Save to save your page.  You have created a new article list page.  Next we will create the article detail page.

In the Start page, click on the Article page we just created, select Add sub page and then select the two_column layout

Call this page Detail, and also select the Add a data folder.

Click Ok, then Click Save. We have created the new article list and article detail. Click preview in the dropdown menu to preview them.

Action mapping



If you name the list page name according the content type name and the detail page as a sub page of the list page with the page name of detail, all the page linking will be generated correctly. If you name the page in a different way, Kooboo CMS may not able to generate the link to detail page correctly. If kooboo CMS did not find the destination page, it will record the missing link in the action mapping, you can manually make the adjustment.

Change the default content display template



In the list and detail pages created above, it use the system default display template to display list and detail content. If you wish to change how it is displayed, you can turn on the Custom template and modify it at the content type edit page.

In the database setting page, check Custom template, and click Save

Go to content type edit page, you can see the template tab now.

Click the Templates tab, you can modify the front end site content display template or even content editing page in the CMS backend.

2. Dynamic page with view and data rule

An more advanced way of making dynamic page is to create both list and detail view and then insert the views into corresponding pages.  We will continue this topic in the dynamic pages II

Dynamic pages II

This is the second part of creating dynamic pages. In this tutorial, we will show you how you can create dynamic pages using MVC view and Kooboo Data rule.

Go to Views list page, click Create New and select Razor

In the view page, we first need to query content from database in order for view engine to render them. Data query is done by Kooboo Datarule. More information can be found at the Data rule document.

In the view editing page, click Add under the data rule section to create a new data rule.

In the data rule design page, first select the folder that contains the data we need, then select the correct return data type.  We selected Article folder with the option of List of contents in the selected folder

Click Next to go to the data query filter design page. Give your datarule a name and define your content filters.

Click Save to save your datarule and return to view editing page.  You can now see the datarule you created and also a few icons next to the datarule name.  Click on the C# icon will insert the C# code sample to render the Datarule content.

You may modify the generated code. After modification, click Finish to finish the editing. You have created an article list view.

Using similar steps, you can create an article detail view as well. {UserKey} is used as default parameter to query content.

You have created both list and detail view for article folder now. Go to Start page, add two pages, one with the mylistview view, and the other add the mydetailview.

Action mapping



Same as adding a data folder to a page, you may want to check the Action mapping menu if there is a not a immediately link directly to detail page.

You have created the dynamic pages with view and kooboo datarule. You may now go to Start page and preview what you have made.

Merge fields

The following fields are merge fields:

  • Content title
  • All the fields on the "Html meta" tab on page editing form.

The merge fields used to merge the formulas with the view data in the page. For example, if you setting the "Content title" as a value is "{News.Title}", the field will be rendered  as same as "ViewBag.News.Title" which code write by C#.

时间: 2024-10-26 04:13:51

Kooboo中怎么新增一个关联的Details 动态页面。的相关文章

爬虫:工作中编写的一个python爬取web页面信息的小demo

最近公司要求编写一个爬虫,需要完善后续金融项目的数据,由于工作隐私,就不付被爬的网址url了,下面总结下spider的工作原理. 语言:python:工具:jupyter: (1)使用requests模块,获取url页面. import requests url = "http://www.~~~~~~~~~~~~~~~~~~~~~~~~~~" r = requests.get(url) (2)解析html页面(若是pdf页面需要其他工具模块)需要使用BeautifulSoup模块,把

[转]在NopCommerce中新增一个Domain Model的步骤

本文转自:http://www.cnblogs.com/aneasystone/archive/2012/08/27/2659183.html 在NopCommerce中新增一个Domain Model,需要以下几个步骤: 1. 新建一个Entity Class (Nop/Core/Domain/Entity.cs) 2. 新建一个Mapping Class (Nop/Data/Mapping/EntityMap.cs) 3. 新建一个View Model (Nop/Admin/Models/E

UI中新增一个右击按钮的过程

1.首先给出增加之后的成品 点击后的界面 3.需要增加的部分 新增一个类:DiglogAddUser  用于操作用户填写的数据,写入数据库等操作 3.1首先在资源文件中定义窗口代号 3.2 枚举出该代号 3.3 对点击后的窗口参数进行操作 3.4 在窗口数表中注册函数 3.5 注册函数的同时,需要定义函数的ID 3.6 以及在资源文件中添加与树表对应的菜单项 3.7 接下来写响应函数 3.8 以及点击后的响应函数 4.对在addbs函数添加响应的操作 原文地址:https://www.cnblo

linux中新增一个shell命令的方法

1. 可以在一个自己建立的shell脚本中定义一个函数,使用 ". xxx.sh" 或者 "source xxx.sh" 运行这个shell脚本之后,其中的function就自动成为了当前shell中的新增命令了. 2. android编译配置环境时会运行. build/envsetup.sh脚本,就是使用这种方法为当前shell新增了一些命令,如:croot, lunch, mm, mmm, mma, cgrep等等.一直以为envsetup.sh中做了什么高级操

HTML5中的新增元素

HTML5中新增了大量的元素与属性,这些新增的元素和属性使HTML5的功能变得更强大,使网页设计效果有了更多的实现可能. 新增的主体结构元素section元素<section>标签定义文档中的节,比如章节,页眉,页脚或文档中的其他部分.它可以与h1,h2,h3,h4,h5,h6等元素结合起来使用,显示文档结构.<section> <h1>...</h1> <p>...</p></section> article元素<

Android Handler机制 (一个Thead中可以建立多个Hander,通过msg.target保证MessageQueue中的每个msg交由发送message的handler进行处理 ,但是 每个线程中最多只有一个Looper,肯定也就一个MessageQuque)

转载自http://blog.csdn.net/stonecao/article/details/6417364 在android中提供了一种异步回调机制Handler,使用它,我们可以在完成一个很长时间的任务后做出相应的通知 handler基本使用: 在主线程中,使用handler很简单,new一个Handler对象实现其handleMessage方法,在handleMessage中 提供收到消息后相应的处理方法即可,这里不对handler使用进行详细说明,在看本博文前,读者应该先掌握hand

Yii AR中处理多表关联的relations配置

关系型 Active Record官方文档中指出: 两张表之间的关联是根据外键来的,但是这种外键关联虽然在数据容错方面有益处,但是在性能上是个损伤,所以,一般是不定义外键的. 这种情况下,他们之间的关联又会根据什么来呢? 有A,B两张表,在A与B表中都存在一个字段filedX,并且同时字段filedX也是A,B的关联字段,这种情况下,可以直接 public function relations() { // NOTE: you may need to adjust the relation na

C# 7.0 中的新增功能

来源:Mark Michaelis 链接:msdn.microsoft.com/magazine/mt790184   解构函数 从 C# 1.0 开始,就能调用函数,就是将参数组合起来并封装到一个类中的构造函数.但是,从来没有一种简便的方式可将对象解构回其各个组成部分.例如,假设有一个 PathInfo 类,它采用文件名的每个元素(目录名.文件名.扩展名),并将它们组合成一个对象,然后支持操作对象的不同元素.现在,假设你需要将该对象提取(解构)回其各个组成部分. 在 C# 7.0 中,通过解构

Android中Service的一个Demo例子

Android中Service的一个Demo例子  Service组件是Android系统重要的一部分,网上看了代码,很简单,但要想熟练使用还是需要Coding.  本文,主要贴代码,不对Service做过多讲解.  代码是从网上找的一个例子,Copy下来发现代码不完全正确,稍微修改了下.  AndroidManifest.xml <application android:icon="@drawable/ic_launcher" android:label="@stri