Entry tags:
where to put functions
So, I am currently in the first stages of working on http://bugs.dwscoalition.org/show_bug.cgi?id=1574 ( "Last active entries" module) and it's actually going quite nicely :)
However, I am a bit stumped on where to put a function I need. Namely, I need a function that, depending on what journal the module is in and who is viewing it, returns the last x active entries in that journal (maybe not the full Entry objects, though, still working on that).
My first thought was cgi-bin/LJ/User.pm , as it would be good to have $u->get_recent_active($remote) or something like that. But now I am leaning more towards putting it in cgi-bin/DW/Logic/LogItems.pm , which has the functions $u->watch_items and $u->recent_items . However, my idea only semi-fits the module description.
Or maybe it should be in cgi-bin/LJ/S2.pm?
Yes, I am still confused by where to put stuff. Any ideas?
However, I am a bit stumped on where to put a function I need. Namely, I need a function that, depending on what journal the module is in and who is viewing it, returns the last x active entries in that journal (maybe not the full Entry objects, though, still working on that).
My first thought was cgi-bin/LJ/User.pm , as it would be good to have $u->get_recent_active($remote) or something like that. But now I am leaning more towards putting it in cgi-bin/DW/Logic/LogItems.pm , which has the functions $u->watch_items and $u->recent_items . However, my idea only semi-fits the module description.
Or maybe it should be in cgi-bin/LJ/S2.pm?
Yes, I am still confused by where to put stuff. Any ideas?
no subject
And how are you implementing this? Where are you pulling the data from?
(no subject)
(no subject)
(no subject)
no subject
SELECT * FROM
(SELECT talk2.*, logtext2.subject FROM talk2 INNER JOIN log2 INNER JOIN logtext2
ON logtext2.journalid=log2.journalid and talk2.journalid=logtext2.journalid and talk2.nodeid=log2.jitemid and log2.jitemid=logtext2.jitemid
WHERE logtext2.journalid=$userid AND talk2.state<>"D" AND talk2.state<>"S" ORDER BY talk2.datepost DESC) innertable
GROUP BY innertable.nodeid ORDER BY innertable.datepost DESC LIMIT 10;
[Yes, three-table join *winces* - I would love to have the subject from logtext2 without getting the whole Entry object first - but that can definitely be substituted!]
I tried with just substituting datepost with jtalkid and for my test case (http://activeentries.yvi.hack.dreamwidth.net/) the results it shows are fine and in the correct order. I am not sure about the nested table thing, though, which I found is necessary since I only want one comment for each post and only the most recent one and GROUP BY and ORDER BY don't play nicely together :(. Is that a problem?
And reading back over it it's probably really horrible and if I shouldn't use any joins I'll be more than happy to do without. This was more for me testing how the databases work together and where what is stored. recent_comments.bml does have some stuff that might work otherwise.
I'll shut up now.
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)