This translation is older than the original page and might be outdated. See what has changed.

This is an old revision of the document!


Using Plugins in your homepage

Plugins are small PHP scripts doing defined works (e.g. show the events of the next 2 days, show actual birthdays…). Unlike modules, plugins must be called not necessarily as a separate page, but can be integrated into any html or php page. You can download the plugins in the body_top.php or body_bottom.php installed by Admidio so that certain information is displayed on all pages Admidio.

Download the plugin from our plugin area and unpack the zip file. Copy the folder with the files in the folder adm_plugins in your Admidio folder. If the folder adm_plugins does not exist, it must first be created yet. This should be on the same level as adm_my_files.

Check the installation instructions on the plugin page in the first step. Some Plugins supply their own installation script and integrate themselves thereby independently into our menu. In this case no further steps are necessary.

Other plugins can be integrated with a small HTML script on the overview page. For this purpose the corresponding script must be included in the template file adm_themes/simple/templates/overview.tpl.

Several DIV blocks are stored there and you have to add your new DIV block behind an existing DIV block. The DIV-blocks look like this:

<div class="col-sm-6 col-lg-4 col-xl-3">
    <div class="card admidio-roles" id="role_details_panel_'.$rolId.'">
        <div class="card-body" id="admRoleDetails'.$rolId.'">
            {load_admidio_plugin plugin="plugin-name" file="plugin-file-name"}
        </div>
    </div>
</div>

In this DIV block replace plugin-name with the name of the folder of your plugin and replace plugin-file-name with the file name containing the html-script.

If you want to include for example the Plugin adm_plugins/calendar/calendar.php, then the code block looks afterwards like this

<div class="col-sm-6 col-lg-4 col-xl-3">
    <div class="card admidio-roles" id="role_details_panel_'.$rolId.'">
        <div class="card-body" id="admRoleDetails'.$rolId.'">
            {load_admidio_plugin plugin="calendar" file="calendar.php"}
        </div>
    </div>
</div>

Then you can reload the overview page and your plugin should be visible.

The installation of a plugin within an Admidio page is really simple. Go to the file adm_themes/modern/my_body_bottom.php and add at the corresponding place the following code:

<?php include(ADMIDIO_PATH . FOLDER_PLUGINS . '/birthday/birthday.php'); ?>

If you are within a PHP part of your page than you must only add:

include(ADMIDIO_PATH . FOLDER_PLUGINS . '/birthday/birthday.php');

Now reload the Admidio page and the plugin should be shown.
Since version 3.0 all css files of the plugins will be loaded automatically and must not be added separatly.

You can also use the plugins outside of the Admidio pages and integrate them into your own HTML / PHP pages. However, a few additional steps are necessary.

If you want to integrate the plugin into a pure html page, you should first rename the file extension of the page from html to php. Now you can integrate the plugin with help from PHP into your formerly pure HTML page. Now add the plugins (as an example here the plugin login_form) into your Html code at the point where the output of the plugin should be displayed by one of the following methods:

1. First the file common.php must be added at the very beginning of your PHP file via the server path:

<?php
  include_once($_SERVER['DOCUMENT_ROOT']. '/Path-to-Admidio-folder /adm_program/system/common.php');
?>

The Path-to-Admidio-folder must contain the folder structure, which you have to go from the file in which you want to install the plugin, to the Admidio folder.

Example 1

FTP file path in which the plugin should be installed:
homepage/index.php

FTP file path to Admidio folder
homepage/admidio/index.php

Include-Befehl:
include_once($_SERVER['DOCUMENT_ROOT']. '/admidio/adm_program/system/common.php');

Example 2

FTP file path in which the plugin should be installed:
homepage/index.php

FTP file path to Admidio folder
admidio/index.php

Include-Befehl:
include_once($_SERVER['DOCUMENT_ROOT']. '/../admidio/adm_program/system/common.php');

2. Afterwards the plugins are installed in the desired places:

<?php
  include($_SERVER['DOCUMENT_ROOT']. '/Path-to-Admidio-folder /adm_plugins/login_form/login_form.php');
?>

3. If the previous variants have not led to success, you can also integrate the plugins directly via a URL. However, in this variant, the common.php for each plugin is repeatedly processed, which is not the best for the performance of the webserver.

<?php
  include('http://www.example.org/Path-to-Admidio-folder /adm_plugins/login_form/login_form.php');
?>

4. If the plugin has a CSS file, it must also integrate into the website. This must be done both within Admidio's my_header.php of the selected theme folder as well as in the header of your own pages, if you want to display the plugin there as well.

<link rel="stylesheet" type="text/css" href="http://www.example.org/Path-to-Admidio-folder /adm_plugins/login_form/login_form.css" />

You can configure most plugins via config.php file that is located in the same folder as the plugin. Here are some variables with default values available. This you can customize according to your needs. Does the plugin have a CSS file, it can be customized using the the layout of the plugin. Updating a plugin, these 2 files should not been necessarily overwritten. In case new settings or CSS settings are added by the update, then the new variable or CSS settings should be copied from the downloaded files into the existing files (config.php and pluginname.css) of the plugin and the desired values can be customized .

An example of integration of multiple plugins in a sidebar you can see on this screenshot in the highlighted area: Install plugins

If there is an update, because of a bug fix, a new feature, or due to an incompatibility with current Admidio version, you can replace the plugin folder. Download the latest version from Plugin Area and replace the existing plugin folder with the new folder of the downloaded zip-file. Special features of the update are mentioned in the readme.txt in the plugin folder.

  • en/plugins/installation.1609743547.txt.gz
  • Last modified: 2021/01/04 07:59
  • by fasse