Keyword

Connect Whole K2 component to external database

  • archit
  • archit's Avatar Topic Author
  • Offline
  • New Member
More
9 years 3 months ago #145025 by archit
Hi All,

I wish to connect the complete K2 component to an external database. For this i got few links and add code in K2 model to connet to external database, till this i am not having a problem, but i wish to even use the JFactory and other joomla default classes to access there data from this external database.

Can this be possible and how?

Regards.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 months ago #145075 by Krikor Boghossian
Replied by Krikor Boghossian on topic Connect Whole K2 component to external database
Hello,

It is possible,

You need to follow the instructions on this post.
docs.joomla.org/Connecting_to_an_external_database

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago - 8 years 7 months ago #151051 by Tibbe van Asten
Replied by Tibbe van Asten on topic Connect Whole K2 component to external database
Hi Krikor,

Can you point me to the k2 php-file where this is to be implemented?

My intensions are similar. I want to create a subdirectory where company's can add k2 items, and show these items on my main website.
So can I connect one single category to another database?

Kind regards,
Tibbe
Last edit: 8 years 7 months ago by Tibbe van Asten. Reason: More explaining

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #151067 by Lefteris
@Tibbe van Asten

You have to build your own extension to do this. K2 will always use the database of the site it is installed.

So, once you build your extension you can follow the instructions at docs.joomla.org/Connecting_to_an_external_database and make a connection to an other database and query that database.

Alternatively, instead of querying the database you can use the built-in JSON views of K2 to fetch the data from a different site. You can do this by appending ?format=json to a K2 category or item view page URL.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum