Monday 5 January 2015

Installation and introduction of K2 (a joomla extension)

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.

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.
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.

Joomla quickstart package installation problems and solutions

In Joomla quickstart package installation process, you may have some problems which generally disturb your works whether you are beginers or not. You may not be able to start your Apache server or your process hangs on in any step...
Here are solutions for Joomla 2.5 and Joomla 3.x as well that you can follow. They are assured by my real experience.

1. Cannot start Apache service


It's a common problem while starting XAMPP, specially Skype users. The default port of both Skype and Apache service is 80. In order to use both of them, you should change the port number for one of them.

Change Skype Port:

+ Go to: Skype -> Tools -> Options ->Advanced settings -> Connection
+ Unstick "Use port 80  and 443 for additional incoming connections"
+ Change Use port to other number (I use port 81)
Change Apache Port:
+ Go to: C:\xampp\apache\conf
+ Open file: httpd.conf (recommend: open with Notepad++)
+ Find line: Listen 80
+ Change 80 to any other number (example: 8080)
+ Save and restart Apache service
Note: On browser, you should type: localhost:8080 instead of localhost as normal.

2. Stuck in database installation


While installing both Joomla 2.5 and Joomla 3.x, I see a common problem is that it cannot turn the database installation to next process. It seems to be a never-ending process.


There're some tips to solve the problem. You can combine all of these tips if a single one cannot effectively solve.

Open file php.ini in C:\xampp\php\php.ini

Note:  Stop Apache server before doing any modifications and start it again after saving these modifications.


Tip 1: Turn off "display errors"

In php.ini, find line "display_errors=On" replace with "display_errors=Off"

Tip 2: Increase execution time in php.ini

Find line "max_execution_time=30" change to "max_execution_time=3000"

Tip 3: Increase memory limit

Increase "memory_limit=128M" to "memory_limit=256M"

Note: Joomla 3.x installation freezes at Creating database tables



In case of Joomla 3.x installation freezes at Creating database tables in spite of using all these above tips, you can use the following method:

Find the term "ENGINE=InnoDB" and replace ALL with "ENGINE=MyIsam". It can be changed in /installation/sql/mysql/joomla.sql.

3. Nothing happen when click "Language Setting"


Some of you may be in this situation. And you wonder why and how for the problem.



In Joomla installation folder, go to: installation/views/ftp
Open file: 'view.html.php' rename the class ‘InstallationViewFTP’ to ‘InstallationViewFtp

In conclusion, these above errors are the most common problems which Joomla users face while installing quickstart package.  By following How To Install Joomla Quickstart Package guide you will reduce the risk of error for your process.

Duplicate Pages in Joomla: Causes, Most Common Errors & Solutions

Everyone who has a Joomla website sooner or later faces the problem of duplicate pages. So let’s have a look at this problem from inside, we’ll sort out what duplicate pages are, how search engines react to them, and how to get rid of these evil twins.
So, page duplicates are identical documents on your websites that are available via different URLs. Actually page duplicates are weak spots of most CMSs, not only of Joomla. All these pages are harmless until they are indexed by crawlers. The main thing to watch for indexing and promptly take action to remove these pages from the results, it's much best to think over the structure in advance and avoid these situations.
The main reason for duplicates to appear is the wrong structure of the website. First of all, you need to think over the hierarchy of categories and menu items. If you create multiple categories in advance this can prevent duplicate pages from appearing in future.
When you just start a website you need to think over its structure and identify main categories and subcategories. With the growth of your resource there is no need to change existing structure, simply add necessary additional sections. Restructuring your website at the peak of development is a heavy blow, which can sit you for months. In fact, some pages (or all of them) will change their addresses, which will lead to inevitable reduction of positions in search results and attendance.

So How Do Search Engines Find Duplicate Pages?

