Cheat sheet

List of methods & variables for Smarty templates.

Contents...

If your user interface contains text fields where users can edit Smarty code then you can offer them a convenient option to quickly add useful methods and variables into those fields. In Webasyst, there is a standard element “cheat sheet”, a sliding-out drawer area with the list of methods and variables, which you can easily copy and use anywhere you want.

Cheat sheet

To enable calling the cheat sheet in your interface, use method {$wa->getCheatSheetButton()} in template files of your app or plugin. The method will display 2 buttons on a page: Variables (for using custom text fields, which can be filled with arbitrary contents) and Cheat sheet (for accessing actually standard Smarty methods and variables).

Cheat sheet buttons

By default, clicking the “Cheat sheet” button displays methods and variables of all apps available for the current user as well as those provided by the framework. If you need to limit the list of methods and variables only to those provided by only one app then specify an array of parameters containing the desired app’s ID:

{$wa->getCheatSheetButton([
    'app' => 'shop'
])}

In this example, users will see only the Smarty methods and variables provided by the Shop-Script app (as well as the framework’s standard ones, which are available in the cheat sheet in any case).