I’m developing an extension wich revamps the publish form, adding a custom field wich allows to select an image from a gallery(using the gallery module). I want to implement the selection of the especific picture with AJAX… Is there a way to call with an URL a function in the php file of the extension? or something like that? (I want to implement all the backend in the same file)
Thanks (If I manage to finish this extension I will share it 😉 )
Depending on what you’re doing, I think you will probably need to include it like you would the typography class.
if ( ! class_exists('Typography'))
{
require PATH_CORE.'core.typography'.EXT;
}
$TYPE = new Typography;
I’m going to shift this down to the extensions forums, as it’s a better fit.
I hope I’m understanding your question correctly and that is what you’re looking for.
-greg
mmmm, I want to do this :
I have an extension
Class extension
{
constructor
.
.
.
function do_something($params)
{
//this function is called by a hook etc...
}
function do_something_outside_the_extension()
{
//do something with $_GET params
}
}
and i want to somehow externally call function do_something_outside_the_extension
It DID get answered. I think it must have been by Victor G, and was deleted when he got in trouble. Anyway, as I remember the trick is to intercept the page request (using the view_entry_start or admin_home_page_start hooks, depending on whether you’re on the front-end or back-end) and check for your parameter.
In other words, you would call http://example.com/?my_extension=1&my_data=123. Then in your function that is called by the hook, do something like:
global $IN;
if ( !$IN->GBL('my_extension', 'GET') )
{
return; // This call isn't for us
}
else
{
// Do your thing here
$EXT->end_script = TRUE; // Cancel everything else
}
(Coded off the top of my head. May not work right….)
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.