Currency Converter

  • Currency
  • US$ Amount

Hook points system

Dimofinf offers you a professional and simple system for hook points. The hook point is a set of points centers which are planted and distributed within the PHP files whether for Dimofinf or your programming allowing you or other programmers to execute your own codes and call them to these points. This permits the programmer to add his own programmed additions to the program without needing to alter the source file of the main file. The following are some points you need to bear in mind with regards to hook points in Dimofinf:

  • The hook points are stored in an xml file. As in Dimofinf, the hook points file is found in the path 'include/xml' under the name 'hook_points.xml' but in plugins it is found in the path 'include/pluginfolder/xml/pluginfolder-hook_points.xml' replacing 'pluginfolder' with the plugins folder name.


An example for the xml file for the points of the template zone:

<?xml version="1.0" encoding="UTF-8"?>
// hook points groups	
	<hookmodule module="hookgroup">
  • Hook points are classified into groups and each group has its own points.
  • The feature 'module' in the 'hookmodule' tag is the name of the hook points group.
  • The 'hook' tag includes the name of the hook point.


      - Planting a hook point in a place within the PHP file:

You can plant a focal point in the PHP file anywhere you want, in order to make it available to call this point noting that this point must be predefined in the hook points file for the plugin and that the group this point belongs to is called at the beginning of the PHP file.  

The names of the hook points groups, which include points authorized for execution in this file, should be added to the beginning of the PHP file which is found in the main path of Dimofinf. This is done by adding to the matrix '$Globalhookmodules' in addition to the beginning of the PHP file before calling any file from the 'include' folder.


{* php buffer start *} $Globalhookmodules[] = 'editor';
Then plant the hook focal point:
if (

{* php buffer end *}

Where the function '$hook->hook_exist()' verifies whether the hook point is available for calling or not (to make sure that the point is added to the hook points xml file and that the group has been defined for calls). When verified, the function '$hook->execute_hook()' executes the point and calls all the functions sent to it from plugins and executes them.

Quick note: you can pass a matrix of parameters to the sent functions from the plugins to the hook point with 'Reference' for purposes like, altering the value in a variable within the main PHP file.


{* php buffer start *} if ($hook->hook_exist('section_rss'))
$hook->execute_hook('section_rss', array(&$row));

{* php buffer end *}

      - Sending a function from the plugin to the hook point:

Through your plugin, you can send your code to the hook point by adding the code in a function then sending it to the hook point using the function 'add_hook()'.


In the plugins functions folder in this path 'include/plugins/pluginfolder/pluginfolder_plugin.php', replacing 'pluginfolder' with the name of the plugins folder.

Place the code you want to send within the function then send it using the function 'add_hook()' to send it to the hook point. This function accepts 3 variables:

      -  The first variable (mandatory): this carries the hook point name and sends it to the function.
      -  The second variable (mandatory): the name of the function that will be sent to the hook point.
      -  The third variable (optional): the hook order (execution priority).

{* php buffer start *} function function_name(&$vars){
// code
{* php buffer end *}

Please note: the parameter '$vars' is the sent item from the hook point center as a 'Reference', it isn't mandatory and it depends on whether the hook focal point sends parameters or not as explained earlier.

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article