%name:Template Manager% %version:v13.0.4.1% %wikipage:Template_Manager% %author:Bill Herndon% %description:

Supports the loading, unloading, saving, and erasing of template data from the TNG database. Local template configuration files having the same format as in previous TNG releases are used to store template data when not resident in the TNG database. The mod can be used to preserve templates across releases or for loading entirely new templates.

© 2018 - 2021, ArcLindon LLC, Some Rights Reserved**

** Users are granted a non-exclusive, non-transferable license to install and run this software for personal, non-commercial purposes. All other rights are reserved.

% %target:admin_templateconfig.php% %location:% if( $link ) { %end:% %insert:before% // BEGIN: Template Manager include("adminlog.php"); include($cms['tngpath'] . "$extspath/tmpltm_lib_templates.php" ); // END: Template Manager // BEGIN: Template Manager $umsg = null; $lmsg = null; $post = isset($_POST['action']); if ($post) { // we have a post - fetch the template $tmplt = $_POST['template']; if ($_POST['action'] == 'unload') { // unload the template $tfields = tmpltm_readTemplateFields($tmplt); $tname = (is_numeric($tmplt)) ? "template$tmplt" : $tmplt; $result = tmpltm_writeTemplateData($tfields, $tname); if ($result) { if (tmpltm_wipeTemplateFields($tmplt)) { $umsg = "Template '$tmplt' saved to the TNG installation and removed from the database."; } else { $umsg = "Saved template '$tmplt' but unable to remove from the database."; } } else { $umsg = "Attempt to unload template '$tname' failed."; } } else if ($_POST['action'] == 'wipe') { // remove from the database if (tmpltm_wipeTemplateFields($tmplt)) { $umsg = "Template '$tmplt' removed from the database."; } else { $umsg = "Unable to remove '$templt' from the database."; } } else if ($_POST['action'] == 'load') { // load a template $tdata = tmpltm_readTemplateData($tmplt); if ($tdata) { tmpltm_writeTemplateFields($tdata); $lmsg = "Template '$tmplt' loaded into the database"; } else { $lmsg = "Attempt to load template '$tmplt' failed."; } } else if ($_POST['action'] == 'persist') { // save a template $tfields = tmpltm_readTemplateFields($tmplt); $tname = (is_numeric($tmplt)) ? "template$tmplt" : $tmplt; $result = tmpltm_writeTemplateData($tfields, $tname); if ($result > 0) { $umsg = "Template '$tmplt' saved to the TNG installation."; } else { $umsg = "Attempt to save template '$tmplt' failed."; } } else if ($_POST['action'] == 'saveall') { // save all $result = tmpltm_saveAll(); $umsg = "Saved $result templates to the TNG installation."; } else if ($_POST['action'] == 'loadall') { // load all $result = tmpltm_loadAll(); $lmsg = "Loaded $result templates into the TNG database."; } else { // unrecognized action $lmsg = "I'm sorry Dave, I'm afraid I can't do that."; } } // END: Template Manager %end:% %location:% %end:% %insert:before%
     |  
\n"; echo " "; echo $umsg; echo "\n"; } ?>
     |  
\n"; echo " "; echo $lmsg; echo "\n"; } ?>
%end:% %target:languages/English/templateconfig_help.php% %location:%

Using a Template
%end:% %insert:before%

Templates Installed
This section displays a pulldown menu of all the templates currently loaded into the TNG database. There are four supported operations:

Templates Available
This section displays a pulldown menu of all templates currently in the TNG installation that have valid template configuration files. There are two supported operations:

%end:% %copyfile2:template_mgr/lib/tmpltm_lib_templates.php:$extspath/tmpltm_lib_templates.php% %copyfile2:template_mgr/etc/tmpltm_settings.php:$extspath/tmpltm_settings.php% %target:$extspath/tmpltm_settings.php% %fileoptional:% %parameter:$tmpltm_dir_config:% %desc:A folder under a template's root where template configuration files are stored. This folder must exist, since the Template Manager will not create it during load, unload, or save operations. If this parameter is empty, template configuration files are stored in a template's root folder.
Default: ()% %parameter:$tmpltm_dir_templates:templates% %desc:Current templates directory under the TNG installation root.
Default: (templates)% %parameter:$tmpltm_cfg_filename:_templateconfig.php% %desc:Name of local template configuration files.
Default: (_templateconfig.php)% %location:% * ** Do not delete this line ** %end:% %replace:% * ** Do not delete this line ** %end:%