Keyword

Access K2 environment from non-Joomla PHP program?

  • Edward Coast
  • Edward Coast's Avatar Topic Author
  • Offline
  • New Member
More
12 years 2 months ago #67976 by Edward Coast
I need to write a stand alone script (PHP) to read K2 Item's Extra Fields from the MySQL database. How do I pull in the environment needed in my stand alone PHP script to access the Joomla & K2 functions to do this? Please provide specific PHP code examples of doing this. Or if there is a document that explains this, please provide the URL for it. Thank you!

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

More
12 years 2 months ago #67977 by william white
Replied by william white on topic Re: Access K2 environment from non-Joomla PHP program?
I have seen ways to use joomla command line interface (in 1.7 and later) to hook to strait php code to process things. There is a sample somewhere on Joomla.org i think about it.

If the site is running Joomla and K2 you might consider using a k2 override, strip it clean all except the extra fields loop, and instead of outputting them, just pass them to your php program or declare them global variables and then call your php file from there to use the data and return the html you want to return.

Otherwise, write code to access the table directly, and extract the extra field information directly from the field that contains all the extra fields in one string and use it.

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

  • Edward Coast
  • Edward Coast's Avatar Topic Author
  • Offline
  • New Member
More
12 years 2 months ago #67978 by Edward Coast
Thanks for the helpful reply, William. I forgot to mention that this stand-alone non-Joomla PHP program would be run as a CRON job.

If I'm accessing the MySQL database directly for the K2 Item Extra Fields from a non-Joomla PHP program are these the only Tables involved _k2_extra_fields & _k2_items? Thanks!

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


Powered by Kunena Forum