Prototype: (false|array) public function onDomusImportExample($engine, $params)

Synopsis: Creates an example file for the user

Sample plugin: plugins/domusimport/standard/standard.php

Since file imports have a very specific syntax, the user must follow them, otherwise he could get import errors.

To facilitate the work, an import plugin should create an example file, so the user knows the syntax he has to respect.

The example file creation is made in two different steps:

  1. Fist of all you have to create the URL that will trigger this event. Usually you want to display it in the option form.

    Its structure is something like this:


    Let's analyze every single part of it


    This part is in common with every import plugin, it's requested by Domus Organizer in order to let him know that we are dealing with examples of import plugins

    engine_import=<your engine's name>

    This is the programmatic name of your import plugin, for example standard

    custom[]=<custom value>

    In this array you can add all the params you will need later while processing the file.

    For example you would create an example file for restoring the customers and another one for properties.

  2. Actually create the example file inside the onDomusImportExample plugin event.

    Once again, since there could be several import plugin enabled, you have to check if the user truly chose your plugin:

    // The request engine is different from the plugin one? Let's ignore this event
    if($engine != $this->name)
        return false;

    After that, you have to create and return an indexed array with the following keys:


    Mime type for your file, for example a tab-separated file has text/tab-separated-values as content-type.

    You can find a list of the available mime-types in this page.


    The name of the file that will be downloaded


    The content of the example file