mmmx
(mmmx)
1
Hy,
i'm developing some plugins, but i have a problem i can't understand
I would like to surcharche some dist function, but when i do that my
redefined function can't find any more all other functions it depends
for.
So it seems i have to surcharge always the whole file
For example i want to redefine the function
formulaires_forum_charger_dist
but then it can't find any more the function forum_documents_acceptes
also making an include_spip of the original file.
Can someone help me understanding it?
Thanks a lot
m.
Hi,
On 29/03/2009, at 2:15 AM, mmmx wrote:
Hy,
i'm developing some plugins, but i have a problem i can't understand
I would like to surcharche some dist function, but when i do that my
redefined function can't find any more all other functions it depends
for.
So it seems i have to surcharge always the whole file
For example i want to redefine the function
formulaires_forum_charger_dist
but then it can't find any more the function forum_documents_acceptes
also making an include_spip of the original file.
Can someone help me understanding it?
Look at <http://trac.rezo.net/trac/spip/browser/spip/ecrire/inc/utils.php#charger_fonction>\. You'll see that the first thing it does (I assume that charger_fonction is the way that SPIP loads, e.g., pages for exec= and action= calls, etc.) is check to see if the function is already defined (then "function_dist", then tries to load).
You should be able to override certain functions in a file by creating your own version in your plugin and include()ing the original file:
// Include the original SPIP file
include_once('inc/blahblah.php');
// Override the built-in definition of the function we're interested in
function inc_blahblah($foo){}
Hope this helps.
Regards,
Thomas Sutton
Web Developer
bouncingorange
graphic + web design