Feed::__construct
フィードを作成します
説明
public Feed::__construct( string $title, string $link [, string $description = '' [, string $feedUrl = '' ] ] )
空のフィードを作成します。$linkと$feedUrlは絶対URLになります。
パスをhttp(s)のURLにできない場合(リクエストの外で呼んだとき)は\InvalidArgumentExceptionを投げます。
引数
| 名前 | データ型 | デフォルト | 備考 |
|---|---|---|---|
| $title | string | フィードの名前 | |
| $link | string | フィードが属するページのパスまたはURL('/news/') | |
| $description | string | '' | フィードの説明。''ならタイトルを使います |
| $feedUrl | string | '' | フィード自体のパスまたはURL('/news/feed.xml')。atom:linkとして書き出します。''なら書き出しません |
例
Controller
use Fegg\Tool\Feed;
$siteName = $this->config['site_info']['name'];
$feed = new Feed('ニュース | ' . $siteName, '/news/', $siteName . 'のニュース', '/news/feed.xml');
フィードの検証ツールは、フィードが自分のURLを持っていることを求めるので、$feedUrlを渡してください。