Hello community,
to be able to provide easy to install updates of the CMSimple_XH core for everyone, it might be necessary to introduce additional hooks, so that the core files musn't be changed individually.
CMSimple_XH introduced the possibility to use the file userfuncs.php already. This file is included from the core, but will not be distributed with it. So you can use the userfuncs.php to define new constants, variables, functions, classes etc. for use from the template or the content via CMSimple scripting. It is furthermore possible to include script code to userfuncs.php that will be evaluated at the global namespace, when the file is included. If extensive modifications are required, it's possible to include other script files from userfuncs.php.
userfuncs.php is included by functions.php. functions.php is included by cms.php very early, i.e. before the pluginloader and the template. So it should be possible to use userfuncs.php for the most cases of modifications you need.
Are there any other hooks, that might be missing to make modifications to CMSimple_XH without altering the core files?
Christoph
Individual modifications to the CMSimple_XH core
Individual modifications to the CMSimple_XH core
Christoph M. Becker – Plugins for CMSimple_XH
Re: Individual modifications to the CMSimple_XH core
I never war enthusiastic about this userfuncs.php - it is somewhat redundant. There are two ways to integrate your own functionality that I like more: The stuff that is used just for a special template can be included from (or written to) the template.htm. More general enhancements can be put into a folder plugins/my_stuff. Both ways are older and I don't remember why we added userfuncs.php at all.
I would not call this includes a "hook", not in a classic sense. The only thing that comes close to a "hook" is $f. Here your scripts get informed about an action that CMSimple is about to perform and may change the default behaviour:
But I don't think its too bad that CMSimple has no real event dispatcher. At least when it comes to the point of frontend output. When the template is included everything you need is known and there are such a few variables and "output functions" that it is easy to filter and change them in the way you need it.
Martin
I would not call this includes a "hook", not in a classic sense. The only thing that comes close to a "hook" is $f. Here your scripts get informed about an action that CMSimple is about to perform and may change the default behaviour:
Code: Select all
if($f == 'search'){
$f = 'xyz';
$o .= my_private_own_search();
}
Code: Select all
<?php
//echo content();
echo my_content();
?>
Re: Individual modifications to the CMSimple_XH core
Hello Martin,
Christoph
As you pointed out: userfuncs.php is somewhat superfluos. But as it does already exist, it might be easier to grasp for an user to put his stuff into userfuncs.php than into a separate folder in plugins/Martin wrote: Both ways are older and I don't remember why we added userfuncs.php at all.
Thanks for pointing this out. Is it advisable to use the request parameter function, which is somewhat coupled to $f, for user defined operations?Martin wrote: The only thing that comes close to a "hook" is $f.
Christoph
Christoph M. Becker – Plugins for CMSimple_XH