Installation and Introduction of K2 Content Construction Kit

Exclusive offer: get 50% off this eBook here
Joomla! 1.5 Cookbook

Joomla! 1.5 Cookbook — Save 50%

Over 60 quick and direct recipes to help you overcome common Joomla! queries.

$26.99    $13.50
by Tom Canavan | October 2010 | Cookbooks Joomla! Content Management Open Source Web Development

K2 is a wonderful content creation kit from Joomlaworks.gr that gives you the ability to manage content in an extremely powerful way. In this article by Tom Canavan, author of Joomla! 1.5 Cookbook, you'll learn how to install and configure K2. Using a short cut known as a 'master category', you can templatize your settings in K2 and greatly ease your administration time.

K2 offers some great extras such as connections for YouTube and PhotoGalleries as well. If you add K2 to an existing Joomla! site, you don't have to recreate all the articles. K2 offers an import feature and you'll become very familiar with it here.

In this article, we will cover:

  • Installation of K2 content creation kit
  • Configuration of K2
  • Setting up a master category in K2 to ease your administration time
  • Extras for K2 such as YouTube feeds and photo galleries
  • Importing your Joomla! content into K2

 

Joomla! 1.5 Cookbook

Joomla! 1.5 Cookbook Over 60 quick and direct recipes to help you overcome common Joomla! queries.
  • Find quick solutions to common Joomla! problems
  • Part of Packt's Cookbook series: Each recipe is a carefully organized sequence of instructions to complete the task as efficiently as possible
  • Look at recipes that cover the portions of Joomla! 1.6 that are brand new
  • Over 60 practical recipes covering a range of site management and core Joomla! activities
        Read more about this book      

(For more resources on Joomla!, see here.)

Introduction

Generally speaking, a basic article is a simple matter to create and manage. When a site gets large with a lot of articles, it can be unwieldy. This need is filled by a Content Construction Kit or CCK. Several good CCK's exist in the Joomlasphere and each has its own unique means to accomplish the task of content management and creation.

For our purposes we'll look at the CCK known as K2.

K2 provides you an integrated solution that features rich content forms - extending the basic article. This is an article with additional fields that can contain the article images, videos, image galleries or even attachments. Add nested-level categories and tags to that, and you have a very powerful system.

In this article we'll look at the installation and use of K2.

Installation and introduction of K2

In this recipe you will go through the steps to install and configure K2 in your Joomla! site.

Getting ready

You will want to download K2 from the following URL: http://getk2.org

Additionally, you may want to have a development site to install and learn this on rather than your production site.

How to do it...

  1. Installation of K2 works like any other Joomla! extension.
  2. Be sure and backup your files and database before beginning - this way you can easily roll back should something go wrong.
  3. Download K2.
  4. Log in to your Joomla! site as the Super Administrator.
  5. Click Extensions | Install / Uninstall.
  6. Browse, locate, and upload the K2 package.
  7. Install.

    Installation of K2 should be complete.

    If you are not running the Joom!Fish language translation extension on your site, you will see an informational message stating that K2 did not install the content elements. Joom!Fish is used to translate your site into other languages. If you have no plans on using this, then ignore the message.

    Now when you go to Components, you'll see the K2 icon. Clicking it will show you this screen:

  8. The next step is to bring all of our current content (articles, media, and so on) into K2.
  9. While in the K2 Dashboard, look at the upper right-hand side for the Import Joomla! content button.

    You will see this message (or a similar one depending on your K2 version):

  10. Click Ok to start the process.
  11. Once complete, you'll see all your content now shows up in the K2 Items menu. Here are the sample Joomla! data items that have been imported.

Keep in mind that all of your pre-existing Joomla! sections, categories, and articles are still in the core Joomla! areas. All these items are simply duplicated in K2 now. If you have existing content take a few minutes and go into the Article Manager of Joomla! and unpublish them. You may need to update menu links to your new K2 categories and articles as necessary.

Additionally, you'll note that the main Joomla! administrator page has been updated to include the K2 dashboard.

Further configuration of K2

K2 has a powerful, nested-category system. It offers you the ability to configure in detail, each category, allowing any category to inherit from another category's parameter settings.

Let's use this feature of K2 to configure a master category that will allow other categories to inherit the settings. This means you can change one category and affect them all at the same time – which is quite time-saving.

A word of caution, this could impact your search engine-friendly URLs depending on the extension you use to create them.

  1. Open the K2 Dashboard.
  2. Select Categories.
  3. Click New in the upper right-hand side.
  4. Fill in the following details:

    • Title is the title of your category
    • Title Alias is the internal reference
    • Parent category should be left as –None-- - all other categories will inherit from this category
    • Inherit parameter options from category should be left as –None--
    • Associated "Extra Fields" Group should be left as None.
    • Published is Yes
    • Access Level is Public

    I have filled mine out and the following screenshot is the completed Details section. For now, this is all you'll need to do. Later recipes will utilize this:

    This is my master category that all other categories will seek out their parameters from. The reason for this will be clear shortly.

    When you have finished, save the category.

