A Frogans site, or even a Web site, is said to be “static” when the content of its slides (or pages) is invariable. Here, the FSDL or HTML source documents that determine the site’s content, such as text, images and layout, remain unchanged and can only be modified by the site’s author.
In a dynamic site, on the other hand, content is generated using server-side scripts, so the site’s content can be influenced by data retrieved by the site’s hosting server, such as user input data, location, etc.
For a Frogans site to be dynamic, the source documents representing must be saved on the hosting server in a server scripting language format, such as PHP or ASP. These documents will include the appropriate scripts for retrieving data and for using that data to generate the appropriate FSDL code. This allows the server to process your file and to generate the FSDL document for Frogans Player to read.
This post is going to use examples in PHP. You’ll need some basic knowledge of PHP.
What time is it?
So, let’s say you want a slide in your Frogans site to display the date and time of when it opens up. The first thing to do would be to save your FSDL file with a PHP extension, instead of an FSDL extension (e.g., “home.php,” instead of “home.fsdl”). You’ll need to make sure that the XML declaration is correctly written for PHP (see here for more info).
You might author your Frogans slide as you would any old FSDL document, but where you want the date and time to appear, you can take advantage of PHP’s built-in date() function. For example:
<restext resid='date_time_resource' fontref='reg' size='200,60' orientation='h-ttb-ltr' > <text>The date and time is <?php echo date('D d/m/Y G:i'); ?></text> </restext> <layer resref='date_time_resource' layerid='date_time_layer' align='left-top' pos='28,10' combine='add' leapout='lead' />
Here, the resulting “date_time_layer” will display something like “The date and time is Fri 21/12/2012 00:01” (color added for emphasis).
Using user input
In the above example, the date and time came from data that was already available on the server. But let’s say that you want your content to be determined according to user input. For example, you might make several buttons that go to the same destination slide, but the content of that destination slide can be different, depending on the button that the user clicks.
Imagine that you have a slide with three buttons allowing your user to choose one of three photos to view on the next slide. You could do this using a static site, by creating a separate slide for each photo. Or you could do it by creating a dynamic site, which would generate a single slide that is capable of showing, dynamically, any one of the three photos, depending on the button that user has clicked. The discussion below shows how to create a dynamic site.
Let’s say the user wants to see the photo of a cat. Here, when the user clicks on the “cat” button, a piece of data specific to that choice (“cat”) is sent to the hosting server. When the server reads the document for rendering the new slide, that document, written a scripting language like PHP, will use that piece of data and use it for rendering the slide with the photo of a cat.
So, we’re looking at a two-step process where 1) data is sent from a Frogans slide to the server and 2) the data is recuperated for rendering a second slide.