2012-05-01 7 views
1

下記のコードを使用して自分のサイトにRSSフィードを作成していますが、私が追加したいのは、個人用のアイコンをブラウザのURLアドレスバーに表示することです。rssサイトにURLアイコンを追加する方法

<?php define ('CONFIG_SYSTEM_URL','http://www.mydomain.tk/'); 

require_once('feedcreator/feedcreator.class.php'); 

$feedformat='RSS2.0'; 

header('Content-type: application/xml'); 

$rss = new UniversalFeedCreator(); 
$rss->useCached(); 
$rss->title = "daily news feed"; 
$rss->cssStyleSheet=''; 
$rss->description = 'this feed is from me'; 
$rss->link = CONFIG_SYSTEM_URL; 
$rss->syndicationURL = CONFIG_SYSTEM_URL.'feed.php'; 

$articles=new itemList(); 
foreach ($articles as $i) { 
    $item = new FeedItem(); 
    $item->title = sprintf('%s',$i->title); 
    $item->link = CONFIG_SYSTEM_URL.'item.php?id='.$i->dbId; 
    $item->description = $i->Subject; 
    $item->date = $i->ModifyDate; 
    $item->source = CONFIG_SYSTEM_URL; 
    $item->author = $i->User; 
    $rss->addItem($item); 
} 

print $rss->createFeed($feedformat); 

?> 

下記のコードは、私がこのエリアに追加すると他のPHPページでも動作しますが、それをRSSページに追加するとエラーが発生します。私が間違っていないのは、RSSがXMLとしてレンダリングされているからです。

<head> 
<title>Other page works with icon but rss wont</title> 
<link rel="shortcut icon" href="images/myicon.ico"> 
</head> 

誰もがRSSの場合はURLバーにアイコンを変更する方法についての私を助けることができますか?ありがとう。

+0

可能性のある複製http://stackoverflow.com/questions/8782782/how-can-i-get-an-icon-for-my-rss-feed –

+0

こんにちはsteve、投稿する前に、私はすでにfaviconを試しました.icoものだが、解決策ではないようだ。私はルートディレクトリに私のfavico.icoを持っています。 –

答えて

1

ここでは、メインチャンネルに挿入してテキストの説明を付けることができるタグについて説明しています。

<image> sub-element of <channel> 

<image> is an optional sub-element of <channel>, which contains three required and three optional sub-elements. 

<url> is the URL of a GIF, JPEG or PNG image that represents the channel. 

<title> describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML. 

<link> is the URL of the site, when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>. 

Optional elements include <width> and <height>, numbers, indicating the width and height of the image in pixels. <description> contains text that is included in the TITLE attribute of the link formed around the image in the HTML rendering. 

Maximum value for width is 144, default value is 88. 

Maximum value for height is 400, default value is 31. 

<image> 
    <url>http://www.snook.ca/img/rss_banner.gif</url> 
    <title>Snook.ca</title> 
    <link>http://www.snook.ca/jonathan/</link> 
    <width>111</width> 
    <height>32</height> 
    <description>Snook.ca features tips, tricks, and bookmarks on web development</description> 
    </image> 

ダイナミックコードで試すことができます。

+0

こんにちはAmit、提案をいただきありがとうございます。私はアイコンについてのあなたの質問にあなたを混乱させたと思う。 アイコンの意味は、URLバーに表示されるURLアイコンであり、RSS上の画像は表示されません。私は自分のRSSにイメージ機能を持っていますが、これは含まれていませんが、私が提供するリファレンスのためです。 'code' $ image = new FeedImage(); $ image-> title = '私の個人的なRSSロゴ'; $ image-> url = 'http://www.mydomain.tk/images/mypersonallogo.png'; $ image-> link = "http://www.mydomain.tk"; $ image-> description = 'これは私の個人的なRSSロゴです。 $ image-> width = 20; $ image-> height = 20; $ rss-> image = $ image; 'code' –

関連する問題