4 min read


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

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.

Subscribe to the weekly Packt Hub newsletter. We'll send you this year's Skill Up Developer Skills Report.

* indicates required


Please enter your comment!
Please enter your name here