afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (afuna, cats)afuna ([personal profile] afuna) wrote in [site community profile] dw_dev_training,
@ 2009-10-25 12:02 pm UTC
Entry tags:naming conventions
One of the minor things that has always confused me, and I always forget to ask about, is the difference between the very similarly named "ditemid" and "jitemid" (ditto for "dtalkid" and "jtalkid"). Whenever I need to use these, I have to look for code similar to what I am working on, or look up the function definitions in cgi-bin/LJ/Comment.pm and cgi-bin/LJ/Entry.pm.

I was looking through code and stumbled across a comment that cleared things right up:
# - ditemid -- display itemid (with anum)


So! Noting here what I have gleaned:

itemid = entry
talkid = comment

j* = journal
== the per-journal internal id for the entry/comment. This is the value stored in the database. The "j" is to distinguish it from old-style itemids. In a much earlier iteration, LJ entry ids were shared among all users -- DW doesn't have any old-style itemids, and I suspect much of the earlier support is gone.

d* = display
== the display id. This is the value that you see in URLs, etc. It is combined with a random number, to make sure that bots cannot just iterate over all entries by adding +1 to the previous entry id.

If you want to get into specifics, ditemid = jitemid*256+anum.


(Read 9 comments) - (Post a new comment)
(Flat) (Top-level comments only)

afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (afuna, cats)


[personal profile] afuna
2009-10-26 03:44 am UTC (link)
Oh, hmm. I wonder if that would make it easier to do the parent/child feature. Obviously won't work in most places, but maybe it's a starting point?

*eyes the code thoughtfully*

(Reply to this)  (Thread from start)  (Parent



(Read 9 comments) - (Post a new comment)
(Flat) (Top-level comments only)