Some frequent asked questions

How to get the QueryString value and route value

@{
var userKey = Page_Context.Current.PageRequestContext.AllQueryString["UserKey"]; //It will get the route value from the page route data, then get from the querystring in the request.
}

How to query the contents via content query API

You can easily query contents via Data Rule, a visual data query designer. However, sometimes you might need to query contents via query API in view. Kooboo CMS provides a set of fluent API with which you can query contents conveniently. This mechanism is quite similar to the LINQ style.

The content query API is under the namespace Kooboo.CMS.Content.Query. This means that you will have to use the namespace Kooboo.CMS.Content.Query before you can use the content query API.

Simple query from one text content folder

@using Kooboo.CMS.Content.Query;
@{
    var textFolder = ContentHelper.TextFolder("Articles"); // The Articles is the full name of text content. e.g: Articles~Comments is the Comments folder under the Articles.
    var contentQuery = textFolder.CreateQuery();//The result is a content query object, very like to the IQueryable.
    contentQuery = contentQuery.WhereEquals("UserKey", Page_Context.Current.PageRequestContext.AllQueryString["UserKey"]);//Filter by the UserKey value in the QueryString.
    var content = contentQuery.FirstOrDefault();// Fetch the content from database.
}
 


Query content categories

<ul>
@foreach(var category in ((Kooboo.CMS.Content.Models.TextContent)item).Categories(ContentHelper.TextFolder("Category"))) {
<li>@category["Title"]</li>
}
</ul>

 

Query contents by category

 
@using Kooboo.CMS.Content.Models
 
@functions{ 
    TextFolder newsFolder= ContentHelper.TextFolder("News");
    TextFolder categoryFolder = ContentHelper.TextFolder("Category");
    public IEnumerable<TextContent> GetByCategory(TextContent category)
    {
        return newsFolder.CreateQuery().WhereCategory(categoryFolder .CreateQuery().WhereEquals("uuid", category["uuid"]));
    }   
 }


OR expression

 
 query.Where(new OrElseExpression(new WhereEqualsExpression(null, "ParentUUID", null), new WhereEqualsExpression(null, "ParentUUID", "")));
 


 How to customize pagination

Kooboo CMS usually provides a default pagination helper to help developers to generate pagination html code quickly and easily. For example:
 
@Html.FrontHtml().Pager(ViewBag.Articles)
 
You might need to customize the pagination layout sometimes. If so, you just create a custom View to render the pagination html code. Since the data query from DataRule with paging setting is an object inherited from "Kooboo.Web.Mvc.Paging.IPagedList", you will be able to get all the pagination information from it.

 public interface IPagedList
    {
        int CurrentPageIndex { get; set; }
        int PageSize { get; set; }
        int TotalItemCount { get; set; }
        int TotalPageCount { get; }
        int StartRecordIndex { get; }
        int EndRecordIndex { get; }
    }

The simple view will be:


@model Kooboo.Web.Mvc.Paging.IPagedList

After the custom pagination View created, the paging code will be:

 
 @Html.FrontHtml().RenderView("Pagination", ViewBag.Articles)

How to send contact us email


How to build the release from source code

Some changes will be put into codeplex to fix some issues without publishing the released package. You may also want to publish it manually, such as: Latest changeset does not run. Begin from d82ff12342f5, you can do that easily by following steps below:

  1.     Download the source code.
  2.     Go to "Kooboo.CMS\Publish" and double click "Publish.bat"; you will get the site  published under "Web".



Where to customize the Tinymce settings

There are two places where you can edit Tinymce settings.

  1.     "views/shared/master.script.ascx", this setting will apply to HTML block, Content manager.
  2.     "Areas/Sites/Scripts/pageDesign/page.js"; this setting will apply to page designer.


Start from 3.2.1, just only change the settings in Scripts/tiny_mce_extension.js.


 Translate admin panel

Open the language file like "zh-CN.resx" under "I18N" folder to translate the admin panel.

Here are three language files:

  1.     German: File:German-i18n-for-kooboo-3-2-1.zip
  2.     Swedish: File:Sv-SE Kooboo.zip
  3.     Russian: File:Ru-RU.v1.0.zip



How to add custom field on site setting

You can add custom tabs on the site setting.

1. Download the sample template from File:CustomFields.zip, and edit it to add your custom fields.

2. Place the template file into 'Cms_Data\SiteTabs' or 'Cms_Data\{SiteName}\SiteTabs'.



How to add custom fields on page setting

You can add some custom tabs on the page setting.

1. Download the sample template from File:CustomFields.zip, and edit it to add your custom fields.

2. Place the template file into 'Cms_Data\PageTabs' or 'Cms_Data\{SiteName}\PageTabs' or '{LayoutTemplatePath}\PageTabs'.