Keyword

Advanced Search

Search Results (Searched for: how to convert k2 items to default joomla articles)

  • Steven Trooster
  • Steven Trooster's Avatar
17 Dec 2021 18:12 - 17 Dec 2021 18:16
Replied by Steven Trooster on topic how to convert k2 items to default joomla articles

how to convert k2 items to default joomla articles

Category: English K2 Community

There are some considerations here concerning galleries, images and extra fields

Galleries
K2 galleries are stored in media/k2/galleries Each gallery has a folder with the id of the article as the name of the folder. 
You can copy this directory and all its content to the images folder

Joomla articles can make use of SIG-pro, but it handles it differently. Where K2 stores the reference in a separate database field, Joomla articles has the code within the text of the article, like {gallery}name_of_folder{/gallery}

To add this gallery code to your articles, add the following to the sql query:

concat_ws('<br/>',`fulltext`, `gallery`) AS 'fulltext

The query will become:
 
INSERT INTO `DATABASENAME_PREFIX`.`PREFIX_content` (`id`, `title`, `alias`, `catid`, `introtext`, `fulltext`, `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, `access`, `featured`, `hits`, `language`)
SELECT `id`, `title`, `alias`, `catid`, `introtext`, concat_ws('<br/>',`fulltext`, `gallery`) AS 'fulltext', `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, `access`, `featured`, `hits`, `LANGUAGE`
FROM `si3ow_k2_items`;

Images
K2 has no reference to images in the database. The images are stored in media/k2/items/cache/. When you create a new article and add a header image, K2 will create 6 versions of that image. The filename is a MD5 hash of the word 'Image' and the id of the article (Note the capital I in Image). Followed by _Generic, _L, _M, _S, _XL and _XS. All images are in jpg format, even if the original is png or gif.

You can copy all the files from the cache directory to your images folder. I would suggest to create a subfolder called K2 or something of your liking, inside the folder stories.

You can choose which one of the 6 file sizes you want to use with your Joomla articles, and you can even use different sizes for intro text and for full text. The sql-code for creating a reference to the correct (extra large) file will be: 

CONCAT(MD5(CONCAT('Image',`id`)), '_XL.jpg')

Joomla content stores a reference to both intro text and full text in one field images. The content of that field is JSON format. 
{"image_intro":"","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}

Note that where K2 has two fields for the image caption (caption and credits), content only has a caption.
So the query for the XL images set as intro and full text will become:

CONCAT('{"image_intro":images\/stories\//k2"',MD5(CONCAT('Image',`id`)), '_XL.jpg','"float_intro":"","image_intro_alt":',`title`,'"","image_intro_caption":"',CONCAT(`image_caption`, ' Credits: ',`image_credits`),'","image_fulltext":',MD5(CONCAT('Image',`id`)), '_XL.jpg','"","float_fulltext":"","image_fulltext_alt":"',`title`,'","image_fulltext_caption":"',CONCAT(`image_caption`, ' Credits: ',`image_credits`),'"}' ) 

So the complete query should be:

INSERT INTO `DATABASENAME_PREFIX`.`PREFIX_content` (`id`, `title`, `alias`, `catid`, `introtext`, `fulltext`, `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, `images`, `access`, `featured`, `hits`, `language`)
SELECT `id`, `title`, `alias`, `catid`, `introtext`, concat_ws('<br/>',`fulltext`, `gallery`) AS 'fulltext', `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, CONCAT('{"image_intro":images\/stories\//k2"',MD5(CONCAT('Image',`id`)), '_XL.jpg','"float_intro":"","image_intro_alt":',`title`,'"","image_intro_caption":"',CONCAT(`image_caption`, ' Credits: ',`image_credits`),'","image_fulltext":',MD5(CONCAT('Image',`id`)), '_XL.jpg','"","float_fulltext":"","image_fulltext_alt":"',`title`,'","image_fulltext_caption":"',CONCAT(`image_caption`, ' Credits: ',`image_credits`),'"}' ), `access`, `featured`, `hits`, `LANGUAGE`
FROM `DATABASENAME_PREFIX`.`PREFIX_k2_items`;

(MySQL throws me an error. I'm not sure where it's wrong )

Extra fields
All of this doesn't covert your K2 extra fields to Joomla custom fields. K2 stores the extra fields information in one singe field in the items table. The format is JSON.
Joomla stores the custom fields in a separate table, with a row for each custom field value and a reference to the article id.

I have no idea how to convert the extra fields to custom fields with sql.

Note
Be aware the query above will insert the K2 item ID into the Joomla content table. If you already have articles in Joomla content, this might lead to conflicts.

 
  • Goble002
  • Goble002's Avatar
02 Apr 2021 09:44
Replied by Goble002 on topic Replace space by dash in K2 Tags

Replace space by dash in K2 Tags

Category: English K2 Community

Hi and thanks Fotis,

Like explained, I've tried "Enforce SEF URL character replacements". It's simply not working for me.
"Enforce SEF URL character replacements" > Yes

The default values in "SEF URL character replacements" are not doing anything, For example : tag "Àtest" is not being converted to "Atest".

I have disabled .htaccess, disable/enable SEF (just below). I have tried another joomla site (completely different): no luck as well. So could not be an extension conflict.

However for Joomla articles, tags with "Àtest" are converted to "Atest". 

Extract from Joomla documentation

"In Joomla!, each component is responsible for handling its own SEF URLs. Therefore, as the developer of a component, you will have to create your own router to allow your component to use SEF URLs."

So Joomla Core will not help here.


Fotis wrote :

"On the other hand, if you make distinct menu items, then you can create your own URL alias, in which case you can of course insert a dash between a tag's words."

>> Like explained I can't afford to have menu item for the k2 tags.


 
  • losa
  • losa's Avatar
23 Mar 2014 23:38

how to convert k2 items to default joomla articles

Category: English K2 Community

what actually you are referring with this image

1dream of future thing on your website

which in future will have more that 30% operational content and usable links or what.

nothing on your website works

or you just think your avatar is awesome


which i think it is not
  • thongtran
  • thongtran's Avatar
10 Mar 2014 05:13 - 18 Mar 2014 05:08

How to export K2 contents back to Joomla contents

Category: English K2 Community

I've posted an one click solution here: getk2.org/community/English-K2-Community/133756-how-to-convert-k2-items-to-default-joomla-articles

So, if there is any reason (template doesn't support or something), you can use the K2 to Joomla Content converter by foobla.

  • thongtran
  • thongtran's Avatar
10 Mar 2014 05:05 - 18 Mar 2014 05:07

how to convert k2 items to default joomla articles

Category: English K2 Community

K2 is a great CCK for Joomla.
However, sometimes people need to convert back to Joomla articles because of template stuff or something.
In that case, you can use one click solution by foobla > K2 to Joomla Articles converter , it works the same way K2 import items from Joomla Content.

  • Andreas A
  • Andreas A's Avatar
14 Feb 2014 08:31

how to convert k2 items to default joomla articles

Category: English K2 Community

Thank you guys, your input proved invaluable!

I managed to move my K2 items succefully, with no intro image though.

Davor, I tried to understand your steps, and I'm not sure I did. It is still a manual task that has to be done in each article seperately, right?

I was wondering if it could be done with a query or something. But looking into the k2 items db, I wasn't able to see anything relevant to the intro image. I found cells about everything else, but not for the main item image. Should I be looking somewhere else?

Davor wrote: I don't know about tags, I didn't move them but I moved images this way:

  • karlo
  • karlo's Avatar
02 Nov 2013 12:49

how to convert k2 items to default joomla articles

Category: English K2 Community

I used these, but before that I changed a few of the fields of k2 tables to suit those in PREFIX_content ...PREFIX_categories
I advise if items are few, transfer them manually
I hope you understand?


CATEGORIES

INSERT INTO `DATABASENAME_PREFIX`.`PREFIX_categories` (`id`, `title`, `alias`, `published`, `access`, `parent_id`, `language`, `extension`, `level`, `path`, `params`, `asset_id`)
SELECT `id`, `title`, `alias`, `published`, `access`, `parent_id`, `language`, `extension`, `level`, `path`, `params`, `asset_id`
FROM `DATABASENAME_PREFIX`.`PREFIX_k2_categories`



Articles

INSERT INTO `DATABASENAME_PREFIX`.`PREFIX_content` (`id`, `title`, `alias`, `catid`, `introtext`, `fulltext`, `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, `access`, `featured`, `hits`, `language`)
SELECT `id`, `title`, `alias`, `catid`, `introtext`, `fulltext`, `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, `access`, `featured`, `hits`, `language`
FROM `DATABASENAME_PREFIX`.`PREFIX_k2_items`


TAGS

INSERT INTO `DATABASENAME_PREFIX`.PREFIX_tags` (`id`, `parent_id`, `lft`, `rgt`, `level`, `path`, `title`, `alias`, `published`, `access`, `language`)
SELECT `id`, `parent_id`, `lft`, `rgt`, `level`, `path`, `title`, `alias`, `published`, `access`, `language`
FROM `DATABASENAME_PREFIX`.`PREFIX_k2_tags`
  • Flavia Silveira
  • Flavia Silveira's Avatar
30 Oct 2013 04:36
Replied by Flavia Silveira on topic how to convert k2 items to default joomla articles

how to convert k2 items to default joomla articles

Category: English K2 Community

I'm going to attempt this daunting move with a 2.5 site. Can someone post the SQL queries for moving the content, categories and tags here?

Thank you in advance,

Flavia
  • karlo
  • karlo's Avatar
28 Oct 2013 20:24 - 28 Oct 2013 20:25

how to convert k2 items to default joomla articles

Category: English K2 Community

Thank you, Davor!!!
I'll try what you offer. I think I understand. I moved articles, categories and tags using MYSQL. I could only picture and synchronizing tags with articles.

That's how I moved tags, but I changed the table structure jos_k2_tags

TAGS
INSERT INTO `DBNAME_news`.`jos_tags` (`id`, `parent_id`, `lft`, `rgt`, `level`, `path`, `title`, `alias`, `published`, `access`, `language`) SELECT `id`, `parent_id`, `lft`, `rgt`, `level`, `path`, `title`, `alias`, `published`, `access`, `language` FROM `DBNAME_news`.`jos_k2_tags`
  • Davor
  • Davor's Avatar
28 Oct 2013 19:44

how to convert k2 items to default joomla articles

Category: English K2 Community

I don't know about tags, I didn't move them but I moved images this way:

1. Found out URL of K2 images, e.g. /media/k2/items/cache/319a6b58175c8348e5b537a311344d30_S.jpg

2. Put any image into Joomla article to see structure in database. And I saw the structure is like this:
{"image_intro":"images\/some_folder\/e0a70f72bdae9885bfc32d7cd19a26a1_S.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
Notice that link is images \ / some_folder \ / (without empty spaces, so backslash and slash)

3. Copied all images from old website from old folder /media/k2/items/cache/ to my new website and new folder /images/some_folder/

4. I than open xxx_content (where xxx is db prefix) table in my database and put that code from #2 inside all articles (450) but without url of image, so I put it like this:
{"image_intro":"images\/some_folder\/_S.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
Notice that there isn't url of image, structure is images \ / some_folder \ / _S.jpg

5. And than I opened 2 tabs (or explorer windows) and
a) opened first K2 item, copy url
b) opened database of new website and paste name of that picture inside xxx_content, not the whole url, just the image name (if url is /media/k2/items/cache/319a6b58175c8348e5b537a311344d30_S.jpg I copied just 319a6b58175c8348e5b537a311344d30 without _S.jpg and rest of the url) along with images field structure in #4
c) and now inside database the whole structure of images field of that first article is:
{"image_intro":"images\/some_folder\/319a6b58175c8348e5b537a311344d30_S.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}

6. Again paste that structure in images filed in database of new website and copy-paste image name in url.

It's a bit complicated but it will took you just 30 sec when you know what are you doing. Do this or let cms2cms do this for you for 200-300 $ (price depends on how many articles you have). OR when you have all your articles migrated from K2 to joomla, using method I posted above, you can open every article and upload image. You see how this will be hard to do? It's simpler to follow my steps
  • karlo
  • karlo's Avatar
28 Oct 2013 19:11

how to convert k2 items to default joomla articles

Category: English K2 Community

How can you move images, and tags from K2 into Joomla articles? I have 3000 articles with pictures... :(
  • Davor
  • Davor's Avatar
23 Oct 2013 16:34

how to convert k2 items to default joomla articles

Category: English K2 Community

and DON'T FORGET to fix asset_id. Here's how docs.joomla.org/Fixing_the_assets_table otherwise you will have indexing problems at home page, categories and so on. Fix asset
  • Davor
  • Davor's Avatar
21 Oct 2013 16:03

how to convert k2 items to default joomla articles

Category: English K2 Community

this query worked for me!! I'm using joomla 3.1.5, k2 2.6.7

INSERT INTO `yourDBname`.`prefix_content` (`id`, `title`, `alias`, `catid`, `introtext`, `fulltext`, `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, `access`, `featured`, `hits`, `language`)
SELECT `id`, `title`, `alias`, `catid`, `introtext`, `fulltext`, `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, `access`, `featured`, `hits`, `language`
FROM `yourDBname`.`prefix_k2_items`
  • Davor
  • Davor's Avatar
20 Oct 2013 14:06

how to convert k2 items to default joomla articles

Category: English K2 Community

sorry for bumping old topic but still nobody find a solution for this

so I'm using j3.1.5 and I want to move K2 items to joomla content
I'm unsuccessfully using this sql query command but no luck, what am I doing wrong?

insert into `ZZZ_content` (id, title, alias, catid, introtext, fulltext, created, created_by, created_by_alias, checked_out, checked_out_time, modified, modified_by, publish_up, publish_down, access, featured, hits, language) select id, title, alias, catid, introtext, fulltext, created, created_by, created_by_alias, checked_out, checked_out_time, modified, modified_by, publish_up, publish_down, access, featured, hits, language from `ZZZ_k2_items`

- where ZZZ is prefix
- error I get: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'fulltext, created, created_by, created_by_alias, checked_out, checked_out_time, ' at line 1
  • Andrew Gaskell
  • Andrew Gaskell's Avatar
25 Jul 2013 23:33
Replied by Andrew Gaskell on topic how to convert k2 items to default joomla articles

how to convert k2 items to default joomla articles

Category: English K2 Community

Hi

Just a quick one, I found the best query for categories was...
insert into vh4z6_categories (title, alias, description, parent_id, published, access, extension, language) select name, alias, description, parent, published, access, 'com_content', '*' from vh4z6_k2_categories 

Where "vh4z6" is your table prefix
  • Macrohard
  • Macrohard's Avatar
04 Oct 2011 02:25

how to convert k2 items to default joomla articles

Category: English K2 Community

Well, so I thought.  It still didn't bring the fulltext over.

Jason Knight said:
Had to add it in like:

 

insert into jos_content (title, alias, introtext, `fulltext`, state, sectionid, catid, created_by, metakey, metadesc, ordering) select title, alias, introtext, `fulltext`, published, '2', catid, '69', metakey, metadesc, ordering from jos_k2_items
  • Macrohard
  • Macrohard's Avatar
04 Oct 2011 02:21

how to convert k2 items to default joomla articles

Category: English K2 Community

Had to add it in like:

 

insert into jos_content (title, alias, introtext, `fulltext`, state, sectionid, catid, created_by, metakey, metadesc, ordering) select title, alias, introtext, `fulltext`, published, '2', catid, '69', metakey, metadesc, ordering from jos_k2_items
  • Macrohard
  • Macrohard's Avatar
04 Oct 2011 02:19

how to convert k2 items to default joomla articles

Category: English K2 Community

How in the hell to get the fulltext?  I keep getting errors!

Samm Carbo said:
Nevermind I figured it out!  Very exciting!
  • Samuel Carbo III
  • Samuel Carbo III's Avatar
16 Aug 2011 03:59
Replied by Samuel Carbo III on topic how to convert k2 items to default joomla articles

how to convert k2 items to default joomla articles

Category: English K2 Community

Nevermind I figured it out!  Very exciting!
  • Samuel Carbo III
  • Samuel Carbo III's Avatar
16 Aug 2011 03:51
Replied by Samuel Carbo III on topic how to convert k2 items to default joomla articles

how to convert k2 items to default joomla articles

Category: English K2 Community

Alright got it to work, a couple of things though I really hope you still get messages here recipe.

 

First and probably most importantly right this minute is, your code... should be changed from....

 

insert into jos_content (title, alias, introtext, state, sectionid, catid, created_by, metakey, metadesc, ordering) select title, alias, introtext, published, '2', catid, '69', metakey, metadesc, ordering into jos_k2_items

 

to...

 

insert into jos_content (title, alias, introtext, state, sectionid, catid, created_by, metakey, metadesc, ordering) select title, alias, introtext, published, '2', catid, '69', metakey, metadesc, ordering from jos_k2_items

 

Once the code is changed following your directions are simple.

 

Next, I would like to make some minor adjustments however I keep getting errors, I would like to have 'Hits' as well as 'created' added to this query, I am really hoping this is possible, as I think after two years you may have just made me what is possibly the happiest guy on the internets right now.

 

 
Displaying 1 - 20 out of 24 results.

Powered by Kunena Forum