Kentico Developer Issue 4

Page 1

Kentico Developer Issue 4 January/February 2010

PowerShell and the Kentico API Introducing Thom Robbins




14 Command line Kentico For all of those common tasks that you catch yourself running day in and day out, Martijn Schiferli presents a way to script

FEATURES

Kentico.

20 On Not Boiling the Ocean Introducing our latest contributor sees me also introduce one of the biggest things to happen to Kentico within the last couple of years - Thom Robbins.

32 JW Player Ralph Spandl writes about his latest coding efforts and ow these can be used to improve the out of the box video player offered by Kentico.

26 FA(Client)Q Candice Pendergast introduces some of the more useful aspects of the Kentico Partner Portal in relation to frequently asked client questions.

28 Ten Things on 5.0 Jeroen Furst highlights 10 things in Kentico 5.0 that make life working with Kentico so much easier for developers and admins alike.


Published by Not At All Strange Pty Ltd ABN 91 125 365 979 PO Box 353 Menai NSW Australia Enquiries Subscription enquiries: sales@kenticodeveloper.com Editorial enquiries: editorial@kenticodeveloper.com Advertising enquiries: advertising@kenticodeveloper.com

REGULARS

Copyright Kentico Developer 2010 www.kenticodeveloper.com

6 My Desk Richard Pendergast writes about the flurry of activity that is the Kentico community. Bring on the critical mass.

10 News Candice Pendergast covers the latest movements and happenings in and around the Kentico world.

24 Showcases Five of the latest and greatest new sites developed with Kentico reviewed by Richard Pendergast..

36 Tips and Tricks Matt Lee introduces the Kentico SQL views and demonstrates new ways of using them.


Richard Pendergast @kenticodev richard.pendergast@kenticodeveloper.com

MY DESK When I started Kentico Developer way

they currently piggyback, and Kentico

back when, there was very little in the

certifications become a sought after

way of good quality Kentico commen-

resume item.

tary available on the web.

There’s a lot happening behind the

Now it seems that every Kentico

scenes to spur it all on, but the reality is

expert out there has something to say,

that if a community isn’t already look-

and is out there actively saying it.

ing for a voice, then providing it with the

It’s great stuff. I don’t know what has inspired it, but I’m loving it.

tools can’t make things happen. Having spoken to and worked with

The new Kentico initiatives are

several different groups over the last

really drawing the best of the best out

couple of months, it’s obvious that the

of the woodwork and placing them on

same pressure points are cropping up

show.

everywhere. The Site of the Year Award, the

What’s also obvious is that partners

MVP award, the new Partner Program

are beginning to get together to discuss

incentives, the introduction of a Product

their reactions to these pain points, and

Evangelist - It all seems to be working.

although this is happening on a small

The community is alive with new

scale and typically beind fairly closed

white papers, regular webcasts, intro-

doors, the powers that be are opening

ductory videos, blog posts, and press

up to the idea that a shared approach

releases.

that works is better than internal IP that

Partners are beginning to talk to each other and share ideas, techniques, and approaches. This is a great time to be on board,

doesn’t. The next couple of months should be pivotal, and I’m looking forward to getting in amongst it all.

and I’m eagerly looking forward to watching the critical mass roll in, when

Richard Pendergast

we will finally begin to see Kentico

Editor

forums outside of DevNet, Kentico user groups outside of the .Net parent groups



Contributors Richard Pendergast Over the last 10 years or so Richard has worked primarily as a Solutions Architect, delivering solutions based upon various ERP, SCM, CRM, and CMS platforms. He now works with various teams delivering Kentico based solutions, and has been instrumental in the delivery of roughly 100 Kentico based websites and applications.

Candice Pendergast A journalist by trade, Candice set up her own business a couple of years ago providing full service marketing to small businesses, delivering any online components using Kentico. As Features Editor of Kentico Developer, Candice brings together both her journalism experience and Kentico knowledge to deliver topical pieces and human interest pieces.

Ralph Spandl Ralph Spandl is the founder of r42, one of the original founders of Quattrocento, and has been arcitecting web based solutions longer than most of us have known about the web. Ralph regularly contributes to the Kentico Marketplace, and writes about his work within Kentico Developer.


Matthew Lee Matthew Lee is one of the key developers behind the 70 or so sites built by Reed Business Information Australia on the Kentico platform. The development and rollout of this enterprise delivery is what allows Matt to speak from experience when putting together his monthly compilation of Tips and Tricks.

Thomas Robbins Prior to his current role as Kentico product evangelist Thom spent 10 years with Microsoft, and was one of the key persons behind the success of Microsoft .NET Framework and Visual Studio. He now produces regular blog posts, video tutorials, and commentary for Kentico. We are very excited to have him on board.

Martijn Schiferli Several years of developing with Kentico, and a tonne of Kentico sites under his belt, see Martijn Schiferli bringing a wealth of experience to Kentico Developer. Martijn’s current passion is the automation of common Kentico tasks using Powersell scripting, and it’s something we’ll be tapping into quite regularly.

Jeroen Furst with over 3 years working with Kentico, more than 50 sites under his belt, and development experience with versions 2.0b through 5.0 Jeroen Furst is a vocal member of the Kentico community hosting his own blog dedicated entirely to Kentico, and in this issue sharing his thoughts on Kentico 5.0.


News Upgrade package from 4.1 to 5.0 released

worldwide CMS and .NET communities. This spirit has played an important role in the growth of the industry as a

The last weekend of January saw the re-

whole, and Kentico wants to help foster

lease of an upgrade package allowing

this type of community spirit.

sites already hosted on 4.1 to be migrated to 5.0. The last real stumbling block for partners hosting sites on 4.1 and hold-

The Kentico MVP Award is designed to recognize individuals already listening to the community and actively advocating for Kentico.

ing off migrating to 5.0 has now been

The first Kentico MVP award is

removed, and I look forward to seeing

scheduled to be announced in early

a wide range of upgrades over the next

February based on self-nominations

month or so.

received by January 31, 2010.

No major issues have been report-

The Kentico MVP Award will be a

ed with the upgrade package as yet, but

one year industry recognition given to

as usual, you’ll find any issues discussed

individuals based on their community

within the devnet forums, any fixes

participation and evangelistic activities

documented within the bugtracker, and

in the CMS and .NET communities.

can get assistance directly via the regular support channels.

ȖȖUpgrade package from 4.1 to 5.0 released http://bit.ly/cRMC7c

The Kentico MVP Award

The Kentico MVP award does not include any direct financial compensation, but will come with • a 1 Web Site Ultimate License (value $4,499) for personal or business use • recognition on the Kentico DevNet web site • participation at selected indus-

Innovative people that participate and contribute their time, ideas and resources are the cornerstone of the

try events at Kentico expense • exclusive access to all Beta programs


News 11

• exclusive access to the Kentico product group

what you can do wen you integrate Windows Live Writer into Kentico.

• exclusive special offers that can

This, his first post on the subject

Blog Post Navigating the Kentico CMS Web Project

be passed on to friends, and

provides an overview and is more about

• exclusive promotional packages

demonstrating the user experience;, but

