SCPHP Tutorial - Hello World!

Skip to end of metadata
Go to start of metadata

This tutorial will show how to create a button that shows the message "Hello World!". The complete source-code is available at the end of the page.

1) Make sure that you already installed SCPHP

If you have not installed SCPHP yet, check the Installation page.

2) Create a new php page and include scripts

Create php page with the following content:

We first declare the __autoload() function. This isn't a required step, but it is a good idea because it make loading SCPHP classes really easy. You could also use a simple require for the class that you need to use.

After that, we create a new instance of ScButtons class.

And finally, we call includeScripts(). This is a function that automatically include the SmartClient scripts.

3) Create the button

Add the following code to the script:

In this part of the script, we are creating a new button with the following attributes:

  • Title: Click me
  • Action: function () { isc.warn( 'Hello World!' ); }

4) Full source code

Here it is the full source code of the script used on this tutorial:

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.