Documente Academic
Documente Profesional
Documente Cultură
NET - Tutorial
Kentico CMS helps you build dynamic web sites with a full-featured web content management solution.
This tutorial will help you become familiar with Kentico CMS and its primarily intended for developers.
Should you need any help, please feel free to contact us at support@kentico.com or call 1-888-225-2767.
If you need more detailed information on some topic, please see Users Guide or Developers Guide that
can be found in Start -> All Programs -> Kentico CMS 1.x menu.
1 www.kentico.com
Table of Contents
Chapter 1 - Kentico CMS Installation ........................................................................................................ 3
Chapter 2 Kentico CMS Overview ......................................................................................................... 5
Chapter 3 Content Editing ..................................................................................................................... 7
Chapter 4 File Management ................................................................................................................ 10
Chapter 5 - Security Administration ........................................................................................................ 12
Authentication..................................................................................................................................... 12
Management of Users and Roles ........................................................................................................ 12
Authorization....................................................................................................................................... 12
Secured Web Site Areas..................................................................................................................... 14
Chapter 6 Versioning and Workflow..................................................................................................... 15
Versioning and Content Locking.......................................................................................................... 15
Workflow............................................................................................................................................. 16
Chapter 7 - Development of Page Templates ......................................................................................... 18
How Page Templates Work................................................................................................................. 21
Adding Your Own Code to the Page.................................................................................................... 21
URL Format........................................................................................................................................ 22
Chapter 8 Creating a Web Site from Scratch ....................................................................................... 23
Installing a Blank Project..................................................................................................................... 23
Adding Kentico CMS Controls to Your Toolbox ................................................................................... 23
Setting the Project Namespace ........................................................................................................... 23
Step 1 - Creating the Header of the Site.............................................................................................. 25
Step 2 - Making the Home Page Editable............................................................................................ 28
Step 3 Creating the Services Section ............................................................................................... 30
Step 4 Creating a Product Catalog ................................................................................................... 33
Step 5 Modifying the Transformations .............................................................................................. 37
Step 6 Displaying the News Section and the Latest News ................................................................ 39
Step 7 Creating a Contact Page with Contact Form.......................................................................... 42
Step 8 Adding Search Capabilities ................................................................................................... 46
Step 9 Adding the Site Map.............................................................................................................. 49
Step 10 - Using Custom Document Types.......................................................................................... 50
Step 11 - Adding The Editing Buttons................................................................................................. 53
Step 12 Creating a Multilingual Web Site.......................................................................................... 54
Step 13 Integrating the Newsletter Module ....................................................................................... 56
Step 14 Creating Controls for Insertion into the Text......................................................................... 57
Step 15 Creating On-Line Forms...................................................................................................... 59
Step 16 Other Modules .................................................................................................................... 60
2 www.kentico.com
3 www.kentico.com
If youre using Windows 2000 or Windows XP, grant the <machine>\ASPNET account with
Modify permissions.
If youre using Windows Server 2003, grant the NT AUTHORITY\NETWORK SERVICE account
with Modify permissions.
Windows 2000/XP
4 www.kentico.com
5 www.kentico.com
The development of page templates will be described in more detail later in this tutorial.
You will learn more details on content editing in the next chapter.
6 www.kentico.com
Kentico CMS is delivered with powerful editing interface called Kentico CMS Desk. Click the link Click
here to sign in at the top of the sample Corporate Site or navigate to
http://localhost/KenticoCMS/cmsdesk. You will be redirected to the logon form of Kentico CMS Desk. Use
the following credentials to sign in:
User name: administrator
Password: leave the password blank
Now you can see the following sections in the main menu:
Note 1: We will not use the advanced features, such as versioning and workflow in this chapter. These
features are described later in this tutorial. Without versioning, all changes are published on the live web
site immediately.
Note 2: The Corporate Site is only a sample web site created for demonstration purposes. Youre
definitely NOT limited to its structure, page layout, design or predefined document types. Instead, you
have full control over your web site and you can create any structure or design as if you were not using
Kentico CMS.
7 www.kentico.com
Click the Published version radio button in the dialog header to see what the live web site looks like.
Now click the Edit button in the main toolbar. You will see the editing form that allows you to modify page
properties, such as page caption in the navigation, page template, title, description, etc.
Caption: Service 3
Page type: Page template
Page template: click Select and choose the Services template in the Page Templates Catalog.
Click OK to save. Now click Site in the main toolbar and enter some content. Click Save to save the
changes. As you can see, you can create pages based on the page templates prepared by web
developer. You will learn how to develop such page templates for content editors later in this tutorial.
8 www.kentico.com
Document paths
As you have seen, all documents are stored in the tree hierarchy. Page is just another document type.
Each document has its unique path. There are four types of path:
ID Path consists of document IDs, such as /10/15/134. You can use this path in your code for dynamic
links.
Alias Path consists of document aliases, such as /products/category A/product A1. This path
doesn't change when you modify document name and it is used for URL rewriting, so that you can use
friendly URLs, such as http://www.myweb.com/products/category A/product A1.aspx.
Name Path consists of document names, such as /products/category A/product A1. This path is used
in bread crumbs navigation control and in other cases when path should be displayed to the end user.
URL Path is a special path that you can specify for every document. If its specified, it can be used for
URLs instead of Alias Path. Unlike Alias Path, the URL Path does not depend on the location of the
document in the tree structure.
You can find all of these paths, when you click Properties in the main tool bar. In this dialog, you can also
modify document alias which changes the URL of the document.
9 www.kentico.com
10www.kentico.com
10
11www.kentico.com
11
Authentication
Kentico CMS uses forms authentication by default. All user names and passwords are saved in Kentico
CMS database and users need to enter their user name and password in the logon form.
For intranets or extranets, you can also use Windows authentication. In this case, Kentico CMS
database contains only user names and users are recognized by their Windows domain identity, so they
do not need to enter their password again. You can find more details on this configuration in the
Developers Guide -> Installation and Deployment -> Configuration of Windows Authentication.
Authorization
You can manage two levels of permissions:
Global permissions used for modules, for all documents or for documents of particular type.
Local permissions used for single documents or sections of your web site.
Global Permissions
The global permissions can be managed in the Administration module, in section Permissions. They
can be assigned only to roles.
Module Permissions
Choose CMS Development module in the Permission matrix dropdown list and click Show. Now you
can modify permissions for the Development module of Kentico CMS Desk.
All Content Permissions
12www.kentico.com
12
Document-Type Permissions
Choose Article document type in the Permissions Matrix dropdown list and click Show. Now you can
modify permisions for all documents of type Article. These permissions override the local permissions,
too.
Local Permissions
Local permissions allow you to set up permissions for particular document or site section. They can be
modified in the Content module of Kentico CMS Desk. They use a similar philosophy as Windows file
system (NTFS) permissions, but all these settings are stored in the Kentico CMS database without
affecting the disk permissions.
Document-Level Permissions
Choose the News/Your First News document in the tree view of the Content module and click the
Permissions button in the main toolbar. Now you can see the list of users and roles. When you select
some user or role, their permissions are displayed in the right part of the dialog. Try to add some
additional user or role to this list using the Add button and set up their permissions. Click OK to save
changes.
13www.kentico.com
13
Section-Level Permissions
Choose the News document in the tree view of the Content module. When you modify permissions for this
document (for section News), all changes are propagated to underlying documents in the section. In this
way, you can easily set up permissions for particular sections of the web site. You can use the Change
permission inheritance link to break inheritance of permissions from parent documents.
14www.kentico.com
14
However, you can easily set up a versioning and workflow scenario for selected document types:
15www.kentico.com
15
Workflow
You can define different workflows for different types of documents. In this short demo, we will define a
simple workflow for approving news items.
Creating Users and Roles
First, please create two users in Administration -> Users:
User Alice Murphy, the news editor:
User name: alicem
Full name: Alice Murphy
E-mail address: enter your e-mail address
Password: (leave empty)
Assign Alice to role CMS Editors.
User John Smith, the PR manager:
User name: johns
Full name: John Smith
E-mail address: enter you second e-mail address
Password: (leave empty)
Now create a new role PR Managers. Assign John to roles:
PR Managers
CMS Editors
Defining the Workflow
Go to the Development module and choose the Workflows section in the left tree view. Click the New
button in the main toolbar and enter the following values in the Workflow Properties dialog:
Worfklow display name: News Approval
Workflow name: NewsApproval
Click OK to save changes. Now you can modify workflow steps below. Please note that there are always
two steps: Edit and Published. You can add virtually any number of your custom workflow steps between
them. The document must pass all workflow steps from Edit to Published.
Click the plus button and add the following step:
16www.kentico.com
16
17www.kentico.com
17
18
19www.kentico.com
19
RegionType the type of the editing control displayed in the editing mode. Possible values are
TextBox, TextArea and HtmlEditor.
DialogHeight the height of the editing control.
DialogWidth the width of the editing control.
The CMSEditableRegion2 control creates an editable region that allows you to edit/display the page text.
It uses similar settings as the CMSEditableRegion1 control, but it is displayed as HTML editor in the
editing mode.
CMSPageManager and CMSEditableRegion controls allow you to make the page editable. This
approach is suitable for pages with simple text-only content. Later in this tutorial, you will learn how to
create pages with product listings and product details with strictly structured and typed data.
Compiling the Project
Now you need to compile the project (CTRL+Shift+B). You need to do this every time you add a new page
to the project.
Registering the New Page Template
Now that you have created and compiled a new page template, you need to register it in Kentico CMS
Desk so that content editors can use it. Open Kentico CMS Desk and go to Development -> Page
Templates. Click the New button in the main toolbar and enter the following values:
Click OK to save the new page template in the Page Template Catalog.
20www.kentico.com
20
As you can see, page templates are standard ASP.NET pages that receive the aliasPath parameter in the
URL and display appropriate content. The aliasPath value is the path of the document in the tree hierarchy
of content. The controls automatically get the aliasPath parameter and display appropriate content.
21www.kentico.com
21
URL Format
Kentico CMS uses friendly (or smart) URLs in format /products/category 1.aspx by default. You can
configure extensions such as .html or any other using the following web.config key in the appSettings
section:
<add key="CMSFriendlyURLStyle" value=".html" />
However, you will need to map the .html extension to the ASP.NET engine in the IIS console, in the
web site or virtual directory properties.
If you want to use the URLs without extension (in format /products/category 1), you need to set up the
following keys in the web.config:
<add key="CMSFriendlyURLStyle" value="" />
<add key="CMSGenerateFriendlyUrlFiles" value="true" />
If you need to add pages to your web site that will not be managed by Kentico CMS, you can exclude
them from URL rewriting using the following web.config parameter:
<add key="CMSExcludedDirectories" value="/register;/shop />
More on Development
This was a small example of creating a new page template. Later in this guide, you will see how to create
the whole web site from scratch.
22www.kentico.com
22
23www.kentico.com
23
24www.kentico.com
24
Now remove the extra characters logo and menu (we used them only for placing the controls on the
right place):
25www.kentico.com
25
SelectNodesPath: /logo
SelectNodesClassName: cms.article
TransformationName: cms.article.articletext
The CMSViewer control is used to display specified document or several documents. We will use it to
display an article with logo and header text. It is an example of how you can reuse content on several
pages with Kentico CMS.
The document is specified using the SelectNodesPath property which is actually the alias path of the
document in the tree hierarchy of content. You can find this path in the CMS Desk -> Content -> ... select
document -> click Properties in the main menu -> find the Alias Path value. /logo is the path to the
document that we will create later.
The SelectNodesClassName property specifies the type of the document that should be displayed.
The CMSViewer control uses transformation specified in the TransformationName property to display the
document on the page. The transformations are defined in the CMS Desk -> Development -> Document
Types -> Application: CMS -> ... select document type e.g. an article ... -> Transformations. The
transformation is either an XSLT stylesheet or an ASCX control (HTML code with standard ASP.NET
databinding expressions). The transformation cms.article.articletext is an XSLT transformation that
displays only article text without article name.
CMSMenu
SelectNodesPath: /%
Layout: Horizontal
The CMSMenu control displays a dropdown menu. You can also use CMSListMenu, CMSTreeMenu or
CMSTabControl in your projects.
The SelectNodesPath property specifies which menu items should be displayed. The value /% means
that all items under the root will be displayed (its similar to C:\*.* expression you know from DOS). Please
note that the CMSMenu displays only documents of type Page (menu item) by default, but this can be
overriden using the property SelectNodesClassNames.
We wil not implement the search functionality at this moment.
Displaying the Header on the Home Page
Now that we have created the header control, we can simply drag and drop the control on the default.aspx
page, which is the home page. Please do that, remove the original temporary text and run the web project.
(you may need to set the default.aspx page as the start page). You should see a page like this:
26www.kentico.com
26
The content is not displayed as we havent created it yet. Click on the link Click here to sign in... and sign
in as administrator (with blank password) to Kentico CMS Desk. Choose the Content module in the main
menu and create the following documents:
/Home (page/menu item document)
Caption: Home
Order: 1
Page Template: Home page
Leave other fields empty or use the default values and click OK to save. This page will represent the home
page link in the main menu.
Click on the root item again and create a new folder Files and upload some logo image into this folder.
Create a new article under the root:
/logo (article)
Article name: Logo
Article text: Click the Insert/Edit Image icon in the WYSIWYG editor and click Browse Server.
Select the uploaded file and click the Paste Image link. Click OK to confirm the Image Properties
dialog.
Click OK to save. You should have the following document structure in the left tree view:
Now click on the root item and choose Site in the main toolbar. You will see a preview of the web site:
We have created the web site header. You could create the web site footer in the same way. As you can
see, we were using standard ASP.NET features and Kentico CMS Controls to display the logo article and
the main menu.
27www.kentico.com
27
28www.kentico.com
28
In this step, we have made the home page editable. Of course, you can define several editable regions on
a single page. This approach is recommended for pages with unstructured content. Later in this chapter,
you will see how to display structured documents (a catalog of products).
29www.kentico.com
29
The first lines with <%@ Register ... %> directive register Kentico CMS Controls and other libraries on the
page so that you can use them. They also register the header control. They are followed by document
definition and by standard HTML page code.
The <head> section contains the GetPageTags method that renders page title, description and keywords
metadata and the link to the main.css file.
The <div> elements inside the <form> section define the layout of the page. Please switch to the Design
mode now. Drag and drop the following controls on the form and set their properties:
CMSPageManager (inside the header section)
Header.ascx (just after the CMSPageManager)
30www.kentico.com
30
Now that we have created a new page template (services.aspx), we need to register it in the Page
Template Catalog so that the content editors can use it.
Run the project and sign in to Kentico CMS Desk. Go to Development -> Page Templates. Add the new
page template by clicking the New button in the main toolbar. Enter the following values:
Page Template Name: Services
Page Template File Name: services.aspx
Click OK to save. Now the content editors can use this template.
Go to the Content section and create a new page (menu item) under the root with the following values:
Caption: Services
Order: 2
Page Template: Services
Leave the other values empty or use the default values. Click OK to Save.
After you create the new page, click on the Site icon in the main toolbar and enter some text in the Page
Header and Page Text editable regions. Click Save to save the changes.
31www.kentico.com
31
Click Services in the left tree view, click New in the main toolbar and create a new page. Enter the
following values:
Caption: Service 1
Page Template: Services
Click OK to save changes. Switch to the Site view and enter some text in the editable regions. Click Save
to save changes.
You can try to create other pages in this section now. As you can see, we have created a re-usable page
template with main menu, left sub-menu and editable regions.
32www.kentico.com
32
Switch to the Design mode and drag and drop the following controls on the page and set their properties:
Header.ascx (inside the header section)
CMSTreeMenu (inside the menu section)
SelectNodesPath: /products/%
DisplayHighlightedItemAsLink: True
Indentation: 3
CMSBreadCrumbs (inside the content section)
CMSDataList (inside the content section)
SelectNodesClassName: cms.product
33www.kentico.com
33
TransformationName: cms.product.preview
SelectedItemTransformationName: cms.product.default
RepeatColumns: 2
CellPadding: 5
The CMSDataList control is one of the controls that allow you to display lists of documents (such as
product listings, list of news, etc.). You can also use CMSDataGrid and CMSRepeater. All of these
controls are inherited from the standard ASP.NET DataList, DataGrid and Repeater, but they are much
easier to use.
The CMSDataList control allows you to display the list of documents and the detail view of the selected
document. The SelectNodesClassName property specifies the type of documents that should be
displayed (products). The SelectNodesPath property is not set now which means that the control
automatically retrieves all documents under current site section (under /products/%, under
/products/category A/%, etc.). The TransformationName property specifies the ASCX transformation that
is used to display items in the listing. It is an alternative way to specifying the ItemTemplate section in the
HTML mode. The SelectedItemTransformationName property specifies the ASCX or XSLT
transformation that is used to display the selected item. We will take a closer look at transformations in the
next step. The RepeatColumns property defines the number of columns and the CellPadding property
defines the padding of every item.
After you remove temporary text, you will see a page like this:
Run the project and sign it to Kentico CMS Desk. We need to register the new page template first. Go to
Development -> Page Templates and register the new page template with following values:
Page Template Name: Products
Page Template File Name: products.aspx
Go to the Content module and create a new page with following values under the root:
Caption: Products
Order: 3
Page Template: Products
Leave the other values empty or use the default values. Click OK to save changes.
Select the newly created Products document in the treeview and create the following pages under
Products:
Caption: Category 1
Page Template: Products
Caption: Category 2
Page Template: Products
34www.kentico.com
34
As you can see, we have used pages as containers for products. This allows content editors easily locate
the products and modify them. Its also easy for you to display such content on the page. Kentico CMS
allows you to create up to 14 levels of nested documents/pages.
Later in this tutorial, you will learn how to define your own document types (such as house, car, PC, etc.)
with custom fields.
35www.kentico.com
35
Separate Documents
36www.kentico.com
36
transformation
specified
in
the
How It Works
You may wonder how the DataList knows when to display the listing or the detail view:
When you choose the Products page, the DataList receives the current URL, such as
http://localhost/KenticoCMS/Products.aspx. It parses the URL and retrieves the selected path
/Products, which is a path to page. The DataList understands that this is a page and it should
display the listing.
As you can see the redirection to the detail view is ensured by redirecting the user to the appropriate
URL instead of using postback. It also means that every document and every page has its own URL and
you can copy the current URL from the address bar and send it to some other person without worrying if
he/she gets the same page.
Now we will take a closer look at the transformations. Sign it to Kentico CMS Desk and go to the
Development module -> Document Templates -> Application: CMS -> Product -> Transformations.
Here you can find the default and preview transformations.
Click to edit the preview transformation. You will see a code like this (we have removed extra code that is
not important for you now). It is used for displaying every document:
37www.kentico.com
37
As you can see, it is actually a standard ASP.NET code. You can use expressions, such as
<%# DataBinder.Eval(Container, "DataItem.ProductPrice") %>
to insert appropriate values in the HTML code. When you need to render an URL of the displayed
document, use the following expression:
<%# CorporateSite.Functions.GetUrl( DataBinder.Eval(Container,
"DataItem.AliasPath")) %>
It uses the CorporateSite.Functions.GetUrl method that ensures you get a working URL.
Please note: If your project is called WebProject, you may need to refer to the method as
WebProject.Functions.GetUrl(...).
When you need to display an image that was selected by content editor using the image selection field,
you can use an expression like this:
<img src='<%# ResolveUrl("~" & Server.UrlPathEncode(DataBinder.Eval(Container,
"DataItem.ProductPhoto"))) %>'>
It uses standard ASP.NET methods to get the image URL.
Using XSLT
If you prefer using XSL transformations, you can define a new transformation and choose the XSL
option. Then click the Use Default Transformation button and you get a basic XSL code for your
document type that you can modify.
Now that you understand the code, you can try to modify the default and preview transformations so that
they display different fields or different design.
38www.kentico.com
38
39www.kentico.com
39
Run the web project and go to Kentico CMS Desk -> Development -> Page Templates. Register the
new page template with following values:
Click OK to save. Go to the Content module and create a new page under the root with following values:
Caption: News
Order: 4
Page Template: News
Leave the other values empty or use the default values. Click OK to save changes.
Click the News item in the tree view and create two documents of type news under this section. Use the
current date and time in the Release Date field.
When you go to the live web site now, you will see a page like this:
When you click on some news item, its full text is displayed.
QueryName: cms.news.selectlatest
TransformationName: cms.news.preview
The QueryRepeater executes the query specified in the QueryName property and displays returned
records using the ASCX transformation specified in the TransformationName property.
Switch to the HTML mode and make sure the QueryRepeater is placed inside the <DIV> element with
class=ContentNewsPadding.
40www.kentico.com
40
Run the web project and see the web page. It should look like this:
As you can see, the QueryRepeater control (and also the QueryDataGrid and QueryDataList controls) is
useful in situations when you need to run a special query, not just retrieve all documents from the selected
web site section. The option of writing your own queries gives you the same flexibility as you would have
in pure ASP.NET, but it makes the whole task much easier.
41www.kentico.com
41
42
ID: MainText
RegionTitle: Main Text
Region Type: HTML Editor
DialogHeight: 400
DialogWidth: 700
Now we will write code that sends and e-mail with entered message. Double-click the button, you will be
redirected to the code behind. Add the following code at the beginning:
[VB.NET]
Imports System.Web.Mail
[C#]
using System.Web.Mail;
43www.kentico.com
43
44www.kentico.com
44
Enter a valid e-mail address and message text and send the message. You should receive it to your email. This page template shows you how you can combine Kentico CMS content with your own code.
45www.kentico.com
45
46www.kentico.com
46
Run the project and sign in to Kentico CMS Desk. Go to Development -> Page Templates and register
the new page template with following values:
Page Template Name: Search
Page Template File Name: search.aspx
Go to the Content module and create a new page under the root with following values:
Caption: Search
Order: 5
Page Template: Search
Leave the other values empty or use the default values. View the page in the Site mode. You will see a
page like this:
Enter some word and click Go. Verify that the result links redirect you to the correct document.
Set the text of the button to Go. Double click the button and add the following code to the event handler:
47www.kentico.com
47
{
CMSSearchDialog1.SearchExpression = Request.QueryString["SearchText"];
CMSSearchResults1.SearchExpression = Request.QueryString["SearchText"];
CMSSearchResults1.CMSSearchDialogID = "";
}
else
{
CMSSearchResults1.CMSSearchDialogID = "CMSSearchDialog1";
}
Run the web project. Enter some text in the search textbox and clicko Go. You should see search results
on the search.aspx page.
If you do not want to display the Search page link in main menu, sign in to Kentico CMS Desk, edit the
/Search page and check the Hide in Navigation checkbox.
48www.kentico.com
48
49www.kentico.com
49
In step 2, you need to specify the name of the database table and of its primary key. This database table
will store information about computers. Leave the default values and click Next.
In step 3, you can define the attributes of the new document type Computer. These attributes are
automatically created in the CMS_Computer table and they are displayed in the editing form. Enter the
following attributes:
Name
ComputerName
ComputerDescription
ComputerMemory
ComputerProcessor
Type
Text (100)
Long Text
Integer
Text (100)
Allow Empty
No
No
No
No
Field Caption
Name
Description
Memory (MB)
Processor
ComputerPhoto
Text (400)
Yes
Photo
Field Type
TextBox
HTML Area
TextBox
Drop-down List
Options:
Intel;Intel
AMD;AMD
Image Selection
Click Next to continue to step 4. Now you can choose the document attribute that will be used as a
document name. Its value will be displayed in the tree structure of documents in the Content section and it
will be used in site navigation. Choose the ComputerName field. Uncheck the Use versioning and
workflow box. Click Next.
In step 5, choose only the Page (Menu Item) in the listbox. It means that documents of type computer can
only be placed under some page. Click Next.
The wizard now finishes the configuration of your new document type. It generates SQL queries for
SELECT, UPDATE, INSERT, DELETE and search and it creates a default transformation.
50www.kentico.com
50
51
Now switch to the Design mode, display the properties of the CMSDataList control and set the following
properties:
SelectNodesClassName: cms.computer
TransformationName: cms.computer.preview
SelectedItemTransformationName: cms.computer.default
We have changed the properties so that the control displays computers instead of products. Compile and
run the application. Go to the CMS Desk -> Development section and register the new page template
with name Computers and file name computers.aspx in the Page Templates section. Go to the
Content section and create a new page under the Products section. It will use your new Computers
page template. Then create one or two documents of type Computer under that page:
When you see the live page, it will look like this:
As you can see custom document types greatly simplify your daily job when developing a web site the
wizard generates database table, SQL queries and you can define the editing form without programming.
Displaying them on a web site is much easier than with pure ASP.NET you only drag and drop the
appropriate control on the web form and set a few properties without writing a single line of code!
52www.kentico.com
52
The page contains also the editing button for each product. This button was not displayed using our
control, but it was already defined in the ASCX transformation cms.product.preview.
53www.kentico.com
53
Culture Code
en-us
fr-fr
de-de
Now move all content except the culture versions under the en-us document as we will use English as the
default language. Your site structure will look like this:
Now go to the Administration module -> Users, edit user and set the Starting alias path value to /en-us
(repeat this for all users). It ensures that the editors can work only with the default culture and dont cause
any inconsistency in the document culture versions.
Open the web.config file, set the CMSUseMultilingualSupport key value to true and save it. As the
Files folder was moved on the disk under the en-us folder, you need to move the folder on the disk back
under the root of the web site since the URL of files and documents doesnt contain the culture code.
54www.kentico.com
54
Now when you click on French, you will see the home page in French. The non-translated items will not be
displayed. You can optionally choose that the non-translated items should be displayed in the default
language (English). It can be configured on the control level (CombineWithDefaultCulture property) or
globally, by adding the following web.config parameter:
<add key="CMSCombineWithDefaultCulture" value="true"/>
As you have seen, Kentico CMS allows you to easily convert single-language web site into a multilingual
site.
55www.kentico.com
55
Add the following code below the QueryRepeater control that displays the latest news:
<cc4:NewsletterSubscriptionDialog id="NewsletterSubscriptionDialog1" runat="server"
NewsletterNodePath="/News/Newsletters/Newsletter 1" />
The NewsletterSubscriptionDialog control displays a text field with submit button. When the user enters
his/her e-mail address and clicks the button, he/she is subscribed to the newsletter with alias path
specified in the NewsletterNodePath.
Run the project and subscribe to the newsletter. You should receive a confirmation e-mail. You can also
check your subscription details in the Kentico CMS Desk -> Tools -> Newsletter where you can manage
all subscribers and their subscriptions.
Click OK to save it. You should receive an e-mail within 2 minutes. If you do not receive it, please click the
/News/Newsletters/Newsletter 1 document, choose the Site mode in the main toolbar and see how many
e-mails were sent and what the last result was.
56www.kentico.com
56
You need to create dynamic listing, such as Latest news that can be displayed on several pages
without modifying their page templates.
You need to insert custom dialog or functionality into the text depending on the content editors
choice without programming.
[C#]
public class Top3News : Kentico.CMS.CMSControls.InlineUserControl
Switch to the HTML mode and add the following code under the <%@ Control ... %> directive:
<%@ Register TagPrefix="cc1" Namespace="Kentico.CMS.CMSControls"
Assembly="Kentico.CMS.CMSControls" %>
<h2><asp:Label id="lblTitle" runat="server"></asp:Label></h2>
<cc1:QueryRepeater id="QueryRepeater1" runat="server"
QueryName="cms.news.selectlatest" TransformationName="cms.news.preview">
</cc1:QueryRepeater>
Switch to the design mode. You should see something like this:
The QueryRepeater will display the latest news. Go to the code behind and add the following code to the
Page_Load method:
[VB.NET]
lblTitle.Text = me.Parameter
[C#]
lblTitle.Text = this.Parameter;
The Parameter property provides the value of the optional parameter of the inserted control. It will contain
the title text.
57www.kentico.com
57
Click OK to save it and go to the Content section. Edit the content of the Services page. Click the Insert
User Control button In the WYSIWYG editor toolbar. The Insert User Control dialog appears. Select the
Top 3 News user control and enter My Latest News in the Title parameter value.
Click OK to insert the control. The following text will be inserted in the WYSIWYG editor:
%%control:TopNews?MyLatestNews%%
Please note: you can insert such expressions directly in the text without using the Insert User Control
dialog. You can even use it in plain textboxes and textareas.
Save the page and see the live page. You will see something like this:
Please note: the user controls inserted into the text are correctly displayed only if you use Kentico CMS
controls and ASCX or XSL transformation.
58www.kentico.com
58
Click OK to save the new form. Now you will define form fields. Use the Add New Field button and create
the following fields:
Caption
Your name
Code name
FullName
Type
Textbox
Your e-mail
Textbox
Message
Message
Textarea
Settings
Maximum
length = 100
Maximum
length = 100
Empty
No (uncheck
the box)
No (uncheck
the box)
No (uncheck
the box)
Default
Now that we have defined the form, we will insert it on the page. There are two ways how to do that:
1. Programmatically you will insert the Kentico.Form.BizForm control on the page and its
parameters. You can find more details in Kentico CMS Developers Guide -> Extending Modules > BizForms.
2. In the text you will insert a user control into the text (similarly as you did in the previous
chapter).
We will use the second (easier) option. Go to the Content section and edit the /Services document. In the
WYSIWYG editor, click the Insert BizForm button. The Insert BizForm dialog appears. Click your new
form Contact Us.
The following expression is inserted into the text: %%control:BizFormControl?ContactUs%% (you can use
the Insert BizForm button in the WYSIWYG editor toolbar to insert the form).
It is then dynamically replaced with user control when the page is displayed. Save the page and switch to
the published page. You will see your new form like this:
59www.kentico.com
59
E-Commerce
The E-commerce module allows you to integrate a shopping cart and management of orders to your web
site.
Content Staging
The Content Staging module allows you to synchronize content between several instances of Kentico
CMS for staging (preview) or development purposes.
File Import
The File Import module allows you to import specified folders and files into Kentico CMS.
On-line Gallery
The On-line Gallery module allows you to easily create galleries of images with previews and detailed
views. The images are automatically resized to specified size for faster download.
Forums
The Forums module allows you to add discussion forums to your web site. The forums can be organized
into several groups. The posts are displayed in the conversation hierarchy and can be moderated.
This is the end of this tutorial. If you need more details on some topic, please see Kentico CMS
Developers Guide or contact us at support@kentico.com.
60www.kentico.com
60