london_fan (
london_fan) wrote in
style_system2012-11-13 09:55 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[community profile]](https://www.dreamwidth.org/img/silk/identity/community.png)
SOLVED: Comment user icons linking to the commenter's icons page
Hi there, yet another newbie at DW here. I recently imported my highly customized Flexible Squares layout here with layout and theme layers. I changed around the bits that needed tweaking, but I got stuck on one thing. On LJ I have customized code for all icons (the 100x100 ones, not the 16x16 user icons in front of the user name) to link to the respective user's icons page. The link for entry user icons looks as follows:
<a href="$*SITEROOT/allpics.bml?user=$e.poster.username">
And this is the link for the user icons in comments:
<a href="$*SITEROOT/allpics.bml?user=$comment.poster.username">
Due to the different structure of the link to users' icons pages on DW, those links don't work here, but I'm stuck figuring out how to change them. For entries it seems to work just fine to replace the whole link with "icons", because DW will pull up the respective "username.dreamwidth.org/" part all on its own, but that doesn't work for the comment user pictures. How can I create a link to comment posters' icons pages?
Any help here would be highly appreciated.
ETA: Many thanks to
chagrined for solving this and showing me how to break up link strings!
<a href="$*SITEROOT/allpics.bml?user=$e.poster.username">
And this is the link for the user icons in comments:
<a href="$*SITEROOT/allpics.bml?user=$comment.poster.username">
Due to the different structure of the link to users' icons pages on DW, those links don't work here, but I'm stuck figuring out how to change them. For entries it seems to work just fine to replace the whole link with "icons", because DW will pull up the respective "username.dreamwidth.org/" part all on its own, but that doesn't work for the comment user pictures. How can I create a link to comment posters' icons pages?
Any help here would be highly appreciated.
ETA: Many thanks to
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
no subject
# Userpic
var string userpic = "";
if ($*show_entry_userpic)
{
if ($p.view == "read" or $p.view == "entry" or $p.view == "reply")
{
if (defined $e.userpic)
{
$userpic = $userpic + """<a href="$*SITEROOT/allpics.bml?user=$e.poster.username"><img src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height" border=0 alt="$e.poster.name" title="$e.poster.name""";
if ($e.poster.username != $e.journal.username)
{
$userpic = $userpic + " in $e.journal.name";
}
$userpic = $userpic + "\"></a>";
}
}
elseif ($p.journal_type == "C" and $p.view == "recent")
{
if (defined $e.userpic)
{
$userpic = $userpic + """<a href="$*SITEROOT/allpics.bml?user=$e.poster.username"><img src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height" border=0 alt="$e.poster.name" title="$e.poster.name" /></a>""";
}
}
else
{
if (defined $e.userpic)
{
$userpic = $userpic + """<div class="userpic"><a href="$*SITEROOT/allpics.bml?user=$e.poster.username"><img src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height" border=0 alt="$e.poster.name" title="$e.poster.name" /></div></a>""";
}
}
And something very similar for the comment userpics:
#Comment Userpic
if (defined $comment.userpic and $*show_entry_userpic)
{
var int w = $comment.userpic.width;
var int h = $comment.userpic.height;
var string alt = $comment.metadata{"picture_keyword"};
if ($*comment_userpic_style == "small")
{
$w = $w / 2;
$h = $h / 2;
}
if ($alt != "")
{
$alt = ": " + $alt;
}
"""
<div class="datesubjectcomment">
<a href="$*SITEROOT/allpics.bml?user=$comment.poster.username"><img class="userpiccomment" src="$comment.userpic.url" width="$w" height="$h" border=0 alt="$comment.poster.name$alt" title="$comment.poster.name$alt" /></a>""";
print """$poster on """;
print $comment->time_display("long", "");
}
I'm really sorry to keep bothering you like this, but I seem to be unable to solve this alone. Hoe can I implement the split string into this code?
no subject
$userpic = $userpic + """<a href="$*SITEROOT/allpics.bml?user=$e.poster.username"><img src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height" border=0 alt="$e.poster.name" title="$e.poster.name""";
becomes,
$userpic = $userpic + """<a href="http://$e.poster.username""" + """.dreamwidth.org/icons"><img src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height" border=0 alt="$e.poster.name" title="$e.poster.name""";
and similarly for the others. Try that and see if it works?
no subject
no subject
no subject
I hope my code isn't too confusing, since it's basically a tweak of a highly customized Flexible Squares layout with the current LJ code, reverted with an older version that is compatible with DW.
Here you go!
(I'll delete the link as soon as you'll have grabbed the file if you don't mind?)
no subject
http://www.sendspace.com/file/b9epyh
tested on my own journal and it works fine
no subject
THANK YOU VERY MUCH FOR YOUR HELP!!!
no subject
glad to help. I'll delete the link too since you wanted to delete the other one when done.
no subject
Thank you! I think I removed all "incriminating" code tweaks like link lists only viewable to the owner, but better safe than sorry! ;)
no subject
Anyway, the latest code push screwed up the userpics linking to the icon page again, because now there's a problem with user names that have an underscore in it... like mine.
While the code you gave me has been linking back to...
http://london_fan.dreamwidth.org/icons (with an underscore),
the new icon page is now to be found at
http://london-fan.dreamwidth.org/icons (with a hyphen).
So, do you have any idea how to "redirect" to the correct page? How can I get the underscore to be changed into a hyphen? I hope there is a simple trick, because it works with the icon in the contextual popup menu, too. So I hope that it's something simple, I just don't know.
no subject
no subject