S'identifier - S'inscrire - Contact

CommunityWiki
Jam session in wikilandia

Tags And Feed Icons

Source :

I’m using Oddmuse:Indexed Search which also allows me to tag pages using . I wanted to show a nice little RSS icon next to those tags to encourage people to subscribe to particular feeds only.# I want my own tag rule with RSS icons. $SearchFreeTextTagUrl = $ScriptName . '?action=tag;id='; my $RssIconUrl = 'http://www.emacswiki.org/alex/pics/rss.png'; my $RssFeedUrl = 'http://www.emacswiki.org/alex?action=rss;rcfilteronly=tag:';

$RuleOrder{\&SearchFreeTextTagsRule} = 100; # too lazy to delete it from @MyRules

push(@MyRules, \&TagsWithIconsRule);

sub TagsWithIconsRule { if (m/\G(\[\[tag:$FreeLinkPattern\]\])/cog or m/\G(\[\[tag:$FreeLinkPattern\|([^]|]+)\]\])/cog) { # , my ($tag, $text) = ($2, $3); return $q->a({-href=>$SearchFreeTextTagUrl . UrlEncode($tag), -class=>'outside tag', -title=>T('Tag'), -rel=>'tag' }, $text || $tag) . ' ' . $q->a({-href=>$RssFeedUrl . UrlEncode($tag), -class=>'feed'}, $q->img({-src=>$RssIconUrl, -class=>'smiley', -alt=>'RSS'})); } return undef; } On an ordinary site, you’ll probably have CSS for linked images. I do. That’s why I needed the following:/* for regular pictures on my pages */ div.content a img, div.journal a img { margin: 1em; padding: 0.5em; border:1px dotted; } /* but not for RSS icons */ div.content a img.smiley, div.journal a img.smiley, img.smiley { margin: 0; padding: 0; border: none; } Tags: Oddmuse ← Yay baby!!

le 14.10.08 à 19:15 dans Mind - Version imprimable
Article précédent - Commenter - Article suivant -