Creating Webapplications

?view=page&help=goldfish3&language=de

Create web applications with Goldfish Professional in your prefered language (e.g. PHP).

Creating web applications in this form is only possible in Goldfish professional.

In this example you will sell how simple it is to create a php web apllication in an external source code editor and include it in a Goldfish project.

A php script has usually the suffix .php. In Goldfish you can set the suffix for code files in the preferences. Choose Goldfish > Preferences... from the menu (Edit > Preferences... in Windows). The preferences window appears. Enter php at Suffix of code files on the tab Create Website.

In this example, we use a simple php script that calculates the time which the visitor of your website spents there. The program code itself is stored in an external file, created in an external source code editor.

<h1>PHP Session Test</h1>
<?php

//Save time of the first visit in the session
if(!isSet($_SESSION['startTime'])) {
   $_SESSION['startTime']=mktime();
}

//Print time delay since now
echo '<p>You are visiting this website for '.(mktime()-$_SESSION['startTime']).' seconds now.</p>';

?>

If you have saved the file on your hard disk, drag it into your Goldfish project. It will be included as an alias. That means only the path to the file is stored in the project. The file itself remains on your hard disk. You can still modify it with an external editor and Goldfish publishes the changes if you publish your website.

Goldfish supports also aliases to folders with subfolders, code files, images and other media. Just drag everything that is needed by your scripts in the project.

Properties for Alias

These properties can be set for an alias. Select an alias to show its properties.

Alias > Menu TitleThe menu title will be displayed in all navigation menus, who contain a link to this file. Disable it and the file is not shown in the menu.

We want to execute the script on the start page. Select the start page and click on the page area on it so that the properties of the page area are visible. Click on Page Area > Add HTML Code and enter the following code. This connects the script with the start page.

<?php include 'script.php'; ?>

If you want to use sessions in php, it is required to initialize the session before any html output begins. In Goldfish you have access to the first line even before the html document begins. Select the start page and click on Page > Add Code Before Document and enter the code below, This initializes the session so that it can be uses by your script.

<?php session_start(); ?>

The script prints text on the screen. To change the style of the text, click on the page area and click on Page Area > Add CSS Code in the properties. Enter the style below. It adds a padding and sets the page area transculent.

padding-left:10px;
filter:alpha(opacity=80);
-moz-opacity: 0.80;
opacity: 0.80;

Now your web application is complete. You can change the background and add a border to make it cooler. Publish the website and reload it several times in the browser. The time display will increase.

If you have scripts that handle the complete html output of a page, you can enable Page > Disable HTML Code Output. Goldfish creates a blank page then without any html code. You can add your own html code with Page > Add HTML Code then or connect it with a script.


Konnte diese Hilfeseite Ihre Fragen beantworten?

Wenn Sie zu diesem Thema noch weitere Hilfe benötigen oder in diesem Kapitel eine Information fehlt, schreiben Sie uns.