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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-21-2005, 07:07 PM
BigIke's Avatar
BigIke BigIke is offline
 
Join Date: Aug 2004
Location: Norfolk, VA
Posts: 143
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Can anyone see any problems with this code?

This code grabs the most recent post, author blah blah... I keep getting an error message that states:
Quote:
Fatal error: Call to a member function on a non-object in /homepages/24/d116946458/htdocs/vb/modules/features.php on line 24
Code:
<?php

/* Needed for use without vBA
 require_once('./global.php'); 
*/


/* ###### VARIOUS SETTINGS ###### */

$box_max_title_length=30;
$box_max_post_length=80;
$box_do_parse=0; /* Set to 1 to parse BBCODE */
$box_attachment_file="http://s116946478.onlinehome.us/vb/attachment.php?";

/* ###### GRABBING DATA ###### */

/* Only needed if you're going to be using bbcode */
if($box_do_parse==1){require_once('./includes/functions_bbcodeparse.php');}

/* Forum to Grab thread/post from */
$box_forumid_1=2;

/* Grabbing the thread */ 
$box_forumid_1thread = $DB_site->query_first("SELECT * FROM ".TABLE_PREFIX."thread
WHERE forumid = '$box_forumid_1' ORDER BY thread.dateline DESC "); 

/* Grabbing the first post */
$box_forumid_1_first_post=$DB_site->query_first("SELECT * FROM ".TABLE_PREFIX."post
WHERE threadid = '$box_forumid_1thread[threadid]' ORDER BY dateline ASC");

/* Grabbing the first attachment */
$box_forumid_1_image=$DB_site->query_first("SELECT * FROM ".TABLE_PREFIX."attachment
WHERE postid = '$box_forumid_1_first_post[postid]' ORDER BY dateline DESC");

$image1=$box_forumid_1_image['attachmentid'];

/* ###### FORMATING DATA ###### */

/* Max title length */
if(strlen($box_forumid_1thread[title])>$box_max_title_length){
$box_forumid_1thread[title]=substr($box_forumid_1thread[title], 0, $box_max_title_length);
}

/* Max post length */
if($box_forumid_1_first_post[pagetext]>$box_max_post_length){
$box_forumid_1_first_post[pagetext]=substr($box_forumid_1_first_post[pagetext], 0, $box_max_post_length);
}

/* Parse BBCODE if desired */
if($box_do_parse==1){
$box_forumid_1_first_post[pagetext]=parse_bbcode($box_forumid_1_first_post[pagetext]);
}

/* IMAGE CREATION */
$box_1_image="<img src='".$box_attachment_file."attachmentid=$img_m&stc=1' width='100' height='100' border='0'/>";

/* Template to use for data */
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_features') . '";');

?>
This guy has been giving me some problems, any help would be appreciated
Reply With Quote
  #2  
Old 03-21-2005, 07:10 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

put in global $DB_site; and see how that goes.
Reply With Quote
  #3  
Old 03-21-2005, 07:21 PM
Deaths Deaths is offline
 
Join Date: Oct 2004
Location: Europe, Belgium
Posts: 679
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need your global.php mate.
Change
PHP Code:
/* Needed for use without vBA
 require_once('./global.php'); 
*/ 
to
PHP Code:
//Needed for use without vBA
 
require_once('./global.php'); 
Reply With Quote
  #4  
Old 03-21-2005, 08:59 PM
BigIke's Avatar
BigIke BigIke is offline
 
Join Date: Aug 2004
Location: Norfolk, VA
Posts: 143
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've installed many hacks but for some reason, I can't get the path right for my global.php.. I have set it to /homepages/24/d116946458/htdocs/vb/global.php , but it now says
Quote:
Fatal error: main(): Failed opening required './includes/init.php' (include_path='.:/usr/local/lib/php') in /homepages/24/d116946458/htdocs/vb/global.php on line 50
I suspect my path in the features.php is wrong... But thats why I came to you guys, because you're the experts :glasses:
Reply With Quote
  #5  
Old 03-21-2005, 09:05 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Something else is assuming you are in the forums folder.

try ...

chdir("/homepages/24/d116946458/htdocs/vb");

Before your call to include global.
Reply With Quote
  #6  
Old 03-21-2005, 09:06 PM
Deaths Deaths is offline
 
Join Date: Oct 2004
Location: Europe, Belgium
Posts: 679
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Heh .

Are you coding a vBa cmps module?
Or is this a normal script, and you're using a cmps module as a guide?
Reply With Quote
  #7  
Old 03-21-2005, 09:11 PM
BigIke's Avatar
BigIke BigIke is offline
 
Join Date: Aug 2004
Location: Norfolk, VA
Posts: 143
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, this is for a vBadvanced module at the top of my site. I made sure that I specified the forum to pull the objects from
Quote:
/* Forum to Grab thread/post from */
$box_forumid_1=2;
Then, I made a template so that the "features.php" could be displayed in it.
Reply With Quote
  #8  
Old 03-21-2005, 09:14 PM
Deaths Deaths is offline
 
Join Date: Oct 2004
Location: Europe, Belgium
Posts: 679
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try filling in 2 instead of the variable, see what it gives.
Reply With Quote
  #9  
Old 03-21-2005, 09:20 PM
BigIke's Avatar
BigIke BigIke is offline
 
Join Date: Aug 2004
Location: Norfolk, VA
Posts: 143
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

NOPPID- you're the man. I put the chdir... before it, and now I don't receive an error message. One problem though, and I suspect it is with my template, but if you go to the homepage, well, you can see its kind of messed up.
My template goes something like this...
Code:
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%"> 
    <tr> 
        <td class="tcat"> 
            <strong><span class="smallfont">$vba_options[portal_blockbullet] $vboptions[bbtitle]Features</strong></span> 
        </td> 
    </tr> <table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%"> 
    <tr> 
        <td class="tcat"> 
            <strong><span class="smallfont">$vba_options[portal_blockbullet] $vboptions[bbtitle]Features</strong></span> 
        </td> 
    </tr> 
</table> 
<table align="center" border="0" cellpadding="0" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%" height="600"> 
    <tr> 
        <td class="alt1"> 
        <div align="center"><iframe src="$vboptions[bburl]/modules/features.php" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></div> 
        </td> 
    </tr> 
</tbody> 
</table>
</table> 
<table align="center" border="0" cellpadding="0" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%" height="600"> 
    <tr> 
        <td class="alt1"> 
        <div align="center"><iframe src="$vboptions[bburl]http://s116946478.onlinehome.us/vb/modules/features.php" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></div> 
        </td> 
    </tr> 
</tbody> 
</table>
I wasn't sure how to include the features.php module without using an iframe, and I think that's what is causing the problems. By the way, thanks for everyones input so far.
Reply With Quote
  #10  
Old 03-21-2005, 09:21 PM
Deaths Deaths is offline
 
Join Date: Oct 2004
Location: Europe, Belgium
Posts: 679
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Sorry, the board is unavailable at the moment while we are testing some functionality.

We will be back soon...
You can add it as a module, then let the file call the template...
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 07:27 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.04021 seconds
  • Memory Usage 2,265KB
  • 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
  • (2)bbcode_code
  • (2)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete