View Single Post
  #1 (permalink)  
Old 02-18-2010, 12:42 AM
jeroenhaan jeroenhaan is offline
Junior Member
 
Join Date: Feb 2010
Posts: 2
Default My manual, especially for easy use.

Personally I think the ticker lacks a simple manual with example code.
But maybe there was a reason for this I might overlook.
Even as an experienced webmaster it took me hours to get it to work.
I want to share you my results.

I can imagine someone wants to do the "flashvars" hard coded or at least get some inside:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="920" height="40">
<param name="movie" value="http://<? print $_SERVER['HTTP_HOST']; ?>/some_directory/preview.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="flashvars" value="xml=http://<? print $_SERVER['HTTP_HOST']; ?>/some_directory/data.php" />
<embed flashvars="xml=http://<? print $_SERVER['HTTP_HOST']; ?>/some_directory/data.php" wmode="transparent" src="http://<? print $_SERVER['HTTP_HOST']; ?>/some_directory/preview.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="920" height="40"></embed>
</object>

When not using the flashvars to specify the path to and name of the xml file, the (PHP) http_host variable makes it work with www and without www when using "<base href=..." in your HTML page.

Also pay attention to the "...wmode...transparent..." story; it removes the ugly black or white container when using other background colours.

If you play a little bit with the variables (posX, posY) in the xml file you can also put some margin around the news ticker.

In order to make the ticker dynamic, please remove
<?xml version="1.0" encoding="utf-8"?>
and add the PHP code.
Don't forget to make a database connection when pulling data from a database.
Rename the file to data.php ot at least don't forget to rename the extension of the file to .php instead of .xml. Note: It is always a good practise naming PHP files to .php so passwords and such are not exposed because the file gets parsed when directly requested with a browser.

Last but not least in the (former) xml file make sure you write "target" with lower case characters and not "TARGET", otherwise the link opens in the same window/tab.

I hope this helps someone out or inspires the authors of the manuals ;-)
Reply With Quote