Introduction Goal Install
Introduction
Goal
How to edit, configure and deploy website on your dedicated server or on cloud.
Install
Installing and configuring packages or modules will take somewhere between 5-15 minutes.
Packages
Apache with Database
1. Download the package here
2. Download Xampp and click the downloaded file to Install
In the installing process you only need the following components selected and only click next:
3. Open Xampp and access php.ini (for WAMP php.ini check bottom of document)
3.1. On the apache module click on Config, then php(php.ini) under "Dynamic Extensions" add the followng:
This snippet is for example purposes. Changes may have to be made.
Copy
      extension=php_openssl.dll
      extension=php_mbstring.dll
      extension=php_mysqli.dll
3.2. In php.ini, under "Paths and Directories" uncomment extension_dir = "ext" (in some cases it already is uncommented)
4. Open the xampp folder you installed, go to htdocs/ and paste your package files into a new folder (Ex: "mywebsite")
5. To add your website visit your website on portalfin.com (the default website is generated initially)
6. Export the website you created by clicking "Download website data for installed package" then add the files to "www/website" in the package file.
Skip the Ubuntu steps bellow
Apache Ubuntu configuration
1. Download the package here
2. In php.ini, under "Dynamic Extensions" add the following: (along with the other extensions)
      extension=php_openssl.so
      extension=php_mbstring.so
      extension=php_mysqli.so
3. Restart Apache server
4. Unzip content to a new folder (Ex: "mywebsite")
5. Visit your website on portalfin.com
6. Export the website you created by clicking "Download website data for installed package" then add the files to "www/website" in the package file.
7. Access your domain.com in browser
Database Configuration
1. In XAMPP click start on Apache module and MySQL module
2. In browser access mywebsite.com/phpmyadmin (if its not hosted on a server, access localhost/phpmyadmin )
3. Create new database (click on new above information schema) and name it however you want Ex: "mydatabase" and click “Create”
4. In your unzipped folder ("mywebsite" folder) go to \www\config\ edit your_config with your specific informations (mywebsite.com is just an example, you may use your domain or localhost depending on where you installed your files)
This snippet is for example purposes. Changes may have to be made.
Copy
{
"DOC_ROOT":"/var/www/<...>/mywebsite/www",
"BASE_REF":"mywebsite.com",
"APP_NAME":"My App",
"MYSQL_HOSTNAME":"mysqlhostname",
"MYSQL_PORT":"3306" ,
"MYSQL_USER":"root",
"MYSQL_PASS":"",
"MYSQL_DATABASE":"mydatabase",
"BASENAME":"mywebsite.com"
}
5. In your browser access http://mywebsite.com/mywebsite/www/initial_db_install.php to initialise and add the data to your database.
6. If you need to update the database with your products/restaurant, run in browser http://mywebsite.com/mywebsite/www/update_database.php
7. Access in browser http:/mywebsite.com/mywebsite/www/ ("mywebsite" is the name of you website folder)
Apache without Database
1. Download the package here
2. Install Xampp and open it (for WAMP php.ini check bottom of document)
3. On the apache module click config and open php(php.ini).
4. In php.ini, under "Dynamic Extensions" add the followng: (along with the other extensions)
This snippet is for example purposes. Changes may have to be made.
Copy
      extension=php_openssl.dll
      extension=php_mbstring.dll
5. Open the folder where you installed xampp, go to htdocs/ and paste your package files into a new folder (Ex: "mywebsite")
6. In "mywebsite" folder go to \www\config\ edit your_config and add the following (if not existent) and save the file
This snippet is for example purposes. Changes may have to be made.
Copy
{
"DOC_ROOT":"/var/www/<...>/mywebsite/www",
"BASE_REF":"mywebsite.com",
"APP_NAME":"My App",
"BASENAME":"mywebsite.com"
}
7. In XAMPP click Start on the apache module
8. Access your domain.com in browser
9. To add your website visit your website on portalfin.com (the default website is generated initially)
10. Export the website you created by clicking "Download website data for installed package" then add the files to "www/website" in the package file.
Apache Ubuntu configuration
1. Download the package here
2. In php.ini, under "Dynamic Extensions" add the following: (along with the other extensions)
      extension=php_openssl.so
      extension=php_mbstring.so
3. Restart Apache server
4. Unzip content to a new folder (Ex: "mywebsite")
5. In "mywebsite" folder go to \www\config\ edit your_config and add the following (if not existent)
This snippet is for example purposes. Changes may have to be made.
Copy
{
"DOC_ROOT":"/var/www/<...>/mywebsite/www",
"BASE_REF":"domain.com",
"APP_NAME":"My App",
"BASENAME":"domain.com"
}
6. Download your exported website and unpack in www/website folder
7. Access your domain.com in browser
Edit, configure and deploy Website in Node Environment with Database
1. Download the package here in a folder like C:\mywebsite
2. Go to the folder where package is downloaded C:\mywebsite
3. Unzip the downloaded file : C:\mywebsite\unzipWebsite
4. Download and install Node.js
5. Open the terminal (type cmd in windows search)
6. Click on Command Prompt (App) that is on the top and then type
      cd C:\mywebsite\unzipWebsite
