Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

RSS2 Add-on - Icon in Panel Header

edited September 2006 in Vanilla 1.0 Help
Hi,

Does anyone know and therefore tell me, what the code is to put a Web Feed icon next to the Panel Title in the RSS2 add-on?
Everything I try doesn't seem to work, but I'm rubbish at PHP!

I'd like the Panel to say "Feeds   image " I've tried putting in various different code into this line of the default.php:

$Head->AddString("<link rel=\"alternate\" type=\"application/rss+xml\" href=\"".$FeedUrl."\" title=\"".$Context->GetDefinition("RSS2Feed")."\" />");

I know that this would put the image next to the word RSS in the list, but I thought if I could get it to do that then I might be able to get it to appear in the Panel Header.

Thanks in advance.

S
«1

Comments

  • Options
    If you want it to appear next to the Feeds word, you need to open up the RSS2/default.php file, find this line: $FeedText = $Context->GetDefinition("Feeds"); and change it to: $FeedText = $Context->GetDefinition("Feeds").' <a href="'.$FeedUrl.'"><img src="SOURCETOTHELITTLEFEEDIMAGE"></a>'; then remove this line: $Panel->AddListItem($FeedText, $Context->GetDefinition("RSS2Feed"), $FeedUrl); And i think that should do the trick. Let me know how it goes.
  • Options
    Thanks for your reply Minisweeper, Unfortunately it didn't work.

    Any other suggestions.

    Thanks
  • Options
    Did it do anything?
  • Options
    Nothing at all. I'm using jazzman's green theme, but I tried looking at it in the default theme but still nothing.
  • Options
    so it didnt even remove the RSS2 link in the list? you must have done something wrong..?
  • Options
    I don't think I'm doing anything wrong but heres the code I have after your suggestion:

    $FeedText = $Context->GetDefinition("Feeds").' <a href="'.$FeedUrl.'"><img src="http://www.mydomain.co.uk/images/rss.png"></a>'; $Panel->AddList($FeedText, 100); $Head->AddString("<link rel=\"alternate\" type=\"application/rss+xml\" href=\"".$FeedUrl."\" title=\"".$Context->GetDefinition("RSS2Feed")."\" />");

    and this is the original code:

    $FeedText = $Context->GetDefinition("Feeds"); $Panel->AddList($FeedText, 100); $Panel->AddListItem($FeedText, $Context->GetDefinition("RSS2Feed"), $FeedUrl); $Head->AddString("<link rel=\"alternate\" type=\"application/rss+xml\" href=\"".$FeedUrl."\" title=\"".$Context->GetDefinition("RSS2Feed")."\" />");

    Have I missed something?

    Thanks for your time on this Minisweeper.
  • Options
    Yeah that's right. I dont see how that's not working. What if you swap this: $FeedText = $Context->GetDefinition("Feeds").' <a href="'.$FeedUrl.'"><img src="http://www.mydomain.co.uk/images/rss.png"></a>'; $Panel->AddList($FeedText, 100); for this: $FeedText = $Context->GetDefinition("Feeds").' <a href="'.$FeedUrl.'"><img src="http://www.mydomain.co.uk/images/rss.png"></a>'; $Panel->AddString($FeedText, 100);
  • Options
    I'm still getting no change. :(

    I'm cleaning the cache each time and tried it in multiple browsers.
  • Options
    NickENickE New
    edited September 2006
    Firstly, change back the extension to however it was by default. Then, go into conf/language.php and add the line:$Context->Dictionary['Feeds'] = 'Feeds <img src="IMAGE URL" alt="" />'; (inside the php tags, obviously)
  • Options
    edited September 2006
    Mark should allow to add attributes to a List. You could that way add a class this list and apply feed logo as background of it.

    If you can add the logo to the list item, you edit line 55:
    $Panel->AddListItem($FeedText, $Context->GetDefinition("RSS2Feed"), $FeedUrl, "", " class=\"RSS2Feed\");
  • Options
    Thanks SirNot, that worked fine.

    Dinoboff, thanks for your reply, I might experiment with that.

    Minisweeper, Thanks for your time on this.

    Hooray it works. :)
  • Options
    I've just had a thought, could I do the same thing for the feedreader add-on?

    I'm looking at the code and I can't figure out how to do it.

    I'd really appreciate if someone could just point out where I could put the image tag.

    Thanks.
  • Options
    Take a look at line 183, and change it to something like this:$Panel->AddList($channel_title.' <img src="SOME IMAGE" alt="" />', 10);
  • Options
    edited September 2006
    [edit]

    Ok, that doesn't seem to work. It does however move the panel to the top page. I have the feedreader panel set at 12, I changed the panel ordering but I don't think that will effect this though.
  • Options
    Oops, my bad. Change that line back, then add above it:$channel_title .= ' <img src="IMAGE" alt="" />';
  • Options
    Nice one, that worked a treat.

    Thanks again SirNot. :)
  • Options
    edited September 2006
    I'm not sure why i didnt think of doing it your way, sirnot, but is there any reason my way shouldnt work? Just curious for myself..
  • Options
    NickENickE New
    edited September 2006
    Well the problem with your approach is that there are multiple places within RSS2 and Atom extensions where $Panel->AddList (and, before it, $Context->GetDefinition('Feeds')) is called, so you'd have to go through and change every spot it could add a list to the side panel. In addition, if you also had the Atom extension enabled, you'd have to be sure that all three instances were modified in the same way, otherwise it'd appear under a different list name. Obviously, simply changing the definition is a lot easier. I believe the reason your idea probably didn't work is because that a) you added in the wrong spot and/or b) you took away the $Panel->AddListItem call.
  • Options
    Ahh ok. I didnt realise it added it in more than one place. My bad.
  • Options
    Ok people, sorry to keep pestering you.

    I was doing this all on a mac in safari earlier and all looked lovely. I've just managed to have a look at the newly added icons in IE6 and firefox on mac and PC. In those browsers the icons came out like this:

    image

    but on the mac they look like they are supposed too:

    image

    I admit that I am using align="right" in the image code that SirNot gave to me, but I couldn't think of a quick way of doing this differently.

    How do I go about fixing this problem? Do I wrap the img tags in div's then alter them in the css file?

    Thanks again
This discussion has been closed.