flamencanyc (flamencanyc) wrote in qaf_comingout, @ 2009-01-30 11:27:00 |
|
|||
Entry tags: | html, tutorials |
Coding users and comms in IJ and LJ
Okay kids, since we're talking about coding I though you guys might like this.
If you use the "regular" way to code a user or comm:
<lj user=flamencanyc> or <lj user=qaf_drabbles>
the little symbol before the username will default to the right one for the journaling system you're posting in. In other words, here it's a tweakface, but on LJ it's the little LJ user symbol. And the icon and username will point to the user's profile page and journal in the current journaling system (IJ or LJ). Like this: flamencanyc or qaf_drabbles. That's great most of the time.
But what if, that user or comm doesn't exist on IJ, only on LJ? Like, for example LJ's xhaleslowly or whatsup_qaf?
If I code it that way now, we get this since I'm posting on IJ: xhaleslowly or whatsup_qaf, which if you click on them just give you errors, since they don't exist on IJ.
And what if you want to point to an LJ for a user or comm who has an IJ too?
Same problem applies in reverse when you're posting from LJ about an IJ user or comm.
You needn't say "LJ's xhaleslowly" or "IJ's qaf_alumsnnews".
Instead you can code them so they look and work correctly, like this: xhaleslowly! Here's how:
For an IJ user:
<a href="http://USERNAME.insanejournal.com/p
and just replace the four USERNAMEs with the user's username (not capitalized, I just have the placeholder in caps so it's easier to see and replace).
So if I did that with my username, it would look like this whether you're writing in IJ or LJ:
flamencanyc
I know that seems complicated and intimidating. Don't worry about it. Just copy it to a simple text file (without smart quotes) and save it for future use.
For IJ comms use this:
<a href='http://asylums.insanejournal.com/C
That comes out like this whether you're writing in IJ or LJ:
qaf_alumsnnews
For an LJ user use this:
<a href="http://USERNAME.livejournal.com/p
That comes out like this whether you're writing in IJ or LJ:
flamencanyc with the correct little icon, and correct links!
And lastly, for an LJ comm use this:
<a href="http://community.livejournal.com/C
That comes out like this whether you're writing in IJ or LJ:
whatsup_qaf
And one last fun trick: you can replace the last (but only the last) USERNAME or COMMNAME with whatever nickname you want and the links will still be right, but the nickname will appear. Like this:
Flame or Ethan
So just save 'em, use 'em, and have fun!
ETA: I edited this post in 4/09 when LJ changed the url for the little icons that come before the usernames. Their change made the old way I had posted here no longer work properly, so I fixed it. What's posted above now should work from now on (unless they make a drastic change in the future). So if you've saved this for future reference, you should now throw out the original copy and resave it. And if you've used this method in the past to refer to LJ users/comms those posts will need to be edited accordingly in order to appear correctly.
For anyone who cares, they changed the subdomain from p-stat to l-stat, but I just discovered that simply using www instead of either will default to whichever one they're using. Too bad I didn't notice that earlier. Had I used it here before, it would have continued to work despite the change. Oh well. Now, hopefully, it will continue to work even if there is a future subdomain change.