Adding an Install-Uninstall-Update Template Script File

Joomla Views: 1473 Added Date: September 27, 2017 Adolph Like
Joomla News: Adding an Install-Uninstall-Update Template Script File

Today we want to present you good solve of problem with add scriptfile at time installing template, and how to consists it in using a php script file containing a class. Using prestart method which makes PreinstallInstallUpdateUninstallPostflight that is executed after install and update methods. The thing that's you have to do write an template script consists in declaring an class which name is templatename

TemplateNameInstallerScript with these 5 methods. Our Example is:

 script.php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
/**
 * Script file of templateName template.
 *
 * The name of this class is dependent on the template being installed.
 * The class name should have the template's name, directly followed by
 * the text InstallerScript (ex:. templateNameInstallerScript).
 *
 * This class will be called by Joomla!'s installer, if specified in your template's
 * manifest file, and is used for custom automation actions in its installation process.
 *
 * In order to use this automation script, you should reference it in your template's
 * manifest file as follows:
 * script.php
 *
 * @package     Joomla.Administrator
 * @subpackage  com_helloworld
 *
 * @copyright   Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
class templateNameInstallerScript
    /**
     * This method is called after a template is installed.
     *
     * @param  \stdClass $parent - Parent object calling this method.
     *
     * @return void
     */
    public function install($parent) 
 
    /**
     * This method is called after a template is uninstalled.
     *
     * @param  \stdClass $parent - Parent object calling this method.
     *
     * @return void
     */
    public function uninstall($parent) 
 
    /**
     * This method is called after a template is updated.
     *
     * @param  \stdClass $parent - Parent object calling object.
     *
     * @return void
     */
    public function update($parent) 

 
    /**
     * Runs just before any installation action is preformed on the template.
     * Verifications and pre-requisites should run in this function.
     *
     * @param  string    $type   - Type of PreFlight action. Possible values are:
     *                           - * install
     *                           - * update
     *                           - * discover_install
     * @param  \stdClass $parent - Parent object calling object.
     *
     * @return void
     */
    public function preflight($type, $parent) 
 
 
    /**
     * Runs right after any installation action is preformed on the template.
     *
     * @param  string    $type   - Type of PostFlight action. Possible values are:
     *                           - * install
     *                           - * update
     *                           - * discover_install
     * @param  \stdClass $parent - Parent object calling object.
     *
     * @return void
     */
    function postflight($type, $parent)

In this article the main idea it’s reconsideration of idea which you can read here…

This is user redirection to the TemlateName component when it is installed and will display messages when it is updated or uninstalled.



Reviews (0):

Rate this: 
Send