Yii2 widget for Telex news scroller
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitattributes
.gitignore
LICENSE
README.md
Telex.php
TelexAsset.php
composer.json

README.md

Yii2-telex 2.1

Telex news scroller widget for the Yii2 PHP Framework

Telex widget is a widget to render my Javascript telex widget. It displays horizontal scrolling news messages, traffic information, stock quotes, and the like, provided by a Yii2 DataProvider.

A demonstration of Yii2-telex is here.

Installation

Install Yii2-telex with Composer. Either add the following to the require section of your composer.json file:

"sjaakp/yii2-telex": "*"

Or run:

composer require sjaakp/yii2-telex "*"

You can manually install Yii2-telex by downloading the source in ZIP-format.

Using Yii2-telex

Options

Yii2-telex has the following options:

  • dataProvider: instance of a yii\data\DataProviderInterface providing BaseObjects with message data.
  • bodyAttribute: attribute name of the attribute of the message's body text. The body text may contain HTML. Default: "body".
  • styleAttribute: attribute name of the style attribute (optional). This attribute will be prefixed with stylePrefix to form the HTML-class of the message. Default: "style".
  • urlAttribute: attribute name of the url attribute (optional). If set, the message will be a link to the url. Default: "url".
  • stylePrefix: see styleAttribute. Default: "telex-".
  • options: array of options for the underlying Javascript telex widget. More information here.
  • htmlOptions: array of HTML options for the Telex container. Use this if you want to explicitly set the ID.

Overridable

Yii2-telex's protected function prepareBody($str) can be overridden. To manipulate the body text before it is sent to the widget. The default implementation just returns $str.