Online Chat
 Call Us: 
1-877-744-1221
Browse Submit a Ticket
 
Advanced Search
Tools
Rss Categories

Export articles to XML, HTML, CSV, or SQL

Author: Edward Hardin Reference Number: AA-00540 Views: 8959 Last Updated: 08/13/2014 09:51 AM 0 Rating/ Voters

There is a quite simple way to export articles from the knowledge base that doesn't require programming knowledge (in contrast with exporting via API, where you need at least basic knowledge of PHP, or other language).

Hosted

If you're using a hosted solution and want to export your articles, please contact us.

This method allows you to export all knowledge base articles to XML, HTML, CSV, or SQL format.

  1. Download HeidiSQL tool and install it. You need the latest stable package installer. HeidiSQL runs fine on Windows (2000, XP, Vista, 7) and on any Linux with Wine.
  2. Run HeidiSQL and enter connection data for the MySQL server (the one that stores KMP data).



    If you do not remember connection details, you can find them in the /admin/config.inc.php file under the KMP folder. Scroll to the 50 line of this file (line number may very depending from the KMP version, but you would be able to find the line below anyway), and you will see something like this:
    /admin/config.inc.php

                'tablePrefix'       => ''
    );
    }

    function __getDBConfig() {
    return  array(
    'hostname' => 'yourwebsite.com',
    'username' => 'kmp-user',
    'password' => '*****************',
    'database' => 'kmp',

    Values of "hostname", "username", "password", and "database" parameters can be used to connect to the MySQL database. 

    Possible Connection Problems

    If the "hostname" is "localhost" and you're connecting from a remote host (for example from your PC, while KMP is installed on a remote server), you would need to use the server domain address or IP. 

    If "hostname" may have an internal IP address (e.g. 127.*.*.* or 192.*.*.*) and if you're connecting from another network (which is external to the network with the KMP server), you would need to use the external IP of this server.

    The MySQL server may have connection restrictions, so it is possible that you want be able to connect to it from you PC. Contact your server administrator to resolve this.

    If you experience troubles with connection, it would be better to install HeidiSQL on the same server where KMP or MySQL server runs - in this case you will be surely able to connect. Though security restrictions in you company may not allow this.

  3. Once connected to the MySQL server, select the KMP database on the left, and then click on the Query tab on the right.

  4. Insert the following query to the area below the query tab (this exports article code, title, and body).
    SELECT `code`, `question`, `answer` FROM `faq_articles` WHERE `status` = 'moderated' AND `account_id` = '2';

    or use this one to export categories as well:

    SELECT `code` as "Code", `question` as "Title", `answer` as "Content (in HTML)", GROUP_CONCAT(`cat_name` SEPARATOR ', ') as "Categories (comma separated)" FROM `faq_articles`

    LEFT JOIN `articles_categories` ON faq_articles.faq_id=articles_categories.faq_id LEFT JOIN `faq_categories` ON articles_categories.category_id=faq_categories.cat_id

    WHERE `status` = 'moderated' AND `faq_articles`.`account_id` = '2' AND `question` IS NOT NULL AND `question`!=''  GROUP BY `code`;



    You may need to make changes to the query before running it. For example, if you are using a table prefix, you would need to add it before `faq_articles`, e.g. : `prefix_faq_articles`. Surely, you need to use the actual prefix instead of  the "prefix_". You can find the actual prefix in the /admin/config.inc.php file. It is set by the "tablePrefix" parameter (it is set a little bit higher than MySQL server connection details).

    Custom Query

    You can see that these queries select only four rows of data: `code`, `question`, `answer`, `cat_name`. You may want to select more rows, for example article creation date, its rating, etc. In this case you would need to add these rows to the query. Also you can modify the WHERE part of the query to select articles by certain parameter, for example export only published articles, or articles with rating more than certain value. Refer to the MySQL SELECT syntax for more details.

  5. Press F9 to run the query. If there are lots of articles and you're connecting to a remote database, it may take several minutes to complete the query.

  6. Now you can select the rows you want to export. To select all rows, press Ctrl-A. Then right-click and select "Export grid rows...".

  7. On the last step you can select a desired file name, location and format.



Custom Fields
Database type:MySQL