Spend a lot of time searching through

sent to all Kentico MVP’s twice

Karol has promised to cover all integra-

code? Trying to find the definition of a

a year.

tion details later as well.

class or enumeration can be difficult.

A Kentico MVP is awarded for one year

The Windows Live Writer package

The Class View window is a han-

and n no more than a total of five awards

has been uploaded to the MarketPlace

dy tool that gives a quick overview of

will be made during the calendar year

and is available for free download. This

the object model of the current solu-

2010.

is one download well worth getting your

tion and allows fast navigation through

hands on, and one post is well worth the

namespaces, classes and methods.

ȖȖAnnouncing the Kentico MVP Award http://bit.ly/964yKB

Blog Post Windows Live Writer integration When your passion is in spreading word over the internet, you probably find a great potential in contributing to vari-

read..

Using the Class View window in

ȖȖWindows Live Writer integration

window provides a method that can help

http://bit.ly/a1XcOn

to reduce the amount of searching that

ȖȖDownload the package from the

Working on your post using browser-based blog interface, you may

needs to be done.

Kentico marketplace

If you double click on a method in

http://bit.ly/b09QTd

the Class View window, Visual Studio

First Kentico Certified Trainers

ous blogging sites like Blogger.com or Thoughts.com.

conjunction with the Code Definition

will open the appropriate source code file and scroll to the selected method. This is quite useful for larger projects like Kentico that contains multiple

The first ever train-the-trainer course hosted by Kentico was run in Connecticut during the last week of February.

class definitions. See the technique at work in one of the latest blog posts by Thom Robiins.

ȖȖNavigating the Kentico CMS

sooner or later face an unpleasant situa-

Thirteen Kentico partners partici-

tion when something goes wrong down

pated, and each now carries the title of

Web Project

the road. If you lose connection while a

Kentico Certified Trainer.

http://bit.ly/9U1oMa

post is being published or your browser

Having not been part of the train-

crashes accidently, hundreds of lines of

ing I cannot speak about it from first per-

your thoughts disappear and you cannot

son perspective, but I am in the process

get them back.

of contacting several of the participants,

