Another frequent asked questions

 Objective

  •     Allow obstabcle-free upgrading via copying Cms_Data.
  •     Allow to change the site name while importing or exporting the site.


Reference script

You can make all the js files under the directory Scripts automatically referenced by using @Html.FrontHtml().RegisterStyles(). All the js files under the directory Scripts can be sequenced by Order.txt.

 Reference stylesheet

You can make all the stylesheet files under the themes of the site automatically referenced by using @Html.FrontHtml().RegisterStyles(). All these stylesheets can also be sequenced.

Reference custom file

To reference custom file like favicon.ico, you can put the file under the directory Files of the site and then reference it by using API @Url.FrontUrl().FileUrl("favicon.ico"), which also supports relative directory. For example: @Url.FrontUrl().FileUrl("images/favicon.ico").

Label and HTML block

Label is a pure-text-inclinded multilingual resource. However, HTML block needs to be able to be shared among sites. The Inline editing on the front end will also provide editor by following this purpose. Label is pure text editor, while HTML block allows end users to edit using rich text editor.

 Custom settings on the site

When you need to add some configurations like invoking an address of a specific remote service etc., you may think about to add some settings in Web.config. However, in Kooboo CMS, modification to web.config might cause troubles to upgrading. So it is suggested not to modify the Web.config in Kooboo CMS. For example, each data connection string has an independent configuration files. There are two ways you can use to solve this problem

  •     When you need to configure connection strings for a site, the best choice will be using the CustomSettings in the site's Settings.
  •     For configurations that have to be modified in Web.config, e.g. adding the global namespace Using, you can try to add a new Web.config in the site. Note: the new Web.config you created needs to be a directory, similar as the Web.config under Views.

 How to create service API like JSON

We used to implement the service API by using solutions like adding a blank page, creating some self-defined Controllers and modifying routes.config, or adding some ASHX. However, as we can see now, those solutions are the not the best solutions. The best solution is to use the AreaRegistration of Area ( Area that doesn't have View) to register mini-area. You only need to put this mini-area and plugin into the same assembly, and that is done, no more configuration needed. Please visit Kooboo.CMS.Toolkit.Controls for examples.

 How to replace Kooboo CMS internal components

All the components that provided by Kooboo CMS are all capable of being replaced. For example, some projects might requires special form generating model, you can just replace the the form generating component directly in this case. Kooboo.CMS.Toolkit.DisplayTemplateInGrid is a Grid self-defined template that supports the Grid fields outputing. The way to to use the Kooboo.CMS.Toolkit.DisplayTemplateInGrid is adding a self-defined setting for the field Custom settings: DisplayTemplate: @(item.title ?? \"\")

Building your custom control type is recommended

It is suggested not to implement the controls, those that are not built-in in Kooboo CMS, in the way of manually modifying the template. But you can implement them by developing some extension controlers. This makes it easier to update templates while modifying the fields. Please refer to Kooboo.CMS.Toolkit.Controls to know more.

How to reference JQuery and verify fields at frontend

Check the JQuery checkbox of the Settings of the site. The JQuery controls including jQuery.validation, Unobtrusive verification package, will be automatically referenced at frontend. So the Unobrusive verification feature of MVC3 can be sued at the front end directly. But you need to add the verification tags manually since they can not be generated automatically via modelmeta, view the example: [1]. While after upgrading to MVC4, you can use it by using more friendly API, the example: [2].

 <input type="text" name="course"
    value="@Request["course"]"     @Validation.For("course")/>

 Need to change from weak type strong type

Kooboo CMS uses content type in the way of Dictionary. The content types are weak type of key-value. Even thought you can use p.Title in the way of dynamic key, it is still the weak type. Weak type has the advantage of flexibility as well as its limitations. If there are many self-defined plug-ins in your project, we suggest you to define some strong type objects according to different content types to make it easy to use and modify as well as guarantee the safety for the type. There is a sample in Zhang Peng's Kooboo.CMS.Toolkit.

APIs not provided in Kooboo CMS

If there are some APIs that not provided in Kooboo CMS, we can discuss it together to see if we can implement them by adding some expand methods in assembly and integrate them into Kooboo CMS. If you don't want to modify Web.config, you can use the namespace Kooboo.CMS.Site.View directly while defining expand methods

 Build your modules

We can consider to implement feature modules that will be commonly used by using the Module. In this way, we can promote component sharing and this will be the only way for us to develop Kooboo CMS platform. The good quality of products is very important, but the development of eco-chain that centered by the products plays the key role in developing a successful platform.