This feature is available since Softaculous 4.5.0
This Page will help you in adding custom themes option to your users. (For e.g. If you want to provide certain themes to your users while installing WordPress or any other script)
A sample theme example is available here : File:Theme.zip
Download the above file and unzip it at the following path.
You can find the SCRIPT_SOFTNAME from iscripts.php located at /PATH/TO/softaculous/enduser/iscripts.php
For e.g. in the above zip file we have explained the theme integration for WordPress and its softname is 'wp' so the path where you have to unzip the above file would be :
In the above zip file there are three files available.
3. sample_theme.zip (in this example : sydney.zip)
To add the themes in Softaculous without making custom package please follow the below steps :
This file is responsible for displaying theme(s) option for installing to enduser. In sample file following code is available :
<softinstall xmlns="http://www.softaculous.com"> <settings> <group> <heading>Choose Theme</heading> <input type="select"> <select name="install_theme"> <option value="sydney">Sydney</option> <option value="">None</option> </select> <head>Choose a Theme to install</head> </input> </group> </settings> </softinstall>
While making themes the following three lines will be same for all the theme that you are going to make and same for the closing tags of the following tag.
<softinstall xmlns="http://www.softaculous.com"> <settings> <group> <heading>Choose Theme</heading> YOUR THEME RELATED CODE </group> </settings> </softinstall>
Only the following part will change according to your plugin information :
<input type="select"> <select name="install_theme"> <option value="sydney">Sydney</option> <option value="">None</option> </select> <head>Choose a Theme to install</head> </input>
In <input> tag please specify the name of your theme and the zip name should be the same.
<head> tag is responsible for displaying the name of the theme on installation wizard page of the script.
<exp> tag is responsible for displaying the small description/explanation of the theme.
If you want to add more than one themes just add it to the select tag
This is the main file which is responsible for parsing the mod_install.xml and installing theme.
All the function have the prefix as __SCRIPT_SOFTNAME. In this example __wp is for integrating WordPress theme. It will change according to your requirements.
Following function are responsible for parsing the mod_install.xml and installing themes.
This function is responsible for parsing the mod_install.xml file and displaying an option to choose themes to users on installation wizard.
In this function you dont have to change anything as all is dependent on mod_install.xml
If there are some requirement settings or per-requisite for your theme, than it should be checked/processes in this function. This function will be called before the installation of the scripts is started.
This function is responsible for installation process of your theme after the installation of the script.
In above both function __pre_mod_install() and __post_mod_install() you can use the following functions to fulfill your requirements :
sunzip(source, destination) - It will unzip the source.zip at the destination.
smkdir(target_dir, permission) - It will make the target directory and give the permission accordingly.
schmod(target_dir, permission) - It will change the target directory permission.
sdb_query(query, dbhost, dbuser, dbpass, database) - It will execute the query.