Editing PHP code in the text editor


The bluetronix software allows you to edit PHP code of dynamic web pages like the shopping-cart system or the guest book or add code to any web page. PHP is executed on the server and does not rely on the client’s browser. The following example shows how to use PHP code.

Click on the Settings icon and then on PHP script. In the new window enter the following code:

 

$P1 = $_GET['P1'];;

 

if($P1 == "") { $P1 = "execute without parameter"; }

else { $P1 = "the parameter is".$P1;  }

 

$LayoutHTML = ereg_replace('__PHP_Message__',$P1,$LayoutHTML);

 

This piece of code reads in a parameter $P1, checks if it exists and displays the respective text. The last line means that the text marker __PHP_Message __ gets replaced with text.

 

Confirm by clicking on Apply. Now enter the text marker __PHP_Message__ at any place in the editor. It is possible to set the marker in the editor mode as well as in the HTML view.   Save the website and double-check the result.

When you open your web page now, a text ‘execute without parameter’ will appear instead of the above mentioned text marker. To open the page with a PHP parameter‚ enter ‘http://www.yourdomain.com/Test.html?P1=Hallo’  in the address bar of your browser. Now your PHP script will read in the parameter for the URL and display the text ‘the parameter is Hallo’.

 

 The PHP code editor is an additional feature for experienced web page designers, it is not necessary to have any programming skills to use the general bluetronix software.

 

 The user must have administrative rights to be able to use PHP script in the editor.