View Full Version : vBJournal Lite enhancements
sabret00the
11-26-2003, 03:47 PM
// display 3 entries per users on most recent entries panel
$j_limit = e.userid = u.userid AND e.userid = j.userid LIMIT 3
$journal_recent_entries = $DB_site->query("SELECT j.enabled, u.username, e.journalid, e.title, e.entry, e.timestamp, e.userid
FROM journal_entry e, journal j, user u
WHERE $j_limit
AND e.private = 0 AND j.enabled = 1
ORDER BY e.timestamp DESC
LIMIT 23");
// find comments per journal entry for most recent entries panel
$j_comments = $DB_site->query_first("SELECT COUNT(commentid) FROM journal_comments where journalid = $journalid AND WHERE e.entry = e.title");
$ jl_comments = if($j_comments = 1){
echo("$j_comments comment")
} else if($j_comments >= 2) {
echo("$j_comments comments") {
else{
echo("")
};
could you please help me to get this to work and tell me where i've gone wrong on my train of thought please :)
gmarik
11-26-2003, 03:55 PM
And what exaclty do you need?
Have you seen KuraFire's hack?
assassingod
11-26-2003, 03:57 PM
Try replacing:
$ jl_comments = if($j_comments = 1){
echo("$j_comments comment")
} else if($j_comments >= 2) {
echo("$j_comments comments") {
else{
echo("")
};
with
$jl_comments = if($j_comments = 1)
{
echo("$j_comments comment");
}
else if($j_comments >=2)
{
echo("$j_comments comments");
}
else
{
echo("");
};
Also, I dont think you can use an if statement when declaring a variable but im not sure.
sabret00the
11-26-2003, 03:59 PM
And what exaclty do you need?
Have you seen KuraFire's hack?yup but Kura's hack is vb3 and from what i've seen the vb2 features aint really what i'm after, but this is just two quick edits to my existing journal lite set up, i want to limit the most recent entries to show a maximum of 3 entries per user and then after that i wanna show how many comments an entry has on in the most recent entries column
as you can see here www.ebslive.com/forums/journal.php (http://www.ebslive.com/forums/journal.php) some people get hyperactive about updating which is upto them but i don't want it inflicted on the rest of the users.
sabret00the
11-26-2003, 04:03 PM
Try replacing:
$ jl_comments = if($j_comments = 1){
echo("$j_comments comment")
} else if($j_comments >= 2) {
echo("$j_comments comments") {
else{
echo("")
};
with
$jl_comments = if($j_comments = 1)
{
echo("$j_comments comment");
}
else if($j_comments >=2)
{
echo("$j_comments comments");
}
else
{
echo("");
};
Also, I dont think you can use an if statement when declaring a variable but im not sure.i thought the conditional was fine, i was more worried about the initial SELECT
assassingod
11-26-2003, 04:05 PM
You had missed out some ; and used an { instead of a }
I can't see a problem with the SELECT but I don't know the table structure so I can't confirm
sabret00the
11-26-2003, 04:10 PM
oh thanks didn't see that :)
i guess, i'll only know if i test the second one then :)
but what about the first one the
// display 3 entries per users on most recent entries panel
$j_limit = e.userid = u.userid AND e.userid = j.userid LIMIT 3
$journal_recent_entries = $DB_site->query("SELECT j.enabled, u.username, e.journalid, e.title, e.entry, e.timestamp, e.userid
FROM journal_entry e, journal j, user u
WHERE $j_limit
AND e.private = 0 AND j.enabled = 1
ORDER BY e.timestamp DESC
LIMIT 23");
Velocd
11-26-2003, 04:15 PM
Also, I dont think you can use an if statement when declaring a variable but im not sure.
You can, but certainly not in that syntax with the assignment behind the IF.
Example of proper usage:
if($array = $DB_site -> query_first())
{
}
As for your script Sabret, your syntax is mostly made up. Try looking at some vB scripts in the queries, as you need to use LEFT JOINs, etc. Always incase your strings in quotes, and use proper tabulation!
sabret00the
11-26-2003, 04:49 PM
see i was thinking left joins as i learned that the other day, but as the rest of the script is written in such a fashion and i'm just trying to get two peices of data from it, i tried to emulate the nature of what was already written.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.