vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   vBJournal Lite enhancements (https://vborg.vbsupport.ru/showthread.php?t=58824)

sabret00the 11-26-2003 03:47 PM

vBJournal Lite enhancements
 
PHP Code:

// 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"
); 

PHP Code:

// 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:
PHP Code:

[color=red][color=#000000]$ jl_comments = if($j_comments = 1){
         
echo("$j_comments comment")
} else if(
$j_comments >= 2) {
echo(
"$j_comments comments") {
else{
echo(
"")
};[/
color]
[/
color

with

PHP Code:

$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

Quote:

Originally Posted by gmarik
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 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

Quote:

Originally Posted by assassingod
Try replacing:
PHP Code:

jl_comments = if($j_comments 1){
         echo(
"$j_comments comment")
} else if(
$j_comments >= 2) {
echo(
"$j_comments comments") {
else{
echo(
"")
}; 

with

PHP Code:

$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
PHP Code:

// 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

Quote:

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:
PHP Code:

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.


All times are GMT. The time now is 11:16 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01138 seconds
  • Memory Usage 1,757KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete