dpi96151 2012-05-01 09:33
浏览 40
已采纳

如何在rss站点上添加url图标

I have a working RSS Feed on my site using the code below but what I would like to add is to have my personal icon to show on the the url address bar in the browser.

<?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);

?>

The code below work on other PHP pages if I add in the area but if I add that to the RSS page there's an error. If I am not mistaken it is because the RSS is being rendered as XML?

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

Anyone can help me on how to change the icon on URL bar if on RSS? Thanks.

  • 写回答

1条回答 默认 最新

  • dongtiannai0654 2012-05-01 11:35
    关注

    Here i am explaining the tag which can be inserted in your main channel and set aside with Text description.

    <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>
    

    you can try this out with your dynamic code.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分