Gadgets - gtbu/Typesetter5.2 GitHub Wiki
Gadgets: are content elements of addons (like : Back2Top_Button ; Simple-Blog). They can be added to the layout via Layout Manager or to the content via File Include sections or direct in the template.php at the place where they should appear (though sometimes not because of unprecise programming of the authors).
Variable : $GP_GETALLGADGETS ; boolean : Normally used in a theme's settings.php file to define if all available Gadgets should be loaded by default (for testing which gadget-areas are available).
The Gadget - Name stands in the addon.ini of the plugin. Gadgets are also used in themes like bootstrap4. gpOutput::Get('Gadget','Gadget_Name');
- now Typesetter 5.2 : gpOutput::GetGadget('Gadget_Name');
1071 output.php public static function GetGadget($id)
If you want to add a gadget to a specific page, navigate to that page. At the top, under "Sections," you will find the area selection.
Click on "File include" button
of the selectable areas; This adds an area.
If You edit the area - via the section-list --> File include --> pen in the right corner or direct in the page - , a dropdown menu (with scroll down) will appear from which you can select the gadget, and then save and publish.
(You cannot copy the source code of the inserted gadget into a sidebar or footer—though inserting PHP into the page is blocked via rmPHP for security reasons.)
- Contact
- Search
- Admin Link
- Login Link
1248 output.php
public static function Area($name,$html)
Several code-examples are in the Bootstrap4-Theme !
In **settings.php** :
ob_start();
gpOutput::GetGadget('Search');
$area_content = ob_get_clean();
gpOutput::Area('Search-Gadget', $area_content);
- and in the template.php (in this case behind the menu : gpOutput::Get('TopTwoMenu'); )
gpOutput::GetArea('Search-Gadget', '');
1259 output.php
public static function GetArea($name, $text)
or :
if( gpOutput::GadgetExists('Simple_Blog') ){ gpOutput::GetArea('Simple-Blog-Gadget', ''); }
// as defined in settings.php }
-
Other examples are in the Bootstrap4-Theme
-
Evtl. it is necessary to put the php-call at a specific position of the code (like page-button in the footer)
-
or in the template.php
if (class_exists('gpOutput') && method_exists('gpOutput', 'GetGadget')) {
gpOutput::GetGadget('gadgetname');}
- Sometimes gpOutput::Flush(); can improve speed