How it works...

K2 is nearly a content management system, like Joomla!, in itself. It actually substitutes many of the native Joomla! functions like article management, section, and category as well as providing some access control functions.

When using K2, you will no longer use many of the native Joomla! menus, but rather you will use the K2 version of the tools. If you install this component, it has the ability to pull in all the data (users, articles) into K2 through the import feature.

There's more...

In the previous recipe, we set up a master category; now we'll configure it here.

Joomla! 1.5 Cookbook Over 60 quick and direct recipes to help you overcome common Joomla! queries.
Published: October 2010
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:
        Read more about this book      

(For more resources on Joomla!, see here.)

Configuration of your master category

The following screenshot shows a new category created, which is the child of the master category. Thus, it will inherit its settings from the master.

Never assign anything to the master category, always set up a new category for articles, sections, blogs, or other content. You can then tweak the individual categories based on their own requirements.

The two important parts of the details in this category are the Parent category and Inherit parameter options from category. These can be set for different options and using the master category is a style choice, not a technical one.

What this tells our new category is that it should inherit its parameters from the master.

Revisiting our master category, we can see there are many, many options to choose from. Continuing on let's set up our parameters.

The extreme right shows all our parameter settings in the category. Due to the number of different parameters, this will be broken down into several images.

Under the layout template, I have selected and installed a third-party K2 template from the site http://www.k2joom.com. In our example, I am building a 'blog' style website, and will use separate categories to represent different potential authors on the site. All will use the Blog template from K2Joom.com and as such, I have the 'blog' selected in the template field. The rest of the fields deal with columns and leading articles, and so on. The defaults are fine.

The rest of that column shows this:

Next up is Category view options.

Most of these are self-explanatory, however I want to point out to you that the Title should be disabled, or, it will show the category title, in the website.

Each category that inherits its parameters from the master category can be set individually. However, consider if the changes would be better made in the master category, thus changing all inherited categories. For example, you have the ability to define multiple master categories to fine tune your inherited categories.

Master category one has the following inherited categories:

  • Sub-category - Blog on Surfboards
  • Sub-category - Blog on water skis

Each of these has specific settings that match their content.

Master category two has the following inherited categories:

  • Sub-category - Blog on politics
  • Sub-category - Blog on current world events

In these cases, you could tweak just the master categories and touch all the subcategories. The simple advantage for you is it is time-saving.

Item image options

The next set of parameters allows for images to be set by px size. This will vary strictly by your site and content.

Item view options in category listings

There are many options in this section; so again we'll break it down into a couple of images to make it easier to follow:

Some of these will be familiar and others will be new to you. The primary choices I want to point out to you are:

  • 'Featured' notice (next to title): If this is turned on, it displays a nice corner banner on the right upper-corner of the article. This grabs the readers' attention.

  • Extra Fields - Hide or Show: This will hide or show any 'extra fields' that have been added. If you use only one master category, I suggest you refrain from putting extra fields in the master category. Rather, put it in the inherited category. This setting will show them or hide them.

    Here is an example of extra fields in use on the K2 demo site.

  • The rest of the fields correspond to their normal Joomla! equivalents.

Second half of Item view options in category listings

  • Video: The Video Hide or Show corresponds to any video content you put into K2.
  • Enable K2 plugins: It corresponds to the earlier reference of all videos and simple image gallery. This should be set to Yes.

    The rest of the items are self-explanatory and can be left as default unless you have other requirements. Then you may change them to fit your needs.

    The last option field has many choices and will be displayed in multiple images.

Item view options

Again, most of these are self-explanatory and I'll hit the highlights.

  • Social button: This adds a very nice set of buttons for your visitors to employ social media through your site. This includes Twitter, Facebook, Delicious, Digg, Reddit, StumbleUpon, MySpace, and Technorati.
  • Rating (voting): This is to allow people to vote on the article or content.

  • 'Tweet this' link: This will take the visitors over to their Twitter accounts to share your site with their followers.
  • Extra Fields: Shows or hides the extra fields on the article. Extra fields give you the ability to add in any extra information you need. Such as price, weight, color, length, width, and so on.

    This is the final part of the long list of configurable items. Most, if not all, should be self-explanatory.

    Now that these are all set, click Save in the upper right-hand side. This completes the configuration of your master category.

Extra options to enhance K2

