carriep63 (carriep63) wrote in s2bloggish, @ 2007-08-30 14:59:00 |
|
|||
Entry tags: | comment links, entries, paid, tutorial |
[paid] Images for comment links
This tutorial will show you how to replace your comment links with images. There are actually five different areas we will be working on.
1. The permalink
2. The "Post comment" link
3. The "Read comments" link
4. The entry linkbar (aka "the rest").
5. The separator |
The Permalink
The permalink is found in the functionPage::print_entry. If you do not have this function in your theme layer, then copy and paste the following code in there. You should see no changes in the layout once you compile.
We are only dealing with one line of code in this whole function (so far):
"<a class='permalink' href='$e.permalink_url'>$*text_permalink<
Replace $*text_permalink with your image tag, but do not use "quotes". Use 'apostrophes' instead.
"<a class='permalink' href='$e.permalink_url'><img src='yourimage.jpg'></a>";
function CommentInfo::print_postlink() {
var Page p = get_page();
if ($.maxcomments) {
"$*text_max_comments";
} else {
"""<a href=\"$.post_url\"><img src="yourimagelink.jpg"></a>""";
}
}
function CommentInfo::print_readlink {
var Page p = get_page();
"""<a href=\"$.read_url\"><img src="yourimagelink.jpg"> $.count</a>""";
}
function Entry::print_linkbar() {
var string{} link_caption = {
"edit_entry" => """<img src="linktoyourimage.jpg">""",
"edit_tags" => """<img src="linktoyourimage.jpg">""",
"mem_add" => """<img src="linktoyourimage.jpg">""",
"watch_comments" => """<img src="linktoyourimage.jpg">""",
"unwatch_comments" => """<img src="linktoyourimage.jpg">""",
};
var Link link;
var string sep = "<span class='separator'>|</span>";
var string url = "";
var string text = "";
foreach var string link_key ($.link_keyseq) {
$link = $this->get_link($link_key);
$url = $link.url;
$text = $link_caption{$link_key} != "" ? $link_caption{$link_key} : $link.caption;
if (defined $link) {
"""$sep <a href="$url">$text</a> """;
}
}
}