Server Side Programming

Flux can help you with server-side programming in PHP, Yuma, Java, or other languages.

Introduction

For many web applications, simply adding capability via JavaScript is not enough, sometimes programming needs to be done on the server too to achieve the desired results. Server side web programming can be done in just about any programming language, but on the web, a few are particularly popular such as PHP.

In this chapter, we'll go over some basic PHP programming you can do in Flux.

Getting started

Open or create a simple page for us to work on. This can be an existing page which already has content, or a brand new page. For this example, we will use a brand new page.

Add a Div and PHP code

PHP code is contained in your web page similarly to normal elements, and Flux displays PHP code as "tokens" which display in the Edit mode, but not in Preview.



Now if you create a div, select it and then choose PHP from the Misc menu, Flux will insert a simple PHP script into the Div, you should ensure that you have chosen to display tokens, or you will not see the PHP.


Running the PHP code

Now to run the PHP, you will need to preview the page in a browser, however PHP will only run on a PHP-enabled web server, so you will need to have access to one. This can be on almost any web server either on your Mac, Windows, or UNIX machine.