[personal profile] london_fan posting in [community profile] style_system
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 [personal profile] chagrined for solving this and showing me how to break up link strings!

Date: 2012-11-14 02:27 am (UTC)
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)
From: [personal profile] chagrined
Have you tried

<a href="http://$e.poster.username.dreamwidth.org/icons">
and
<a href="http://$comment.poster.username.dreamwidth.org/icons">
?

The only thing I can think is maybe having the variable in there right next to the ".dreamwidth" mayyyyy cause problems? I'd try it first and see if it works. If not maybe you could split the string up into two strings. "<a href="http://$e.poster.username" + ".dreamwidth.org/icons">" ? or w/e like that

eta: all right, I tried to use that as a string in mine it did indeed cause problems with the .dreamwidth b/c it thought that was supposed to be a substring or w/e. but then I put them on two different lines and it worked.
Edited Date: 2012-11-14 02:43 am (UTC)

Date: 2012-11-14 07:32 pm (UTC)
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)
From: [personal profile] chagrined
are you editing the S2 layer code directly? or are you putting this in the customization wizard somewhere?

if directly, then okay, for example, in the S2 layer I am using, the part of EntryPage::print_comment() that prints the userpic is:

if ($*opt_userpic_comments and defined $e.userpic) {
    """<div class="user-icon">$e.userpic</div>""";
}


The stuff inside the """ is a string that's added to the outputted html, with ; marking the end of that expression

so you could try instead replacing it (on yours) with

"""<a href="http://$e.poster.username""" + """.dreamwidth.org/icons">""";

or,

"""<a href="http://$e.poster.username""";
""".dreamwidth.org/icons">""";


(should be effectively the same thing and if the former doesn't work you can try the latter; I recently had a weird issue with something not concatenating like I expected it to)

if you have a double quotation mark in your string then you put it inside triple-quotation marks like that.

if you are doing it through the customization wizard instead somehow then you could ~try~ putting <a href="http://$e.poster.username""" + """.dreamwidth.org/icons"> in the field, that mayyyyy work? but you may have to edit the layer S2 code directly.

Date: 2012-11-14 08:19 pm (UTC)
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)
From: [personal profile] chagrined
It's no problem! Each time it shows up you should replace it with something like, for example for the first time it shows up in that first chunk of code:

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

Date: 2012-11-14 08:46 pm (UTC)
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)
From: [personal profile] chagrined
Hmmm. Would you mind uploading the full code you're using for your layers in some text files? Well, if this is in your layout layer, then you can just upload that, else if you could upload both layout & theme layer code. I'll try to make the layers myself and see if I can get it to work. :3

Date: 2012-11-14 09:25 pm (UTC)
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)
From: [personal profile] chagrined
yeah, I just did as described above. it's a bit different in the comment case. you can look at the code to see how it works if you are curious :)

http://www.sendspace.com/file/b9epyh

tested on my own journal and it works fine

Date: 2012-11-14 09:38 pm (UTC)
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)
From: [personal profile] chagrined
yeah, lots of quotation marks, gets confusing. :)

glad to help. I'll delete the link too since you wanted to delete the other one when done.

Date: 2013-02-14 09:01 pm (UTC)
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)
From: [personal profile] chagrined
Hi, sorry for the delayed reply! Hmmm, that sounds like it's probably incorrect behavior on DW's part! Like, that should redirect or still work with the underscore. So you might want to go post in support about it and they can file a bug report! I can't think of another way to fix it off the top of my head. It's weird that the popup menu is working, though.

Profile

Dreamwidth style system discussion

April 2025

S M T W T F S
  12345
6 78910 1112
13 141516171819
2021 2223242526
27282930   

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 1st, 2025 05:57 am
Powered by Dreamwidth Studios