Source for file NewsTicker.class.php
Documentation is available at NewsTicker.class.php
* For including this file you have to define the constant "CLASSPATH".
* Because every include in the framework depends on the CLASSPATH definition.
* The CLASSPATH means the relative path to the folder that contains the
echo "<h3>You have to define the constant CLASSPATH!</h3>\n";
echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\n";
* A pool of regular expressions.
require_once( CLASSPATH. "html/HTMLLayer.class.php" );
require_once( CLASSPATH. "html/JavaScript.class.php" );
* A class to generate "<div>"-Layer-News-Ticker.
* @author Daniel Plücken <daniel@debakel.net>
* @license http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
* @copyright Copyright (c) 2005 Daniel Plücken <daniel@debakel.net>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
* @var string $ticker_text
"This is the standard ticker text! Please give an custom text.";
* @var integer $clip_width
* @var integer $clip_height
* @var integer $step_width
* @var integer $refresh_rate
* @var string $name_suffix
* @var boolean $use_marquee
* @author Daniel Plücken <daniel@debakel.net>
* @param $name The value of the name- and id-attribute of the layer.
function NewsTicker( $ticker_text, $name = "DPTicker" )
$this->id = "tickerlayout". $name;
$this->name = "tickerlayout". $name;
* Stores the value of this tag's "name"-attribute with the suffix
* @author Daniel Plücken <daniel@debakel.net>
{ $this->name = "tickerlayout". $string; }
* Stores the text of this ticker text.
* @author Daniel Plücken <daniel@debakel.net>
* Stores the value of this item's "id"-attribute with the suffix
* @author Daniel Plücken <daniel@debakel.net>
function setId( $string )
{ $this->id = "tickerlayout". $string; }
* Stores the step width in pixel per each refresh of the ticker.
* @author Daniel Plücken <daniel@debakel.net>
* Stores the period in milliseconds between the refreshes of the ticker.
* @author Daniel Plücken <daniel@debakel.net>
* Stores the width of the ticker.
* @author Daniel Plücken <daniel@debakel.net>
* Stores the height of the ticker.
* @author Daniel Plücken <daniel@debakel.net>
* Stores the gap between the two text-<div> of the ticker. This function is
* an alias for the function setGap().
* @author Daniel Plücken <daniel@debakel.net>
* Stores the gap between the two text-<div> of the ticker.
* @author Daniel Plücken <daniel@debakel.net>
* Returns a generated string based on the attributes of this HTML-Object.
* @author Daniel Plücken <daniel@debakel.net>
return " <style type=\"text/css\">\r\n"
. "document.getElementById('tickerlayout". $this->name_suffix. "')"
. " 'rect( 0, ' + ticker_width_". $this->name_suffix. " + 'px, ' "
. "// Ticker initialization\r\n"
. "document.getElementById( 'ticker1". $this->name_suffix. "' )"
. ".innerHTML = ticker_text_". $this->name_suffix. ";\r\n"
. "document.getElementById( 'ticker2". $this->name_suffix. "' )"
. "ticker_text_width_". $this->name_suffix. " = document.getElementById( "
. "document.getElementById('ticker1". $this->name_suffix. "')"
. ".style.position = 'relative';\r\n"
. "document.getElementById('ticker2". $this->name_suffix. "')"
. ".style.position = 'relative';\r\n"
. "document.getElementById('ticker1". $this->name_suffix. "')"
. ".style.display = 'inline';\r\n"
. "document.getElementById('ticker2". $this->name_suffix. "')"
. ".style.display = 'inline';\r\n"
. "document.getElementById('ticker1". $this->name_suffix. "')"
. ".style.left = '0';\r\n"
. "document.getElementById('ticker2". $this->name_suffix. "')"
. " pos_x_1_". $this->name_suffix. " = parseInt( document.getElementById"
. " pos_x_2_". $this->name_suffix. " = parseInt( document.getElementById"
. " document.getElementById( 'ticker1". $this->name_suffix. "' )"
. " document.getElementById( 'ticker2". $this->name_suffix. "' )"
. "window.setInterval( 'tick". $this->name_suffix. "()', "
" <div id=\"ticker1". $this->name_suffix. "\">[init]</div>\r\n"
. " <div id=\"ticker2". $this->name_suffix. "\">[init]</div>\r\n"
} // END of class NewsTicker
|