Chapter 3. Creating and installing new application / site

  1. Open and login into your TCC

  2. From the main menu choose Site → Manage sites → Add new site

  3. You have to enter site details as follows:

    • site name - name for your site. Example: My first tangra application
    • site path - path to directory where site will be installed. This directory you have to create manually before saving the form. Web server must have permissions to write in it. Example: /var/www/sites/my_test
    • description - enter some description
    • class prefix - UPPER case prefix that will be used for site specific classes. Example: TFT. Class names will look like TFT_Web_Page. Keep it short - 2-3 letters. In the example TFT stands for Tangra Framework Test
    • file prefix - lowercase filenames prefix. Will be used to prepend site specific files. It is good idea to match the class prefix but lowercase. Example: tft. Filenames will look like tft_web_page.class.php

    Figure 3.1. TCC - Creating new site

    TCC - Creating new site

  4. Click Save button. When saved a record for this site will be created and you will be redirected to “Manage site” page for this site.

  5. Create new VirtualHost for your new site in Apache configuration.

    For creating virtual host please consult your Apache documentation.

    Example 3.1. Example for VirtualHost record:

                        <VirtualHost *:80>
                        ServerAdmin user@somedomain.tld
                        DocumentRoot /var/www/sites/tft/htdocs
                        ServerName tft.myhost
                        ErrorDocument 404 /not_found.php
                        </VirtualHost>
                    

  6. On the row “Install template” click Select link to the right to select site template. Site template is a predefined set of modules. Select “Jabba” template. Selecting template will return you to “Manage site” page.

    Figure 3.2. TCC - Managing site

    TCC - Managing site

  7. On “Manage site” page, click Install to install the site using template “Jabba” - a list of all modules (sorted in order of installation) and their parameters will be shown:

    Figure 3.3. TCC - Installing site template - setting module installation parameters

    TCC - Installing site template - setting module installation parameters

  8. Setting module installation parameters

    There are 3 types of module installation parameters:

    • Required - such parameters are mandatory and installation cannot proceed if some of them is missing. Required parameters are shown in blinking red.
    • Hard optional - in the scope of module installer such parameters are optional but if leaved empty module may not be operational. Hard optional parameters are shown in orange color.
    • Soft optional - these parameters have meaningful default values that are suitable for most of the cases so they can be left empty. Shown in black color.

    When parameter has a value it is shown in green color.

    You will have to set at least following parameters:

    • tangra-lib-path - path to tangra_lib. You may use path to your copy of tangra_lib in tangra2
    • smarty - path to smarty lib. Example: /var/www/inc/smarty/
    • adodb - path to ADOdb lib. Example: /var/www/inc/adodb/

    You may set these paths to point to libs inside tcc/ext_inc directory but generally that is not good idea. Best solution is to download these libs (» Smarty, » ADOdb) and extract them in a directory that will be common for all of your TF applications. Example: /var/www/inc.

    • admin-dsn - DSN with privileged DB access. You will need to create db/schema for your new site. Name it tft. admin-dsn have to be able to create tables in your new db. Example: mysqlt://root:rootpwd@localhost/tft?persist
    • db-dsn - DSN with normal privileges (INSERT, UPDATE, SELECT, DELETE). This DSN will be used by the site. Example: mysqlt://tft:tftpass@localhost/tft?new
    • session-dsn - DSN that will be used for sessions. Usually same as db-dsn

    Note: Please note that it is NOT good idea db-dsn and session-dsn to create persistent connections (i.e. with ?persistent instead of ?new). Using persistent connections along with transactions (which are widely used in TF) may lead to DB deadlocks.

  9. After filling above parameters click on "Install" link. You will see:

    Figure 3.4. TCC - Installing site template - Ready to install

    TCC - Installing site template - Ready to install

  10. Actual installation

    Click on Start installation button and installation will start.

    On error above the table (grid) with modules error message will appear in red color.

    On success you will see "Installation complete" above the table (grid) and next to all modules, status will be green "Installed".

  11. Check out your brand new tangra powered site

    Open a browser and point it to hostname that you configured when created the VirtualHost (in our example above - tft.myhost).

    Note: If you don't use fully qualified domain name like in the example above (i.e. tft.myhost) you may need to add new record in your /etc/hosts file (Linux) or C:\WINDOWS\system32\drivers\etc\hosts (Windows) in order to be able to open the site in your browser.

    You should see:

    Figure 3.5. Newly installed site - welcome screen

    Newly installed site - welcome screen