The developers of K2, JoomlaWorks.gr offer a few extensions that are top in the categories they exist in. Integrating these into K2 will give your site that extra professional touch.

  • JoomlaWorks "Simple Image Gallery PRO" plugin: It allows you to add image galleries inside your Joomla! articles. As it is a plugin, it will work within articles by simply giving a quick code snippet in the article. As an example, if I had a number of images of automobiles on display, I can add this {gallery}autophotos{/gallery} inside the article.

    This extension will display all the photos as a gallery. In this example, everything uploaded from autophotos displays as an image gallery. You can obtain this plugin from JoomlaWorks.gr

  • AllVideos plugin: This allows you to embed online-streaming videos inside your articles. Your video and audio content can reside on your own server or an outside server.

    One common usage model is to upload a video, say about your company, to YouTube and then use this to display that video on your site.

    Here is an actual example showing how a YouTube video, is being 'displayed' on the site SalvusAlerting.com. The bandwidth is consumed over at YouTube, but shown on their site.

When these two plugins are installed on your Joomla! site, K2 will automatically detect it and will allow the use of these in K2. It is a low cost, but high-reward setup.

Extra fields and groups

K2 has an interesting feature called extra fields and extra groups. Think of these as mini-custom forms you can add to the content. A typical use would be in the catalogue mode of K2. It does work well for things like, author biography on magazine articles or product catalogue extra information such as weight, size, color.

In each article, you can select the group and fields to add. This offers many combinations limited by your imagination. The use of extra fields is completely optional.

Adding extra field groups:

  1. Open up K2 Dashboard.
  2. Click Extra Fields group.
  3. Click New.
  4. Add your group name (example: Products Group).
  5. Save.

    You've created a group to hold your extra fields. Next you will want to create the extra fields.

Adding extra fields:

  1. Open up K2 Dashboard.
  2. Click Extra Fields.
  3. Click New.
  4. Add the name of the Extra Fields in Name (example: Widget Specs).
  5. Click Published Yes.
  6. Pull down the Group (example: Products Group) and choose the correct group or you can create a new group here.
  7. Next choose the type of field you want:
    • Text Field: Displays a single field for text
    • Text Area: It is a large field for text that spans several lines
    • Drop-down Selection list: Provides you any number of fields, allowing you to prepopulate. When you create your article, you can select from the list. Again an example is size, weight, color, and so on.
    • Multi-select list: Allows you to do a multiple selection from a list.
    • Radio buttons: This is the traditional select ‘one' from a list of many.
    • Link text: Allows you to offer a URL with display text, and controls to open a new window or stay in the same window.
    • CSV Data: Upload of CSV data - great for pricing - you can have a single file loaded with pricing. Change the one file in your extra fields, and the pricing would change automatically across your site.

Using the extra fields and groups

Recall that we said a master category can be the overall place holder for your site's settings. It allows you to update settings globally in your site, without touching every article. It allows you to update settings in inherited categories in your site, without touching every article.

You may not want to set your extra fields and extra groups at the master category level but rather choose a subcategory that covers that information.

Taking our concept of a product website we may have something as follows:

This screenshot shows the master category used to globally specify our parameters. The other two categories main New articles and Product Pricing and Specifications are subcategories. Notice the Associated extra fields groups. That tells K2 to allow the use of the Product Pricing extra fields in all articles created in that category. Anytime you create an article, assign it to this group, and include those fields, they will be displayed. Using our CSV field, you can update pricing once - in the extra fields section and it will update all your articles.

One tip to recall, if you have not assigned extra fields to a category, articles created in that category will not display the fields.

Summary

In this article we scratched the surface of K2 by learning how to install, configure, and set up categories. We also explored how to set up a master category enabling you to take advantage of the inheritance features. The next article we be on Managing Articles Using the K2 Content Construction Kit



Joomla! 1.5 Cookbook Over 60 quick and direct recipes to help you overcome common Joomla! queries.
Published: October 2010
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:

About the Author :


Tom Canavan

Tom Canavan has been in the Computer and IT industry for 20+ years where he spent several years as a Systems Consultant to many Fortune 100 clients and other global companies.

Canavan is considered a top security and disaster recovery expert in the Joomla world. He is the author of the Packt Published book Joomla! Web Security.

He is a former CIO and is currently the co-founder of SalvusAlerting.com. Canavan contributes articles on security and disaster recovery to several websites.

Books From Packt


Joomla! Social Networking with JomSocial
Joomla! Social Networking with JomSocial

Joomla! 1.5 Top Extensions Cookbook
Joomla! 1.5 Top Extensions Cookbook

Joomla! E-Commerce with VirtueMart
Joomla! E-Commerce with VirtueMart

ChronoForms 3.1 for Joomla! site Cookbook
ChronoForms 3.1 for Joomla! site Cookbook

Joomla! 1.5 Site Blueprints
Joomla! 1.5 Site Blueprints

Joomla! 1.5 SEO
Joomla! 1.5 SEO

Joomla! 1.5 Templates Cookbook
Joomla! 1.5 Templates Cookbook

Mastering Joomla! 1.5 Extension and Framework Development Second Edition
Mastering Joomla! 1.5 Extension and Framework Development Second Edition


No votes yet

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
w
7
b
y
h
G
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software