7. Type: npm install
8. Download php for windows from link in folder C:\mywebsite
9. Click on downloaded php for window v7.4 (remember the path)
10. In the php folder you installed, rename php.ini-development to php.ini
11. In php.ini, under "Dynamic Extensions" add the followng:
This snippet is for example purposes. Changes may have to be made.
Copy
      extension=php_openssl.dll
      extension=php_mbstring.dll
      extension=php_mysqli.dll
12. In php.ini, under "Paths and Directories" uncomment extension_dir = "ext" (delete “;” to uncomment , in some cases it already is uncommented)
13. Download Mysql installer community (first one)
14. Open Mysql installer and add MySQL Server and MySQL Workbench (look for the latest version for each)
15. Configure the MySQL Server with your settings
16. Open MySQL Workbench and access the server you created
17. In the top menu, Create a new schema in the connected server
18. Name your database, click apply then finish.
19. In the folder you cloned the repository \www\config\ edit your_config.json:
This snippet is for example purposes. Changes may have to be made.
Copy
{
"DOC_ROOT":"path_to_your_clone/www/",
"BASE_REF":"mywebsite.com",
"MYSQL_HOSTNAME":"127.0.0.1",
"MYSQL_PORT":"your server port",
"MYSQL_USER":"root",
"MYSQL_PASS":"password you set for your server",
"MYSQL_DATABASE":"name of your database",
"APP_NAME": "My App"
}
20. In the folder you cloned the repository \nodejsconfig\ edit config.json (you will need the path to where you installed php)
      Example:
      "php_cgi_folder": "E:/php",
      "php_cgi_php_ini":"E:/php/php.ini"
21. Open the terminal in the local folder of the clone and run "node server"
22. Open your browser on mywebsite.com:9090 (the port may be different to where the server is listening, you can see the port in the terminal after running the "node server" command)
23. In the browser, to your domain, add /initial_db_install to initialise and add the data in the database
24. If you need to update the database with your products/restaurant, run in browser to your domain http://mywebsite.com/update_database.php
25. To add your website visit your website on portalfin.com (the default website is generated initially)
26. Export the website you created by clicking "Download website data for installed package" then add the files to "www/website" in the package file.
Node without Database
Node.js (v7.+) version of the pack is easier to install and controll. Follow the next steps to setup your website:
1. Download the package here
2. Install Node.js
3. Open the terminal (search cmd in windows search)
4. Install node dependencides in the local folder where you cloned the repository (npm install)
      In the cmd go to the folder you unzipped: cd path/to/your/folder
      Type: npm install