That is where the desktop blogpublishing tool comes in handy. One of my favorites is Windows Live Writer (http://download.live.com/writer). It is completely free. Karol Jarkovsky of Kentico shows

Optimization tip Write Better Code Disable Output Filter

and will write a piece on it as soon as I know more.

ȖȖFirst Kentico Certified Trainers http://bit.ly/c3VKty

Output filters are handlers bound to the output stream and able to change the final HTML just prior to distribution Kentico provides several output filters, and uses these primarily in order


12 News

to fix human errors, making the output

fact that the Kentico transaction han-

Kentico 5.0 pricing, and welcome the

HTML or XHTML more valid.

dling was not compatible with the .net

commentary.

This is great when you have users

TransactionScope class, some parts of

Hats off to Martin for attempting

working within the source of editable

the Kentico API did not even provide a

to address an issue that really is front of

regions, and entering invalid, or other-

mechanism for doing this.

mind for a lot of people at the moment.

wise damaging HTML. However, when you are able to con-

Kentico 5.0 now comes with two new

classes,

It’s not easy to stand up and make a state-

CMSConnectionScope,

ment about something that people are so

trol the quality of your output, the over-

and CMSTransactionScope, both of

passionate about, knowing that you will

head of the output filters is something

which are easy to use, and even easier to

most likely be flamed.

you’ll want to seriously look at removing.

understand.

Hats off to though to the partners

Martin Hejtmanek of Kentico esti-

In his latest blog post, Martin

and clients who bought into the discus-

mates that somewhere in the vicinity of

Hejtmanek runs us through the ins

sion, pointing out oversights on one

20% of the load generated when build-

and outs of transaction management in

hand and then demonstrating where

ing a page can be attributed to a global

Kentico 5,0, demonstrating how to make

Kentico fits in on the other.

XHTML output filter.

use of the new classes, and explaining

I hope much of the discussion was

some of the hidden complexities now

taken on board and that something valu-

automatically taken care of.

able comes from this.

It’s well worth reading his post explaining the output filters, the reasoning behind them, and the process

ȖȖDeep dive - New transaction

Definitely a worthwhile read.

required to remove them if you’re that

management in 5.0

ȖȖMVC and Kentico CMS

way inclined.

http://bit.ly/bhJKGB

http://bit.ly/aESVYe

He concludes the post with “It is a better code”, and while this may not be as

MVC and Kentico CMS Top 10 Websites for December

black and white as it first appears, a 20%

Martin Hejtmanek kicked off some fairly

improvement in performance is some-

animated discussion when he posted an

From 174 partner submissions, Petr

thing worth investiggating.

FAQ piece in an effort to answer part-

Passinger of Kentico selected his top 10

ner and client questions about whether

for the month of December, and while

Kentico CMS supports MVC or not.

I would have liked to have seen a small

good thing to have it disabled and write

ȖȖWrite better code, disable Output filter http://bit.ly/cvhrQH

New transaction management in 5.0

This is one I made a conscious effort

writeup on each, the sites are worth

not to buy into, as I was very interested in

checking out as a demonstration of

the dialog that was triggered both online

the high quality work being done with

and offline, and didnt want to taint it

Kentico.

with my own opinions and experiences.

I did notice that some of the more

Within Kentico 4.1, if you wanted to use

Sometimes it’s not so much about

controversial sites mentioned on Twitter

transactions, you had to ensure that all

what is written, but about what is not

didn’t make the list, but the list is a good

methods within a transaction were given

written, and about what follows after it is

one, and althoug I have not yet seen a

the same connection object.

written.

similar post for February I hope Petr gets

Aside from the obvious complica-

I haven’t seen so much discussion

tions this brings up, and apart from the

on a single post since the release of the

in and posts again. Check it out if you’re looking for


News 13

examples of really interesting work.

ȖȖTop 10 websites for December http://bit.ly/9taYf3

Jeroen Furst

rate I’ll be very surprised if I cant create one just as long next issue.

ȖȖOnline User Group Martin’s Top 5 for Version 5 (Webinar - January 19) http://bit.ly/aczk8c

An interesting blog to appear on the scene recently is that of Jeroen Furst. After a quick read, I found his writing interesting enough that we contacted him directly, asking to include one of his

ȖȖIntroduction to UI Personalization (Webinar - February 4) http://bit.ly/d7bPC7 ȖȖCMS Today

posts in this issue of Kentico Developer

Generate Buzz, Leads, and Sales

magazine.

Using a CMS

This will be one to watch I think, and I look forward to reading future material.

ȖȖblogs.jeroenfurst.nl http://bit.ly/cfBPjC

Webinars and Videos

http://bit.ly/9H0Q57 ȖȖDefining a New E-Commerce Product Type http://bit.ly/aRoc1z ȖȖCSS Menu Design http://bit.ly/boGd0S ȖȖSorting and Paging with the Product Datalist http://bit.ly/9DKSSN ȖȖAdding E-Commerce Products

http://bit.ly/bNBUeo

http://bit.ly/bPIuXi

ȖȖTechnical Learning

ȖȖCustomizing E-Commerce

New Features in Version 5.0

Product Categories

(Webinar - February 18)

http://bit.ly/9jCoEL

http://bit.ly/bg0rzV ȖȖCMS Today CMS

be a new Kentico webinar series taking

(Webinar - February 25)

off, or a new video tutorial series gain-

http://bit.ly/aH7WqI ȖȖCMS Today

rial is surprisingly really, really good on

Driving Success with SEO

average.

(Webinar - March 9)

to find anything worth mentioning, there

ȖȖCompany Details Pages

to Multiple Categories

Everywhere I turn lately there seems to

Where it used to be that I’d struggle

http://bit.ly/aSef20

(Webinar - February 9)

Knowing When You Need a

ing traction, and the quality of the mate-

ȖȖDefining a Workflow

http://bit.ly/9KAJ0n ȖȖTechnical Learning

ȖȖE-Commerce Featured Products http://bit.ly/aDHIV5 ȖȖAdding Product Options http://bit.ly/dmCNY8 ȖȖAdding a New E-Commerce Product http://bit.ly/bNzBVZ ȖȖSample E-Commerce Purchase http://bit.ly/aja9Fi ȖȖUsing the New Site Wizard http://bit.ly/c5PmRu

is now so much good stuff that I struggle

Introduction to Widgets

to filter it down to a list of honourable

(Webinar - March 16)

mentions.

http://bit.ly/dzKqnd

ȖȖUI Elements Overview

ȖȖMacros in Kentico CMS

http://bit.ly/65rKJL

Check out the list below. I’ve included all of the up and coming webinars I could find, and packaged them

http://bit.ly/aBn38j ȖȖVersion Comparison Using

together with anything else that’s come

Workflow

out over the last month or so that I feel is

http://bit.ly/dDh54V

worth looking at. It’s a long list, but honestly, at this

ȖȖThe WYSIWYG Editor http://bit.ly/9ifI02

ȖȖWidget Overview http://bit.ly/8kFfZ8

ȖȖUI Personalization http://bit.ly/6sxqYb


Command line Kentico Unless you’re in the habit of writing little command line applications, Kentico appears at first to be difficult to automate, and nearly impossible to manage from the command line. At least, that was the case until the introduction of PowerShell, a dynamic language from Microsoft which allows you to script admin tasks that previously would have required VB, VBScript, or C#. Think of Powershell as a DOS prompt on steroids. The key thing which makes Powershell different is that unlike

Over the next few issues of Kentico Developer, we will be

most shells, which accept and return text, PowerShell is built

demonstrating how you can easily expose Kentico API func-

on top of the .NET Framework, and accepts and returns .NET

tionality via Powershell, by rolling your own re-usable library

Framework objects. Just imagine being able to pass around

of Cmdlets, allowing for the command line management and

native .net objects, and being able to call methods and access

automation of Kentico.

properties on those objects, directly from the command line. The basic unit of work within PowerShell is the cmdlet

Getting Started

(pronounced “command-let”), a simple, single-function command-line tool built into the shell. PowerShell includes more

In order to develop your own Powershell Cmdlets you’ll need

than one hundred of these cmdlets, giving you access to not

to install the Windows SDK. You won’t need to do this if you

only the file system, but to complex stores such as the registry,

are simply looking at using Powershell, only if you are look-

the IIS metabase, and digital signature certificate stores.

ing at developing your own cmdlets. Don’t worry, the process


Command Line Kentico 15

is relatively painless. Various flavours of the SDK can be found

You’ll need to browse to find System.Management.Automation.

at http://msdn.microsoft.com/en-us/windowsserver/bb980924.

It comes with the Windows SDK and should be found under

aspx

%programfiles%\Reference You’ll also need Visual Studio and access to a Kentico

Assemblies\Microsoft\Windows

Powershell\v1.0

database to work with while debugging. We run Visual Studio Express Editions (Visual Studio SQL Server 2008 Express and Visual Studio C# 2008 Express) which are freely available, and this works well if you’re looking for a basic setup for the very cool price of free. Downloads of Visual Studio Express Editions can be found at http://www.microsoft.com/exPress/

Setting up the Project OK, so let’s get into it. First, you’ll need to create a new Class Library within Visual Studio named KenticoCmdlets.

You’ll find System.Configuration.Install registered as a .net library.

Pulling in the Kentico API For Powershell to be able to work with the Kentico API, you’ll need to add references to the Kentico DLLs. I find the best way to do this is to browse to a local installation of Kentico. This will mean that right from the start, your Powershell Cmdlets will be using the same version of the DLLs that your site is using. You can either selectively add the DLLs you know you’ll Next you’ll need to add several required references.

need, or if you’re just getting started and don’t yet know your

A Powershell Cmdlet will require both System.Management.

way around the Kentico API, adding anything beginning with

Automation and System.Configuration.Install.

CMS is a safe bet.

Your first Cmdlet Now that we’ve set up the project we can begin coding our first Cmdlet. Add a new Class named GetSites to your project, and import the classes that you know you’ll need right off the bat – you can add more as you go. The image below highlights the set I typically begin with.


16 Command Line Kentico

thing you’d expect to find within a web.config file, or an app. config. I’ve added this because although I’m not going to do it now, I’ll add a parameter to the Cmdlet in future, which will allow you to pass a connection string from the command line. Set the connection string to the same connection string you use in your web.config.

The next piece is important, as this is where I find most people come unstuck. Declare the Class GetSites as public, and inherit from Cmdlet. It sounds simple I know, but if things go awry, come back and check this before digging further. Finally, add the Cmdlet attribute to the GetSites class, and we’re done.

Next we add code to the Cmdlet, by simply overriding ProcessRecord(). If you let intellisense fill in the blanks, it’ll

That’s it! This is now a complete Cmdlet. The next pieces are all

prepare the code for you.

about packaging finished Cmdlets for distribution, and configuring your debugging environment.

Adding a snapin Think of a snapin as an installer, used to package Cmdlets for distribution. We’ll add one now by simply adding another class to the project. In this case we will be adding a snapin for our one and only Cmdlet, but it is possible to add several related Cmdlets Insert your code – in this case, we’re simply calling the API

within a single snapin, allowing an end user to add several

function SiteInfoProvider.GetAllSites().

Cmdlets to Powershell with a single import.

Notice that I’ve added a line of code though which programatically sets the database connection string. If you’re already working with Kentico, you’ll know that this is some-


Command Line Kentico 17

Windows 7 users should take note of the fact that the command shell will need to be executed in the context of an administrator so that it has the necessary permissions to make changes to your system. You can do this by right clicking on the command shell menu item and selecting Run as Administrator. From within the command shell, navigate to the directory that your class library compiled to, and install it by invoking install –I as shown below.

Installing the class library You should now be able to build your class library with no errors, so that it can be installed and registered with Powershell. A Cmdlet class library is installed using InstallUtil, which

Now, open Powershell – you’ll find it in the Start menus un-

you can tap into easily by starting the command shell you’ll find

der Accessories – and check that your Cmdlets successfully

installed with the Windows SDK. There’s nothing funky about

installed by using the get-pssnapin Cmdlet with –registered

this command shell apart from the fact that the tools that come

as a parameter. This lists all installed libraries. You should see

with the SDK are already included in the path and you won’t

KenticoCmdlets listed.

have to browse for them.

Configuring the debugger From within the Powershell session you still have open, import the snapin we created, by invoking the add-pssnapin Cmdlet with GetSites as a parameter. What you’ve just done, is pull in any Cmdlets associated


18 Command Line Kentico

with the snapin, allowing them to be used form the command line. We’re going to cheat a little though. So that you don’t have to type this every time you kick off the debugger, we’re going to export the console - an XML file which records imported snapins. Then, if we tell the debugger to use this console, the snapins will come pre-loaded. To export the console, invoke the export-console Cmdlet passing the path of the file that will be created. Console files are saved with an extension of psc1.

Debugging Now, try adding a breakpoint in the code, kicking off a debug session by hitting f5, and invoking our cmdlet from within the resulting Powershell by issuing the command get-sites. Check out the CmdletAttribute if you’re wondering why the command is get-sites.

Now it is simply a matter of telling Visual Studio that when debugging this particular class library we’d like it to use Powershell as the external application making the calls, and that when it starts Powershell it should use the console we just exported. This is done by bringing up the properties of the project and clicking the debug tab. Select Start external program, and browse to the Powershell executable. Then enter –PSConsoleFile <consolefilepath.psc1> in the command line arguments. There’s a trick to this though, in that Visual Studio Express Editions do not allow for the invoking of an external program during debugging. Thankfully, a little hack gets us around this

Once you’ve confirmed that the breakpoint is hit, let it run, and

limitation.

take a look at the output.

The settings in the debug tab are saved out to a file with

What you’re seeing is a DataSet, the results of the Kentico

the same name as the project, but with a .user extension. For

API function SiteInfoProvider.GetAllSites(). The cool thing is

example we’d be saving to a file named KenticoCmdlets.csproj.

that because we are using Powershell, and because Powershell

user. Since Visual Studio will not allow us to do this via the IDE,

works with objects, we can work with the DataSet directly as

we simply have to do it via good old trusty notepad.

shown below.

If a file with this name already exists, edit it. If it doesn’t, create it. The contents of the file – as it should appear - appear below.


Command Line Kentico 19

For example, the Cmdlet we have just put together enumerates sites, returning an array of SiteInfo objects. If we were to create a simple stop-site Cmdlet and a start-site Cmdlet, we would be able to restart all of our sites using the following. get-sites | foreach-object { stop-site $ start-site $_ }

Neatening up your results

Over the next few issues of Kentico Developer, we will be building upon what is in essence just a simple demonstration, expos-

However, an alternative way of doing things is to return Kentico

ing more and more of the Kentico API within Powershell, and

SiteInfo objects, rather than rows of data, making the results

building up more and more complex examples.

easier to work with. Try exiting the debugging session, making

We’ll also be adding parameters to all Cmdlets, something

the changes below, and once again hitting f5 to start debugging.

I really wanted to include here, but that we left out due to a lcak of space and in the interests of simplicity. The resulting class library will be made available on the Kentico marketplace, and I hope that with the input and feedback we receive we will be able to make it a very worthwhile management toolset.

Further Reading What you’ll find now is that you can use the following syntax

ȖȖPowershell Syntax, Tutorials, and Guidelines

which is much cleaner, easier to read, and a hell of a lot easier

http://www.computerperformance.co.uk/powershell/

to write. More importantly, once you have further Cmdlets you

index.htm

can begin to pass the objects between these Cmdlets.

ȖȖWindows SDK http://msdn.microsoft.com/en-us/windowsserver/ bb980924.aspx

ȖȖMSDN – Windows Powershell http://msdn.microsoft.com/en-us/library/ dd835506(VS.85).aspx

ȖȖWindows PowerShell Blog http://blogs.msdn.com/PowerShell/

Next steps It’s simple to begin tacking on more and more Cmdlets, adding more and more capabilities. Although each Cmdlet does very little by itself, it’s the piping capabilities of Powershell which make them so powerful.


On Not Boiling the Ocean Introducing our latest contributors allows me to also introduce at the same time one of the biggest things to happen to Kentico within the last couple of years - Thom Robbins. Since leaving Microsoft and moving to Kentico, Thom has been making waves in the Kentico community, doing all of the things I’d hoped to do when I started the magazine, but doing them well, full-time, from the inside, and with full Kentico backing. Thom joined Kentico late last year as a Product Evangelist,

sible for various elements of visual studio.

and already we are seeing formal training and certifications

The move to Kentico was prompted by both changes with-

appearing, regular webcasts and instructional videos being

in Microsoft, and a desire to get a bit more hands and make

made available, new discussions surrounding best practice kick-

change personally.

ing off, and Kentico beginning to speak of an enterprise solution with good reason and the material to back up the claim. Much of this comes as a direct result of Thom, and of the depth of experience he brings with him.

“Microsoft is a fascinating company with so many cool technologies but it’s easy to become complacent when youre dealing with product releases that are so far away. When I left we were dealing with visual studio 12, which

With a career at microsoft spanning somewhere in the

is due out in 5 years. I wanted to see the impacts of what I was

vicinity of 10 years, Thom started out in developer platform

doing hit the market, and I wanted to see them a little bit quick-

evangelism as one of the very first Microsoft evangelists, even-

er than 5 years from now.

tually moving to corporate eveangelism where he was respon-

Kentico is an opportunity for me to reconnect with my


On Not Boiling the Ocean 21

roots and to do things that I can see the results of right away. As a senior director with Microsoft I tended to run large groups, which kind of separated me from my core element, my

he really listened. There was a lot of discussion about the best thing to do. Im always impressed when any company listens and is willing to make changes based on what they hear.

core audience, and I really wanted to get back to the technology.

I mean like anyone we’ve got revenue targets and we wan-

I wanted to be able to do things, It was fascinating for me to be

na hit them, but at the same time we have to do whats right by

able to install visual studio, and show stuff off, and do stuff. It

our partners and our customers, or we won’t grow.”

was fanatastic and fun.” Thom sees the role of Product Evangelist as one of education. “People don’t always know what a CMS is, or why they’d want one. And take Version 5.0, people don’t yet know what

But it’s the education side of things where Thom is really making waves right now. You only have to take a look at Kentico DevNet to see that 4 out of 5 posts are put together by Thom instructional videos, white papers, and discussion pieces. He’s like some sort of crazy publishing machine.

widgets are, they don’t know about UI personalisation. An

“Well, I have to keep moving. I have to get this stuff out

evangelist builds awareness, answers questions, presents new

there. There’s so much that people are still looking for. At the

features and disusses the roadmap... you know, spreading the

same time, I don’t wanna boil the ocean. I’m aware of the fact

love. That’s what an evangelist to me is really all about.”

that I can’t do everything right now. I wanna provide some basic

But it’s also about making sure that, as he puts it, “cus-

materials at first and work up to the more difficult stuff.

tomer voices are carried.” “Ive already been interviewing and working with customers, drawing feedback, and preparing what will be actioned in

You know, something I love to hear is a partner telling me they don’t have enough about X, because I’m like, OK lets go and write some stuff about X.

5.5. You’re going to see a lot of that coming through. One of the things that really attracted me to kentico was that I was seeing

I’m answering a need right away, and at the same time building the foundations for the rest of it.

a small company that was willing to listen, and that was really willing to action things, and that’s kind of very unusual.

Right now we’re identifying customers that will enable us to find out what people are using and how and why, you know,

Peter is an amazing visionary with an ability to make

what their needs are, how the bigger partners are working, what

things happen. We talked a really long time before I made the

the key enterprisey tools are. I think a lot of this is going to

decision to come over to kentico. He and the company as a

come from the partners. These are the guys already using it and

whole are impressive in that their system functions and they

getting things done.

really are getting stuff done. What they hear is being actioned.

Then its gotta get written so we can validate it - Are people

He also really cares about customers and that’s the thing

doing this? Are there better ways of doing it? - and then we’ll

I was most interested in, that in good times or bad he’d want to

eventually try to validate it in a lab or directly with a customer.

continue caring about his customers and wanna continue doing

I’m a big fan of grey papers – you write it, and then you validate

the right things.

it.

The fact that kentico is a worldwide company means that

From a best practices perspective I’m thinking in terms of

its super important when thinking of how to scale, we realise

a developer. How do I handle a large team environment, source

that we have to scale through partners. And petr does a great

code management, development? How do I handle continuous

job of making sure we do the right thing by our partners, that

builds? How do I stay agile? The list goes on.

we’re always listening to what they’re saying.

Im probably going to use a lot of it for the magazine.

I was just coming aboard when petr was going through

It’s a great forcing function pushing me to get a lot of it done.

the Version 5.0 pricing, and it was impressive in the sense that

Something im really kicking around is whether we go down the


22 On Not Boiling the Ocean

Prestrictive Architecture Guidance (PAG) path, which basically

and improvement, which then allows the piece to evolve and

means we go into a lab, we build out a team system, we tear it

become a white paper.”

down, and we build it up again, figuring out what we need to do

Thankfully, this works well with Thom’s idea of the grey

along the way. It’s kind of a very detailed, very prescriptive way

paper, and ties in well with his feelings about boiling the ocean,

of doing things and obviously a much longer path, so I think

so we can look forward to regular writings, heated discussions,

the first couple of rounds are going to be about collecting basic

and the beginnings of some really significant guidance docs.

practices, putting them together, and then starting to roll those

We’ve already discussed a need for large team best prac-

out while we move forward from there, putting them into more

tice - concurrency, version control, testing, management, and

effective documentation. Eventually I’d like to have something

deployment - and the need for breaking these topics down, but

up on DevNet around enterprise guidance.

Thom puts it very simply.

I think that we know enough now that we could make

“I don’t think youre going to put together an article on

some PAG that we can roll out in the next couple of months.

testing. Youre going to put together an article on unit testing.

With Version 5.0 we did a lot of testing, and its like, how do we

You keep it small and easy to take on board.

present that testing and performance to the public? How do we

I also think of it in terms of how you should do it and why

create a set of topics so that when we go out to a large company

you should do it. You know, what is this thing, why would you

who tell us that we can’t handle scalability and that they have

do it, and how would you do it? There’s no point understanding

10000000 users, we can point them at guidance documents out-

how something is done if you don’t know why you’d do it in the

lining the infrastructure needed to get them going, and demon-

first place.”

strating that we can actually handle their requirements. I mean im not a fan of boiling the ocean. I’ll take what we

This is great stuff, and I for one am really looking forward to it.

have and build out the topics. We’re starting to get together with

Thom brings with him a wealth of experience in this

partners around what they’re currently doing, and then build-

space, the full backing of Kentico, the dedication and passion

ing up the information that comes back. We’re offering to have

of someone with a new toy, and the time that comes with a full-

them write white papers, and we’ll see how that goes.”

time role, all of which allow him to do what a lot of us have

As our latest contributor, Thom was keen to know what would work best with our readers. “A monthly best practice for the mag? OK, do we solicit

been wanting to do for a long time - put together the material that shows that the Kentico CMS is a solid product and that the horse that we’ve saddled our ponies to is worth the ride.

questions, like ‘Whats the best practice for change manage-

And honestly, although it will take time for this all to

ment?’ and then cover that for a month or do we write an article

come to fruition, I’m glad that we all have a chance to be part of

each month and see how it goes? I mean whats the best way to

the process. We all bring something to the table, and although

work with your readers? Do they want questions or answers?”

Kentico build the platform, it’s the partners that use it, so it’s

And honestly, without having had a great deal of criticism so far, it was difficult to answer. “I think its worth putting something out there that’s youre understanding of a given topic at this point - a statement, right or wrong. Think of it as a grey paper, something set up to solicit discussion, something to use that as a starting point. Invite commentary, and evolve the topic over time. If you keep the topic simple, it can be used as a talking point, stimulating discussion

awesome to see that we’ll be part of the mix.


Subscribe and Win! A Kentico 5.0 Single Site Ultimate License To celebrate the release of Kentico 5.0, you can now have Kentico Developer delivered to your door for the reduced cover price of $15.00 (plus shipping), and what’s more, by becoming a subscriber you could have the chance to win a Kentico CMS 5.0 Single Site Ultimate License valued at $4,499!

Visit http://www.kenticodeveloper.com for details

Issue 1

Issue 2

Issue 3


All 4 The Driver

Jameson Irish Whiskey

I musn’t be part of the target audience for

What a great little website. Fluid Rock

this one, as I don’t really get it. A really

have excelled themselves with this one.

good looking site with great transitions

I love it.

and great photography, I really wanted to like it but found myself wanting more.

Considering the fact that I don’t drink Jameson Whiskey, I honestly didn’t

The philosophy is great. “It’s an

expect much, but the site surprised me,

exciting challenge that has been passion-

and I found it really interesting, and

ately embraced by every member of the

more importantly, really engaging.

Subaru family, to ensure that the experi-

I didn’t add a toast at the World’s

ence you receive from the showroom, to

Longest Bar but really felt like I should

the service counter, to the friendly voice

after watching the videos of others that

at the end of the phone are all positive

have. This is a great concept, something

and memorable ones.“

I haven’t seen done before, and it works.

I was hooked. My last experience with a car dealership wasn’t all that

How often do you actually sit and watch commentary left by others? Very cool.

great and I was intrigued, but searching

I love the fact that what appears

through the site left me unsure how the

at first glance to be a flashy promotio-

promise would be delivered, and what it

na site contains so much information

would mean for me as a driver.

about the product and the brand. I mean

I love the thinking behind the campaign, but can’t help but feel that a little more information and depth would have sold it to me.

ȖȖAll 4 the Driver http://bit.ly/cPMpdl

who would have thought that Jameson Whiskey is gluten free? Check it out. This is great site beautifully executed.

ȖȖJameson Irish Whiskey http://bit.ly/aruZH2


Great Beer Great Responsibility

Penthouse Germany

Cup Coffee

I have to admit that I found it hard to re-

I have to say that I’ve never come across

“We make it a priority to support

view this site, and not just because I don’t

a site with a wood-grained background

our employees and the communities

speak german. It’s difficult to explain to

that I’ve actually liked, let alone one that

where we live, work and sell our beer.

your wife that you’re checking out the

I would call anything but tacky, and yet

After all, without great people brewing

german Penthouse website because it will

somehow The Famous Group have cre-

our beer and great communities to enjoy

be good for other Kentico developers.

ated a site for boutique coffee house Cup

our beer, we couldn’t exist as a company.”

Coffee that I would actually call some-

Now I’m a bit of a cynic, and my

The site is pretty much what I would have expected in this instance essentially a searchable digital edition

what classy. The

first reaction was to gag at yet another photography

of

grind-

brand jumping on the green bandwagon,

of the printed magazine, with an email

ing machinery, roasters, and espresso

but after digging around a bit I was sur-

based newsletter tacked on.

machines is of a very high quality, and

prised. MillerCoors really are involved

What I was surprised about is the

the focus of each image highlights a

in a lot of socially responsible programs,

volume of content available on the site.

beauty in the coffee making process that

and not just token programs that get

OK, so there’s no archive of previous edi-

shows a real passion for the entire affair.

points on the board and pay homage to

tions, but considering the fact that adult

Put together with a couple of really

content is typically marketed via a teaser,

nice fonts, subdued colors that work well

Fullhouse have done a great job

the discovery of most of an issue freely

with the brand, and copy that makes the

of pulling together a site that is not only

available online was unexpected.

coffees sound mouthwatering, the result

engaging, but that contains a lot of infor-

CSS have put together a site that

is a site that makes coffee more interest-

mation in a very easy to digest format.

really shows off the magazine in it’s best

ing than I ever thought it would be, and

The video introduction draws you in and

light, and although this site is definitely

Cup Coffee somewhere I would be inter-

the depth of content keeps you digging.

not safe for work (NSFW), it’s worth tak-

ested in visiting.

ing a look at.

ȖȖPenthouse Germany http://bit.ly/dkuehr

This is a really really nice little site.

ȖȖCup Coffee http://bit.ly/97YFzH

someone else’s ideals.

I like it a lot, and rate the use of actors that don’t come across as drones.

ȖȖGreat Beer Great Responsibility http://bit.ly/9JsF0F


FA(Client)Q When we began working with Kentico way back in 2008, there was very little in the way of sales support, and selling a Kentico solution was very much an artform in itself. The work involved in encountering and learning to answer Frequently Asked Client Questions was almost as important as the work involved in actually getting in and putting together the final solution. Over time, we’ve worked with many clients, each with their

The RFP Builder is essentially a knowledge base, where

own requirements, questions, and key pain points which need

you can find typical RFP (Request for Proposal), or ITT

addressing within a proposal. So, like any other good agency

(Invitation to Tender) questions answered.

out there we developed our own knowledge base, and gradu-

I haven’t seen it talked up much yet, and I can only guess

ally pulled together answers to typical questions, giving our

that this is because Kentico would like to see a critical mass of

salespeople a set of ready answers for the questions that we’ve

questions and answers before they really begin to push it.

learned typically come up.

I’d really recommend getting in there now and having

This works really well, but takes time and a hell of a lot of

a look around. A glorified FAQ, the RFP Builder already has

effort to build up, and clients with unique requirements can still

enough content that it has had to be broken down into sections,

incur heavy research.

and you’ll already find answers to questions on topics such as:

This is where the RFP Builder contained within the Kentico partner portal really begins to shine.

Licensing and Pricing

Content Editing


FA(Client)Q 27

Documents and Assets

for Marketers, Benefits for Developers, and Benefits for Web

Workflow Requirements

Agencies, it’s both a great starting point for proposals, and a

Security Requirements

great addition to a proposal folder.

SEO

Multi-lingual Support

data within the RFP Builder, and the putting together and pol-

Performance and Scalability

ishing of popular material within the Sales Builder.

Development, and

Each of the Kentico Modules

To give you an idea of the content contained within each, I looked for a couple of extremes.

I think the natural progression will be the collection of

We no longer maintain our own knowledge base, and at this point are more interested in working with the other partners to flesh out and grow the RFP Builder. As agencies, we may each have a unique set of proposal

A question asking a salesperson to “Describe the scalabil-

templates that we use, costings that we know and are comfort-

ity of your product”, had a fairly technical answer of just over

able with, and offerings that we are prepared to take to market,

1000 words, with some fairly detailed discussions surrounding

but it’s good to know that behind the scenes the Kentico partner

caching.

portal exists to help answer client questions and requirements

A question asking a salesperson to “describe what newsletter features are available in your product”, had a non-technical aswer of around 250 words describing the newsletter functionality available within Kentico. Kentico are open to new questions, and posting new questions will lead to new answers, and a growing knowledge base. We’re already finding that the early knowledge base we put

in a self-serve manner without us having to pull in Kentico sales support staff on every proposal. You can gain access to the Sales Builder, the RFP Builder, and various other tools, by registering as a partner via the Kentico website.

Further Reading

together ourselves, is beginning to be dwarfed by what exists in the partner portal, and more importantly, answers to questions that we haven’t yet had to answer are appearing, meaning that we are already prepared when we do. The information is not static, and apart from the fact that Kentico make an effort to keep the material up to date, a mecha-

ȖȖRegister as a Partner http://bit.ly/dnVPOq ȖȖThe Kentico Partner Portal http://bit.ly/cipl4T ȖȖRFP Builder

nism is included which allows you to comment on a particular

(requires partner login)

item, to add further detail, or to extend the question.

http://bit.ly/buceNN

This is a great resource, and one I’m not sure that people

ȖȖSales Builder

really make the most use of just yet, but just in case this is not

(requires partner login)

enough, there is also another toolset evolving within the part-

http://bit.ly/bQQmS2

ner portal - the Sales Builder - a collection of leaflets, brochures, presentations, and official partner logos put together to make selling just that much more easier. There is not a lot of material contained within the Sales Builder section of the website just yet, but the Kentico CMS Brochure is very good, and justifies the section almost entirely on it’s own. Outlining Key Benefits, Key Features, Benefits


10 things in Kentico 5.0 that make life so much easier In what is without doubt the easiest read I’ve yet come across regarding 5.0, Jeroen Furst of IBL Software and blogs.jeroenfurst.nl gives us his take on the new Kentico CMS featureset. Petr pointed out a blog a little while back and I couldn’t help but

Machinebouw site took runner up in the manufacturing

sit up and take note. Here was someone who really had their

category.

head around blogging - short sharp interesting timely posts well illustrated - and who at the same time really seemed to be on the ball with Kentico.

This is a group I look forward to seeing more of, and Jeroen’s is a blog that I will be watching with interst. Jeroen speaks regularly of wanting to get in touch with the

This piece is typical of what you’ll find on the blog of

Kentico community in order to share thoughts about approach-

Jeroen Furst, and if for nothing else than he blogs so much bet-

es, techniques, functionalities etc, and I really do feel that if he

ter than I do, I recommend you check it out.

sticks with it we may have a future MVP in our midst.

I spoke with Jeroen rcently, and was surprised to discover a guy with over 3 years working with Kentico, more than 50 sites under his belt, and development experience with versions 2.0b - 5.0. I mean I only heard about IBL Software for the first time during the Kentico Site of the Year awards, when the

Have a read of Jeroen’s take on the things in Kentico 5.0 that make life easier, and see what you think.


1. Drag & Drop in the Content Tree

2. Bulk Operations

3. Event Log Coloring

Do I have to say more? Who hasn’t been

In previous versions of KenticoCMS

I like the new layout of the Event Log.

frustrated by the fact that you have to

it was only possible to delete multiple

Although it is just a subtle change, the

move something up and down the tree

documents at the same time. With

addition of the colours in the grid make

one step at a time? This is gold.

Version 5.0 it is now possible to: Move,

it a lot more clarifying.

Copy, Link, Delete, Publish and Archive multiple documents with just a couple of clicks!

4a. UI Personalization (wysiwyg Editor)

4b. UI Personalization (Module Access)

5. Web Part Dialog Shortcuts

It is now possible in Version 5.0 to cus-

It is also possible to control the access of

A minor improvement but oh so nice

tomize the WYSIWYG editor on a role-

modules on a role basis

when modifying large web part proper-

by-role basis (how cool is that?!)

ties, it is now possible to jump to a group within a web part properties dialog.


6. Media Library Consistency

7. Search/Filter in Selection Dialogs

8. Side-by-Side Document Comparison

In previous versions of Kentico an editor

When you open up a selection dialog

If you are using Versioning/Workflow

opening up the insert media dialog was

like the “Add web part”, “Add widget”

then 5.0 offers side-by-side comparis-

able to preview pictures using different

or “Select Template” dialogs you can

ment of documents. This is a very neat

views (List, Tiles or Thumbnails), but

search the desired “Web Part”, “Widget”

feature which probably will by loved by

the same editor using the Media library

or “Template” pretty fast by entering the

most CMS Editors.

Module could use List view only. Version

name in the search Box and hitting the

5.0 brings us a more consistent use of the

Enter key.

Further Reading

Media library.

ȖȖBlogs.JeroenFurst.NL http://bit.ly/cfBPjC ȖȖ10 things in KenticoCMS 5.0 that make life so much easier http://bit.ly/aAjk2Y

9. Smart Search in Forums

10. User Impersonation

While the Smart Search functionality

Global Administrators are able to log in

was already added in KenticoCMS 4.1, it

as a different user with just 1 click. In

became clear to users that Smart Search

my opinion this is a really great function

lacked functionality. Version 5.0 adds

which will save me a lot of time!

“Forums” as index type which is a great improvement. Hopefully index types like “Custom Tables” will follow in future


IBL software

Development Consultancy Support Hosting

Over 3 years of experience in Kentico CMS! Provides a dedicated team of Kentico Experts! Implemented more than 50 websites using Kentico!

Professional Kentico Development Powered by IBL

software

www.ibl-software.nl | info@ibl-software.nl


JW Player KenticoCMS version 5.0 has been released for a couple of weeks now and I am really enjoying the new features. That’s why I thought that I should write about some (minor) improvements in 5.0 that make working with the CMS a lot easier! There are probably a lot more improvements worth mentioning but I will cover those the next time. So here goes! Introduced in version 4, the media library has quick-

able and because its open architecture allows developers to cre-

ly become one of my favourite and most often used tools in

ate add-ons such as colourful skins and plug-ins; In the long list

Kentico. Since version 4.1 an editor can easily add QuickTime

of add-ons you can find plug-ins for social media, integration of

movies and Windows Media files. But presently, the default

Google Analytics or a caption tool.

installation doesn’t support Flash movies nor is it possible to insert them as an inline control into an editable text area.

The JW player has only one major disadvantage; It is a commercial product and requires you to purchase a license if

Over the past few years, Flash Video has become one of

you want to use it for commercial projects. This is most likely

the most used video formats on the web and many powerful

the reason, why the JW Player is not included with Kentico.

players have been developed to control their playback on web

However, not long after I showed Petr Palas this nice piece of

sites. My favourite player is called JW Player from a company

software, the Developer Guide included some instructions on

Longtail Video. A favourite partly because of its slick look, but

how to integrate it within the media libraries. You can almost

also because it is really stable, easy to use and highly customiz-

copy paste the code from there into your installation to make


it work (Section 8.24.9 Defining custom media types/Kentico CMS Dev Guide).

Now we’re all set and there is only one thing left to do; Make some changes to the “MediaControl.cs” which can be

There is however one thing that really bugged me with

found in the “CMSInlineControls” folder. Making changes to

the provided code; JW Player gives you the possibility to define

the Kentico installation is usually something I try to prevent at

the path to a preview image, but the media library does not give

all cost. Because it means that with each new update, you are

you the opporatunity to specify such a path. A preview image

most probably required to apply the changes again. And this

does not only come in handy for videos, but gives you also the

might be once or twice a year. So you better carefully document

possibility to illustrate an audio file.

what you are doing now.

The simplest thing in the world I thought! Why not just allow the upload of an image in the preview tab for the media

Open CMSInlineControls/MediaControl.cs. You will first need to edit this part of the file.

library item? Well, as it turns out, that is not so trivial. It was only with the help of my programmer colleague Francois Charbonneau and a handful of help from Juraj Ondrus and the Kentico support team I finally managed to get it to work. But let’s go back to the beginning and put in place all files required. We need to download a copy of the JW Player and we need some JavaScript to embed the player. Version 5 of the JW Player has just been released and you can get a copy here: http:// www.longtailvideo.com/players/jw-flv-player/. To embed the player into the HTML page I suggest using the swfobject. The complete download including documentation can be found on Google Code. (http://code.google.com/p/ swfobject/downloads/list). Now you need to find a place for these items somewhere

This modification tells the media control to what to do with me-

in your Kentico installation. I decided to place them in the

dia file type flv and also mp3 (or any other media file type you

CMSModules folder, where I created a new folder called “FLV-

want to be handled by the JW Player).

Player”. But you might also decide to place these files in the “App_Themes” folder. You also need to make some changes to your config file and allow flv file extensions for the media library. For these steps, please refer to the Developer Guide again.

And then add two functions:


brary inline controls, you will only see this icon in the FCK The first function will make it possible to insert the flv or mp3

Editor window.

files and comes with some small modifications straight from the

Once you preview your page though, you can see that you can

Kentico example. The second function will return the preview file from your media library item. This is actually the part where I suspend my understanding and start going on faith. But trust me, it works! Save the file and return to your cmsdesk, navigate to your media library and upload a flv file and/or an mp3 file. In the preview box you should now upload an image that will serve you as the initial still frame that is displayed until the video starts playing, or alternately, the image that is displayed while

now playback your video or sound file with the JW player while

the mp3 sound file is playing.

the preview image is displayed.

Once this is done, return to your content section and insert the flv/mp3 file with the insert/edit media or image button. You will

I am pretty sure that this function will be appreciated by many

now see that the JW player is shown in the preview window.

editors that have mp3 files available, but who were until now, unable to insert them into their pages with a convenient one click solution.

Further Reading ネ綿傍he r42 blog http://bit.ly/d5m3IX

Press insert. As with other media inserted with the media li-



Matthew Lee @seanbun matthew.lee@kenticodeveloper.com

Tips and Tricks If you’re like me you like to get under the hood every now and then and find out just ow things tick, and on the odd occasion that you don’t break something down there you may end up finding

the following. SELECT FROM WHERE

COUNT(*) View_CMS_Tree_Joined SiteName = ‘SomeSiteName‘

something quite uesful. The out of the box Kentico SQL

Document Type Specific Count

Server views are a great example of this. Sometimes you want to query the

Want to know how many documents of

Kentico CMS content tree directly, rather

a specific document type are contained

than via the website UI, and occasionally

within a particular website? Try the

you want answers to questions that the

following.

website UI is not able to provide. The views Kentico provide are pretty straightforward to use, once you know they exist, and you don’t actually need to know all that much to make use of them.

SELECT COUNT(*) FROM View_CMS_Tree_Joined WHERE SiteName = ‘SomeSiteName‘ and ClassName = ‘SomeClassName’

Parent Child Relationships View_CMS_Tree_Joined So far we’ve just scratched the surface The view View_CMS_Tree_Joined pro-

though. What about if we want to find

vides insight into every document con-

how many documents exist beneath a

tained within the Kentico content tree

particular path. For this we need to tap

- root documents, folders, blogs, articles,

into the parent child relationships of

files etc.

nodes within the tree. Every document node within the

Overall Document Count

Kentico content tree contains a unique NodeID. Documents with a parent (ie.

Want to know how many documents you

documents that exist beneath another

have overall within a particular site? Try

document within the tree) also contain a


Tips and Tricks 37

NodeParentID. This information can be used to put complex queries together very easily.

same way as the tree view, and actually

part that does exactly this, but for dem-

contain the same fields as the tree view.

onstration purposes this works well.

They do however also contain any extra

For example, the following query

fields defined by the custom document

answers the question, how many docu-

type. making it possible to write complex

ments exist beneath a certain path.

queries easily.

SELECT COUNT(*) FROM View_CMS_Tree_Joined Parent join View_CMS_Tree_Joined Child on Child.NodeParentID = Parent.NodeID WHERE Parent.NodeAliasPath = ‘/Some/Path’

Let’s say for example, that for some obscure reason we want to list all of our books, ordered by the number of chapters each contains, with the biggest first. The views listed earlier make this possible, but fiddly. The custom views

Want to make things a little more interesting? How about if we wanted to find out how many files exist directly beneath a parent folder. SELECT COUNT(*) FROM View_CMS_Tree_Joined Parent join View_CMS_Tree_Joined Child on Child.NodeParentID = Parent.NodeID WHERE Parent.ClassName = ‘CMS.Folder’ and Child.ClassName = ‘CMS.File’

Kentico creates for us make this easy. SELECT Book.BookName, COUNT(*) from View_Custom_Book_Joined Book join View_Custom_Chapter_Joined Chapter on Chapter.NodeParentID = Book.NodeID group by Book.BookName order by COUNT(*) desc

Note that I’ve used the field BookName,

We’re going to return the breadcrumbs for a given tree node. WITH Hierarchy (NodeParentID, NodeID, Level) AS ( SELECT Tree.NodeParentID, Tree.NodeID, 0 FROM View_CMS_Tree_Joined Tree WHERE NodeParentID = <SomeNodeID> UNION ALL SELECT Tree.NodeParentID, Tree.NodeID, Hierarchy.Level - 1 FROM View_CMS_Tree_Joined Tree JOIN Hierarchy ON Hierarchy.NodeParentID = Tree. NodeID ) SELECT Tree.NodeAliasPath FROM Hierarchy JOIN View_CMS_Tree_Joined Tree ON Tree.NodeID = Hierarchy.NodeID ORDER BY Level

which is a custom field defined when I

What we’re basically doing is taking ad-

created the custom document type book.

vantage of the hierarchy support that

Although this field is not a standard

comes with SQL Server 2005 and 2008,

OK. So, nothing mind blowing yet.

Kentico field, I can access it directly via

and writing what is a very typical hierar-

Where things begin to get interesting is

the new views without having to join

chical query.

when you understand that for any cus-

anything else in.

Custom Document Type Views

tom document type, Kentico provides ready made views to work with. For example, let’s say we’ve created

The syntax may look daunting, but

So basically, we’ve taken the tech-

essentially all we are doing is beginning

nique we used earlier and simply used

with the tree node we are interested in

the new views rather than the tree view.

and recursively joining in all of it’s par-

a document type for storing book infor-

The result is that we are able to join

ents. The top part of the query (the part

mation which we named custom.book,

chapters to books directly via the parent

in brackets) defines the hierarchy, and

and a document type for storing chapter

child relationship.

the bottom part of the query (beginning

information named custom.chapter. Kentico automatically creates two

with SELECT) defines what you’ll get

A complex example

views for us: View_Custom_Book_Joined View_Custom_Chapter_Joined

These two views work in exactly the

back. If you want to dig into this one a

Let’s now try something a little closer to

bit, look up SQL Server CTEs within

home. This example is not code that I’d

Google, or feel free to write to me.

recommend, given that there is a web


Subscribe and Win! A Kentico 5.0 Single Site Ultimate License To celebrate the release of Kentico 5.0, you can now have Kentico Developer delivered to your door for the reduced cover price of $15.00 (plus shipping), and what’s more, by becoming a subscriber you could have the chance to win a Kentico CMS 5.0 Single Site Ultimate License valued at $4,499!

Visit http://www.kenticodeveloper.com for details

Issue 1

Issue 2

Issue 3


Save on your content management When we went to look for a content management system for our customers we had two things in mind: it should be flexible for our customers as well as us, and it should be good value for money. That’s why we like Kentico CMS. And so do our customers. It’s so flexible that we were able to integrate Microsoft Commerce Server, creating a powerful e-commerce platform. But it’s also so flexible and easy to learn that we can create a new web site in two weeks. So why don’t you contact us and see how we can help you save your piggy?

+ 31(0)6 - 497 819 21 contact@avivasolutions.nl www.avivasolutions.nl blog.avivasolutions.nl

Knowledge. People. Solutions.

T: + 31(0)6 - 497 819 21 E: contact@avivasolutions.nl W: www.avivasolutions.nl W: blog.avivasolutions.nl

At Aviva Solutions we believe that using an agile process determines the success of the projects we do. Being agile helps us react to your changing requirements and create the software you need.

That’s why we incorporate agility in all our projects, whether it’s helping you implement a new software factory, building a new web shop, implement your Intranet or helping you with your business intelligence. And it’s all based on Microsoft software.

So why don’t you contact us and see what we can do for you?

Internet & Commerce - Business Intelligence - Information Worker - Application & Software Integration - Customs Solutions & Software Factories



Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.