Skip to content

Functions

Dave Stewart edited this page Apr 18, 2017 · 2 revisions

Sketchpad has been carefully designed to create good-looking output, so comes with a range of helper functions that you can use in your Sketchpad methods:

sketchpad-output

The demo controllers that ship with Sketchpad show all these functions interactively. Just install and navigate to test.

p()

Echo a paragraph tag, with optional class

p('Click the button below');

alert()

Bootstrap info / alert div

alert('The tests passed successfully!', $state);

pr()

print_r() passed arguments

pr($data, $results);

pd()

print_r() and die

pd($error);

vd()

var_dump() passed arguments

vd($input);

ls()

List an object's name:value properties in a nicely formatted table

ls($object);

tb()

List an array of objects in a nicely formatted table

tb($results);

vue()

Loads and runs a Vue file in the UI

vue('sketchpad::vue/test');

md()

Loads a Markdown file or string into the Sketchpad UI and have it transformed.

md('sketchpad::md/docs);
Clone this wiki locally