Install the App?

App Folders

Folders of the Starter App

Root folder of the Starter App

The Starter App source code is located into the INSTALL_DIR/applications/default folder

Folder tree of the Starter App

The typical folder tree of the Starter App is shown below:

  •  INSTALL_DIR/applications/
    •  default/
      •  app/Here are installed the private PHP scripts.
        •  controller/
          •  myappctrl.php
        •  lang/
          •  locale.php
        •  model/
          •  mydao.php
        •  validator/
          •  myvalidator.php
        •  view/
          •  myappview.php
        •  config.php
        •  menu.php
        •  myclass.php
      •  documents/Here are stored the private photos and documents.
        •  mydocument.pdf
        •  mypicture.jpg
      •  public/Here are installed the public resources.
        •  css/
          •  mystyles.css
        •  images/
          •  mylogo.jpg
        •  js/
          •  mylibrary.js

Starter Application PHP Class Namespace

The PHP classes of the Starter App must be declared with a namespace prefixed by app.

Here are some examples of namespace according to the folder where the PHP script is located:

myappctrl.php script (controller)

<?php
namespace app\controller;
class MyAppCtrl extends \AppController {

    static protected function action_get() {
        /* Code of the controller's action */
    }

}

mydao.php script (model)

<?php
namespace app\model;
class MyDao extends \DAO {

    protected function initDaoProperties() {
        /* Code of the DAO */
    }

}

myvalidator.php script (validator)

<?php
namespace app\validator;
class MyValidator extends \Validator
{
    protected function initVariables() {
        return array('my_first_value', 'my_second_value');
    }

    protected function check_my_first_value($value) {        
        /* Code for validating data */
    }
    protected function check_my_second_value($value) {
        /* Code for validating data */
    }
    
}

myclass.php script

<?php
namespace app;
class MyClass
{
    /* Code of the class */
}

App documents

The folder INSTALL_DIR/applications/default/documents is used to store documents and photos.

This folder is private and its content can't be accessed directly in HTTP.
It means that if you type for example the URL https://mydomain/myapp/applications/default/documents/ within your browser's address bar, you will have in response a page with error HTTP 403.

To store and read documents or photos within the documents/, you should do it from a PHP script (for example from an application controller).
The PHP constant CFG_DOCUMENTS_DIR gives you the absolute path of the documents/ folder.

App public resources

The folder INSTALL_DIR/applications/default/public contains the web resources intended for displaying the application (CSS stylesheets, logos, illustrative photos etc.) and for its interaction with users (JavaScript scripts).

its content is generally organized into subfolders corresponding to each type of resource. For example public/css/, public/images/ and public/js/.

To get access in PHP to the INSTALL_DIR/applications/default/public folder, you can use the PHP constant ZNETDK_APP_ROOT followed by the /public folder name.

EXAMPLE

echo ZNETDK_APP_ROOT . '/public/images/mylogo.png';

Finally, to load in your application the custom CSS stylesheets and JS scripts you installed in the public/css/ and public/js/ folders, you need to configure it explicitly within the config.php of your application (see App extra CSS and JS libraries).

Search

Sort order