Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-25-2004, 03:36 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default text not echoing out

PHP Code:
    $latestconfession $DB_site->query_first ("
                     SELECT COUNT(*) AS votes, confessions.confessionid, confessions.visible,
                     confessions.text, confession_rate.rate, user.username
                     FROM confessions
                     LEFT JOIN confession_rate ON (confessions.confessionid = confession_rate.confessionid)
                     LEFT JOIN user ON (user.userid = confessions.userid)
                     WHERE confessions.visible = 1
                     GROUP BY confessions.confessionid
                     ORDER BY confessions.confessionid DESC
                     LIMIT 1 
                 "
);
 
     
$latestconfession_info $DB_site->fetch_array($latestconfession);
 
     
$latestconfession_info['text'] = nl2br(stripslashes($latestconfession_info['text']));
     if (
strlen($latestconfession_info[text]) > 150)
     {
         
$latestconfession_info['text'] = substr($latestconfession_info['text'],0,150)."...";
     }
 
     
$latestconfession_info_text "$latestconfession_info[text]";
     
$latestconfession_info['num_rates'] = number_format($latestconfession_info['votes']);
     
extract($latestconfession_info);
 
     eval(
'$siteindex_contentbox .= "' fetch_template("siteindex_confessions") . '";'); 
the problem is that $latestconfessions_info_text isn't eachoing out into the template
Reply With Quote
  #2  
Old 07-25-2004, 03:40 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If it's 0, it won't. Try echoing $latestconfessions_info_text + "Test". If that works, you'll know your text isn't getting set.
Reply With Quote
  #3  
Old 07-25-2004, 03:54 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i tried that and it never worked, yet i know the text is there as i can get it via the query, i'm not quite sure where i've gone wrong from doing the query to trying to echo it out as it seems to be getting lost.
Reply With Quote
  #4  
Old 07-25-2004, 04:22 PM
Modin Modin is offline
 
Join Date: Jun 2004
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You don't need to fetch the array after calling the function "$DB_site->query_first()". query_first already returns an array of the first row of the result.

So try removing
Code:
$latestconfession_info = $DB_site->fetch_array($latestconfession);
and then fix up your variables to match.
Reply With Quote
  #5  
Old 07-25-2004, 04:44 PM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Check that this whole thing is not in an if or while clause that's not being executed.

Do you have a template siteindex_confessions? (ok, rather basic question, but spelling errors can happen )

why do you call $latestconfession_info_text instead of just $latestconfession_info[text] ??
You might also want to take away those ""'s
Reply With Quote
  #6  
Old 07-25-2004, 05:07 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks both of you, the working code is now

PHP Code:
    $latestconfession $DB_site->query_first ("
                    SELECT COUNT(*) AS votes, confessions.confessionid, confessions.visible,
                    confessions.text, confession_rate.rate, user.username
                    FROM confessions
                    LEFT JOIN confession_rate ON (confessions.confessionid = confession_rate.confessionid)
                    LEFT JOIN user ON (user.userid = confessions.userid)
                    WHERE confessions.visible = 1
                    GROUP BY confessions.confessionid
                    ORDER BY confessions.confessionid DESC
                    LIMIT 1 
                "
);

    
$latestconfession['text'] = nl2br(stripslashes($latestconfession['text']));
    if (
strlen($latestconfession[text]) > 150)
    {
        
$latestconfession['text'] = substr($latestconfession['text'],0,150)."...";
    }

    if (
$latestconfession['rate'] == NULL)
    {
        
$latestconfession['rate'] = "0";
    }

    eval(
'$siteindex_contentbox .= "' fetch_template("siteindex_confessions") . '";'); 
Reply With Quote
  #7  
Old 07-26-2004, 12:16 AM
Modin Modin is offline
 
Join Date: Jun 2004
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

great to see
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:37 PM.


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.03716 seconds
  • Memory Usage 2,236KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete