How do I get Joomla to run some scripts every time I create a k2 item?

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
shenkwen
Joomla! Intern
Joomla! Intern
Posts: 96
Joined: Mon Sep 12, 2011 10:39 pm

How do I get Joomla to run some scripts every time I create a k2 item?

Post by shenkwen » Mon May 02, 2016 6:04 pm

I am using k2 to buildg my Joomla 3.5 site. My k2 items are basically [youtube] videos, every [youtube] video has a URL pattern for its preview image and I want it to be the item's image. But I don't want to bother with the repetitive job (copying the video ID, fitting it into the URL, and saving it as the item's image) every time I create an item. So I am thinking maybe I can write some script to automatically get the images(it is easy to do once the video's id is provided). The problem is, this script has to be exectued every time I create an item.

I just start to learn some basic things about Joomla extension developing, my question is, which category does the thing I want to fall into? Shall it be a plugin? Or a k2 plugin? Or there is totally no interface for this kind of thing and I will have to hack some PHP file?

Furthermore, I also have some node.js script to scrape the description of the [youtube] videos(Yes I am being lazy again, I don't want to copy and paste those descriptions every time I create an item). How do I get Joomla to run these node.js scripts?

phamtungpth
Joomla! Guru
Joomla! Guru
Posts: 502
Joined: Mon Aug 26, 2013 2:32 am
Contact:

Re: How do I get Joomla to run some scripts every time I create a k2 item?

Post by phamtungpth » Wed May 04, 2016 7:43 am

Hi shenkwen,

I think you could try to develop a system plugin which could trigger the event onContentSaveBefore (or onBeforeContentSave - somethings similar).

FYI: It seems obGrabber is the most suitable extension for the persons who are lazy like you :").

Regards!


Locked

Return to “Joomla! 3.x Coding”