Fabriq Framework Docs

This page displays the APIs for using third party libraries with Fabriq. Libraries should be contained inside of the /libs directory.

The /libs directory is broken up into three sub-directories:

  • /libs/css
  • /libs/javascript
  • /libs/php

Libraries should be stored inside of the appropriate sub-directories under /libs. It is also good practice to give each library it's own directory (ex: jQuery would be stored in /libs/javascript/jquery and the jQuery UI CSS files would be stored under /libs/css/jquery-ui).

css_lib($file_name, $libdir = '', $ext = '.css', $media = 'screen')

Parameters

  • file_name - the name of the CSS file to be included (without the .css extension)
  • libdir (optional) default value: '' (empty string) - the directory under /libs/css where the CSS file is stored
  • ext (optional) default value: .css - the file extension of the CSS file to include
  • media (optional) default value: screen - the type of view that the CSS file should be applied to

Description

This function is used to include a third party CSS library for use with your Fabriq web application(s)/website(s). The given file name should not include the extension. It is good practice to store your libraries in subdirectories under /libs/css to keep them organized.

Example(s)

// example providing only the file name for a file stored under /libs/css
// NOTE: this is not good practice and libraries should be stored in a sub-directory under /libs/css
FabriqLibs::css_lib('jquery-ui');
 
// example providing the filename and directory under /libs/css
FabriqLibs::css_lib('jquery-ui', 'jquery-ui');
 
// example providing the filename, directory under /libs/css, and file extension
FabriqLibs::css_lib('dyanmic', 'dynamic-css', '.php?site=mysite');
 
// example providing all parameters
FabriqLibs::css_lib('dyanmic', 'dynamic-css', '.php?site=mysite', 'print');

Added in version: 1.1

js_lib($file_name, $libdir = '', $ext = '.js')

Parameters

  • file_name - the name of the JavaScript library file to include without the file extension
  • libdir (optional) default value: '' (empty string) - the directory under /libs/javascript where the JavaScript library file is stored
  • ext (optional) default value: '.js' - the file extension of the JavaScript library being included

Description

This function allows you to include third party JavaScript libraries for use with your Fabriq web application(s)/website(s). It is good practice to store your JavaScript libraries under their own sub-directory in /libs/javascript (ex: jQuery would be stored in /libs/javascript/jquery and tinyMCE would be stored in /libs/javascript/tinymce).

Example(s)

// example giving only the file name
// NOTE: it is best practice to store JavaScript libraries under their own sub-directories in /libs/javascript
FabriqLibs::js_lib('jquery');
 
// example giving the filename and directory
FabriqLibs::js_lib('jquery', 'jquery');
 
// example giving all of the parameters
FabriqLibs::js_lib('dynamicjs', 'dynamicjs', '.php?site=mysite');

Added in version: 1.1

phpqueue()

Description

This function returns the PHP libraries that are currently in the PHP library queue.

Example(s)

$phpqueue = FabriqLibs::phpqueue();

Added in version: 1.1

Return type: array

php_lib($file_name, $libdir = '')

Parameters

  • file_name - the name of the PHP library to include without the file extension
  • libdir (optional) default value: '' (empty string) - the sub-directory under /libs/php where the PHP library is stored

Description

This function includes third party PHP libraries for use in your Fabriq web application(s)/website(s). It is good practice to store your PHP libraries in their own sub-directories under /libs/php (ex: GeSHI would be stored under /libs/php/geshi).

Example(s)

// example providing only the PHP library file name
// NOTE: it is good practice to store PHP libraries under their own sub-directories in /libs/php
FabriqLibs::php_lib('geshi');
 
// example providing all parameters
FabriqLibs::php_lib('geshi', 'geshi');

Added in version: 1.1

php_lib_count()

Description

This function returns the number of PHP libraries current stored in the PHP library queue.

Example(s)

echo "There are " . FabriqLibs::php_lib_count() . " PHP libraries in the PHP library queue.";

Added in version: 1.1

Return type: integer