5. Install php for windows ( https://windows.php.net/download/ ) v7.4 (remember the path)
6. In the php folder you installed, rename php.ini-development to php.ini
7. In php.ini, under "Dynamic Extensions" add the followng:
This snippet is for example purposes. Changes may have to be made.
Copy
      extension=php_openssl.dll
      extension=php_mbstring.dll
8. In php.ini, under "Paths and Directories" uncomment extension_dir = "ext" (in some cases it already is uncommented)
9. In the folder you cloned the repository \www\config\ edit your_config.json:
This snippet is for example purposes. Changes may have to be made.
Copy
{
"DOC_ROOT":"path_to_your_clone/www/",
"BASE_REF":"mydomain.com",
"APP_NAME": "My App"
}
10. In the folder you cloned the repository \nodejsconfig\ edit config.json (you will need the path to where you installed php)
      Example:
      "php_cgi_folder": "E:/php",
      "php_cgi_php_ini":"E:/php/php.ini"
11. Open the terminal in the local folder of the clone and run "node server"
12. Open your browser on mywebsite.com:9090 (the port may be different to where the server is listening, you can see the port in the terminal after running the "node server" command)
13. To add your website visit your website on portalfin.com (the default website is generated initially)
14. Export the website you created by clicking "Download website data for installed package" then add the files to "www/website" in the package file.
Modules
Download modules from your website to make insight changes like improving or adding functions that you need to behave differently. Some modules have dependencies some are standalone, but its all up to your website to see what you need.
Cart
Dependencies: LoginDB; can use SendMail
** if you dont need this SendMail package or have other requirements, you can use any other php package that can be loaded by autoloader, and can be accessed by $package["SendMail"]; your package needs to use the parameters shown in SendMail code example (subject, email, email_to, sent_from, message); and have "init" and "send" methods available;
Supports PayPal and Stripe payments;
This snippet is for example purposes. Changes may have to be made.
Copy
Package comes with config file that should contain your vendor authentication credentials:
[{
"system":"paypal",
"mode":"sandbox/live",
"username":"yourname-facilitator_api1.domain.ro",
"password":"2****V****H****4",
"signature":"A****B****D****S****g****p****1****J****j****P****G****M",
"currency_code":""
},
{
"system":"stripe",
"mode":"sandbox/live",
"username":"",
"password":"sk_****_Y****8****6****R****owr5",
"signature":"pk_****_T****S****A****I****gKDx"
}]
Mail Sender
Uses sendmail package (there is a sendmail package for windows inside pack)
How to use in your php code:
This snippet is for example purposes. Changes may have to be made.
Copy
if (isset($package["SendMail"])) {
$mdata = array();
$mdata["subject"] = APP_NAME ." - First Mail";
$mdata["email"] = ;
$mdata["email_to"] = ;
$mdata["sent_from"] = "The ". APP_NAME . " mailing system";
$mdata["message"] = "Visit the link: Take a look " . "If you encounter problems accessing the hyperlink, please try to copy and paste the following link into the browser address bar ". urldecode(HTTP_HOST);
$package["SendMail"]->init();
$mresp = $package["SendMail"]->send($mdata);
return "Account verification message was sent again to your email.";
}
Login
Package used to log in end-user, and keep track of unlogged user
Create your module
Modules defined in Packages folder are automatically loaded at runtime from config/clientConf.php, if they meet certain specifications:
      - the string used as main package class name should be the same as the package folder name and the php file where it is defined(case sensitive);
      - each package has access to database connection and website data defined in /website/website_data.json: $package = load_packs($db, $wdata);
      - the autoloader will load classes defined in their own folder with specific names:
            ex: MyModule class will be loaded on runtime if there is a MyModule.php is inside packages/MyModule folders, and is accessible;
This snippet is for example purposes. Changes may have to be made.
Copy
** inside MyModule.php
/* ----- define namespace ----*/
namespace packages\MyModule;
/* ----- use uther packages like SendMail ----*/
use \packages\SendMail;
class MyModule {
private $conn;
private $wid;
public function __construct($mysqlObject, $wdata) {
$this->conn = $mysqlObject->getconninfo(); // you can use the existing created connection to database
$this->wid = $wdata["wId_idd"]; // you have access to the internal website_id
}
public function after_load() { // gets called after module classes initialization; it can be executed if you need code executed after initialization; is not mandatory;
if(isset($_GET["some_parameter"])) {
$protocol = (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] !== "off" || $_SERVER["SERVER_PORT"] == 443) ? "https://" : "http://";
header("Location: " . ($protocol . $_SERVER["HTTP_HOST"] . "/"));
die();
};
}
public static function getInstance() { // use it like MyModule::getInstance(); or gain access to class by calling $package["MyModule"]; $package is global; inside functions do: global $package;
if (self::$instance == null) {
self::$instance = new Singleton();
}
return self::$instance;
}
/* ----------- define your other methods -----/*
}
If you only want to run a js file into your website:
     1. you can add your js file into js/ folder
     2. edit /helpers/templates/header_webgen.tpl and add


If you want to exchange data between the web site and server:

     - create a new folder, packages/MyRoute; have a public folder with js and/or css files

     - If you want access to existing database connection, we recommend using step 1 (autoloading modules);

     - edit /helpers/templates/header_webgen.tpl and add
This snippet is for example purposes. Changes may have to be made.
This snippet is for example purposes. Changes may have to be made.
Copy

- into packages/MyRoute folder have a php that will respond to your client request;

ex: MyRouteServer.php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
define("DEF_BASE", "../..");
define("CLIENT_SIDE", 2);
define("PREV_SIDE", 1);
require_once(DEF_BASE . "/config/clientConf.php");
if (isset($_GET["the_first_request"])) {
//
echo "OK";
}
?>

- the client will send requests to yourdomain.com/JQpackdb/packages/MyRoute/MyRouteServer.php
Add your JS to your website
1. write a function into your js that is going to be called when you upload it
Example:
function myWidget(elem, options) {
     elem.append("23123");
     elem.css("background-color","blue");
     elem.css("color","white");
}
**elem - the row or column in which the widget is going to be placed
**options - options of the website that you may need and use for your widget
2. add your widget.js to your server so it can be accessed through an URL
     Example: http://mywebsite.com/plugins/widget2/widget2.js
     OR
2.1 add your widget.js along with a new file metadata.json in a .zip file
      - metadata.json should have the data like this: (be sure that the "start" and js function have the exact same name)
This snippet is for example purposes. Changes may have to be made.
Copy
{"name":"name your widget", "initjs":"widget.js", "start":"myWidget"}
3. On your portalfin website go to "Content" in the menu above
4. Hover over "Your Widgets" in the dialog
5. Click on "Add New Widget"
**If you uploaded your js file on a remote server follow these steps:
          6. Choose a name for your widget
          7. In "Your javascript file location" add the link to your widget from step 2
          8. In the last input add the name of the function in your js (on step 1, the function name is "myWidget")
**If you made a .zip file follow these steps:
          6. Click "Upload" and select the .zip file from your computer
9. Click save and your widget will be shown under "Your Widgets" In the Content dialog (from step 3)