PClib demo site

  • Basic usage of the grid
    Data for the grid are loaded using sql-query, layout is done with template "basicgrid.tpl". If you don't have template prepared yet, just call $grid = new grid(); and grid will be shown with default template.
    We are using shortcuts {grid.labels} and {grid.fields} in our template, for convenience, which writes all grid columns at once in simple table layout.
  • E-shop product catalog
    Just another example of datagrid layout. No changes in php code was necessary, only template has been modified.
  • Taskman datagrid
    It's time for more complex grid template. As of php - there is no change compared with basic grid, except using another query and template.
    See how fields can be formatted and configured in <?elements ?> section of the template.
    In this example: Date and number (price) formating, customized pager, binding of lookup fields and so on.
  • Grid with sorting and searching
    Form and grid can works together very nicely. Here, searchform values are used for setting grid->filter property. We enable sorting by adding "sort" attribute to the columns in grid template.
  • Array based grid
    Now, you can read your data from plain php array, instead of database. For that, use method $grid->setarray($dataarray). As you can see, sorting and filtering is possible too.
  • Summarization grid
    With this feature you can place summarization rows into your grid.
    We use two summarizations in the example: A row with vendor name and summary for each productLine. You can use all power of SQL agregate functions here. In code we add only two lines with $grid->summary function. It is connected with corresponding block in template.
  • Gridform
    Class gridform allows using form elements in the grid.
    You can insert or update grid with functions gridform->insert(), gridform->update(). Update is done on primary key, which must be defined in the grid.
  • Bootstrap grid
    Basic usage of the grid and form with twitter bootstrap framework.
  • Pager grid
    Example of tweaking of the grid pager component.
  • Mobile grid
    Grid with ajax-loading of next page.
  • Example of simple form
    Whole thing is really simple: Create form object from some template and populate $form->values with default data. Three lines of php code. Can it be easier?
    Still you have full control of form layout, indeed! Moreover we use { form.fields} shortcut for writing all form fields at once.
    Look at the <?elements ?> section of template, how input, select, textarea etc. fields are build and configured.
  • Javascript validation
    Just put word 'jsvalid' into form template header. No changes in php, considered example above.
    NOTE: You must include script pclib/assets/pclib.js in your html!
  • Simple CRUD: Advanced form usage
    Most common task in web applications is form management.
    Class form solves a lot of problems and implementation details for you.
    Demo presents editing form, submitting, using default values, form validation, inserting, updating and deleting in database and connection with the grid.
  • HTML5 form
    To enable HTML5 support, just type "html5" in form template. Try submit form and see html5 validation!
    Note: HTML5 is currently not fully supported by all browsers, or support can be buggy. Some features may not work in your browser.
  • Orderform
    See some more features of form class.
    Validation rules (regexp, file upload, max and min input length), custom validation messages, confirm dialog, opening popup window, optgroups in SELECT, using action and datasource.
  • Include, ifs and template blocks
    See more features of templates.
  • Class tree
    Pclib treeview will generate tree from text file or from database table.
    Tree is generated as UL-list and can be styled as collapsable tree.

  • Layout
    Using layout template. Read comments in source code!
  • Authententization and authorization
    $auth->login($user, $password);
    if (! $auth->hasright('mysite/products/edit')) exit();
    It's that simple!
    You can assign any number of roles to the any user. You can delegate all permissions to the, say, "products" module, with wildcard: 'mysite/products/*'.
    - Works fine with thousands users
    - Auth data are stored in database
    - Don't forget check our user management console ATERM! Using console.
  • Class logger
    Log any application event (such as access log or security issue) into database.
    It was designed to be fast and space saving. You can log any defined set of events.
    For more info see source code documentation of this example.
  • Database layer
    Pclib database layer provides (for example):
    - query shortcuts: $row = $db->select('TABLENAME','ID=1').
    - query parameters: $res = $db->query($sql, $params);
    - SQL injection protection
    - Logging of executed SQL queries
    - etc.
    Look into the source code of our example.
  • Multilanguage support
    Example of pclib multilanguage support. Class Translator helps you with translation of your site to other languages.
  • Basic example of pclib ORM
    Selection is object oriented way to build of SQL query. It returns table rows as descendants of pclib Model class.
  • Using BaseObject class
    It extends your classes with some usefull features.

Elapsed time: 22.08 ms