Text and Binary Resource (v. 1.2, 2.0)

Site resources include Text resource and binary resource. Resource can be found at:
application --> design --> Text resource/binary resource.
Kooboo resource location

Binary resource



Binary resource directly uses physical files for storage. Folders and files are all managed by a file manager, only without version control.

Important Note: The inheritance concept does not fully apply to Binary resource. Sub sites can access resources of parent applications via inheritance but not able to localize them. Binary resource does not have localization and versioning features.

Binary resource can be accessed directly by resource URL. In the Binary Resource window, you can right click an item and select "Copy Cell" to copy the resource URL, or click "preview" icon to see full resource URL in the browser address bar.
Kooboo binary resource window
In order to make migration and deployment easier, Kooboo also offer API to access resource file.

Url.GetResourceFileUrl: Get the resource file URL. For example you have an image "winter.jpg" under a folder called "myfolder", you can access it by:


"~/" means starts from the Binary Resource root.

Url.ResolveUrl: Resolve the correct resource file URL. This is different from GetResourceFileUrl. You can use it like below with the full file path. This method includes the full path in order to be used by site inheritance situation. "~" will be resolved to correct base URL. This method was added on version 2.0.



Url.ResizeImageUrl: This is to resize image on the fly. Sample code see below.


Text Resource



Text resource is used for small text labels on websites. It is similar as the global resource of ASP.NET. There is a complete content API for managing Text resource.

The API to query Text resource is very simple.

public static string GetResource(this ICmsView cmsView, string key, string defaultValue)
public static string GetResource(this ICmsView cmsView, string strNamespace, string key, string defaultValue)

On Content template, you can use <%= this.GetResource("key","default value")%> to access the resource.

In case this key does not exist, Kooboo will create the key with the default value.

Text resource also supports namespaces/folders, you can create folders or sub folders and access them by using <%= this.GetResource("namespace1.namespace2","myKey","default value")%>

Text resource fully supports inheritance and localization.