The most common cause are the extensions and components that devs install onto Joomla website. Example - news module on homepage can give different address. Sometimes these page duplicates can be seen even in the sitemap, for example, if you have Xmap installed.
If your site is already indexed, then its not that hard to find duplicate content, just copy couple unique offerings from the page and insert this material in quotation marks in Google search. If your site is not indexed, you can try XENU (in case your website is not really big), it will find all possible ways to the site.

Why Do We Need to Get Rid of Page Duplication?

Search engines "don't like" and try not to index websites having great amount of identical pages cause their necessity for search is somehow questionable. While optimizing pages for certain keywords most relevant pages are selected and content is optimized for them. If those pages have duplicates, during update search engine may substitute relevant pages with their doubles (this is accompanied with a sharp fall in positions and subsidence of traffic).

6 Ways to Get Rid of Doubles

Each subject (website) is unique, let’s have a look at most popular methods that work perfectly fine in 99% cases. Feel free to choose any of these options or use some of them in complex. Generally, these solutions can be applied to any other CMS.
All of these examples are valid if you turned on standard SEF and URL redirection in general settings of Joomla.

1. StyleWare Content Canonical Plugin

The content canonical plugin resolves the issue with multiple URLs of single page. So if you have component/content/article/32-something.html and something.html, both will be indexed from one URL (something.html). That's an awesome plugin that does what it’s supposed to.

2. Robots.txt for Joomla

The file is included into the standard package of Joomla, planted into the root directory and is available via link yourwebsite.com/robots.txt. It gives instruction to search engines on how to index website. With it’s help you can shut down some parts of your website. Additionally you can use following instruction to the default data in the file:
Disallow: /*? #each links that contains this sign will not be indexed *
Just one line saves you from storing great amount of chunk, like:
  • page materials for printing;
  • link to rss feed;
  • the search results page on the site;
  • will also close the page pagination;
  • there may be other options, depending on the extensions used.
Whether to use this line* or not, is up to you, keep in mind that too large robots file is considered to be fully permitting. Please note: the line must not cover something important like sitemap, thus you can simply add line Allow: /site_map You can read more about Sitemap in google help.

3. Redirect 301

Redirect 301 is appropriate if you have changed URLs, but all documents still exist. In this case, for proper bonding you need to use redirect 301 in .htaccess file. Search engines will know that the document was moved to a new address. This method allows you save both your website performance and PR.
301 redirect can be used also for gluing page doubles. For example, widely-known duplicates of the home page in a Joomla website are /index.php and the alias of the menu Home, for example: /home or /homepage, these items can be glued pretty easily: open your .htaccess file and enter:
Redirect 301 /index.php http://site.com/
...or else you can make the redirect 301 in the index file of your template:

<?php
if($_SERVER['REQUEST_URI'] == '/index.php') {
header("Location: /",TRUE,301);
exit();
}
?>

Here is a classy example of a website url with and without www.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
* example.com replace with your site domain name.
In this blog post you can find more ways on how to use redirect 301.

4. Meta Tag Robots

One more way on how to prevent indexing page duplicates - use meta tag robots:
<meta name="robots" content="noindex"/>
For now this option is much better for Google than to use blocking instructions in robots.txt file. For example to close the page version for printing you need to take the address, you can open the component.php file in the root of your template and enter the tag ?tmpl = component in <head> </ head>.
To close pages for search results you can use standard com_search in index.php of your template simply add following condition:

<?php if ($option == 'com_search') : ?>
<meta name="robots" content="noindex"/>
<?php endif; ?>
But firstly you need to specify variable:
$option = JRequest::getVar('option', null);

5. Deleting URLs from Webmaster's Panel

One more way to get rid of duplicates is to delete them manually from webmaster’s panel, for Google — https://www.google.com/webmasters/tools/home?hl=en

6. X-Robots-Tag Titles

Google recommends to use X-Robots-Tag as an alternative to the 4th method in this roundup.
HTTP/1.1 200 OK
Date: Tue, 25 May 2010 21:42:43 GMT
...
X-Robots-Tag: noindex
...
As you see there are lots of ways on how to remove duplicates, though you need to understand how each of them works, to pick most appropriate option for you.