PHP/SWF Slideshow  2.6 | XML/SWF Slideshow | SlickBoard(New) | XML/SWF Charts

 next > 

 

Basics

 

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

<?php

//include slideshow.php to access the Send_Slideshow_Data function
include "slideshow.php";

Send_Slideshow_Data ();

?>

 

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:

<HTML>
<BODY bgcolor="#FFFFFF">

<?php

//include slideshow.php to access the Insert_Slideshow function
include "slideshow.php";

//insert the slideshow.swf flash file into the web page
//tell slideshow.swf to get the slideshow's data from sample.php created in the first step
//set the slideshow's width to 320 pixels and the height to 240
echo Insert_Slideshow ( "slideshow.swf", "sample.php", 320, 240 );

?>

</BODY>
</HTML>

 

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:

<?php

//include slideshow.php in your script
include "slideshow.php";

//show the control bar
$slideshow [ 'control' ][ 'bar_visible' ] = "on";
							
//build a slideshow using the new variable
Send_Slideshow_Data ( $slideshow );

?>

 

 next > 


Copyright 2004-2014, maani.us