PHP/SWF Slideshow > Tutorial

Basics

1. Type the following text in a text document, name the document sample.php, and place it on your server:

If slideshow.php isn’t in the same directory as this text document, the include statement must contain the appropriate file path. This must be a relative path to prevent the server from interpreting the php code before including it. Example: “/includes/slideshow.php”.

Make sure you add the include statement only once in each script page, or use include_once instead.

2. Using another document, create a web page and insert the slideshow.swf flash file into it with the Insert_Slideshow() function like this:



The Insert_Slideshow() function also tells slideshow.swf to get the slideshow’s data from sample.php created in the first step, and determines the slideshow’s width and height.

If slideshow.php, slideshow.swf, or sample.php aren’t in the same directory as your web page file, the URLs must contain the appropriate file paths. The path for slideshow.php must be relative to prevent the server from interpreting the php code before including it. Other paths can either be relative or absolute. Examples: “/includes/slideshow.php”, “http://www.myserver.com/graphics/slideshow.swf”, “scripts/php/sample.php”.

If your server isn’t configured to process PHP inside .html pages, either configure it to do so, or save this web page as .php document.

3. Preview the web page in a browser. Because the PHP code in sample.php doesn’t describe a slideshow, this example generates a basic, default slideshow like this:

Slideshow Modification

To edit the slideshow, create the necessary variable in sample.php and pass it as an argument to the Send_Slideshow_Data() function:

Source

Leave a Reply

Your email address will not be published. Required fields are marked *