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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-23-2011, 05:02 AM
zeroality zeroality is offline
 
Join Date: Jul 2006
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default creating a custom plugin for news on header but not working

I searched for a few terms but couldn't really find anything helpful. I've been trying for the past couple hours trying to get this to work. I'm trying to pull thread information from the latest one posted in our News forum and display bits of it in the HEADER template.

I've also tried putting the same code in FORUMHOME template in case it was something associated with the hook I chose but still does not work. I did something very similar to this on vBulletin 3.x (used the plugin code and called it via $news1_title, etc) but seems I'm missing something here.

Also would like to note that this is pretty much ripped straight from my external news script, which I posted here for viewing (since I'm not using it on the site atm): http://pokemontopaz.net/sandbox/

Plugin code (using forumhome_complete hook):
Code:
$postchars = 250;

 $news1 = $db->query_first('SELECT title,threadid,views,replycount,postusername,postuserid,dateline FROM ' . TABLE_PREFIX . 'thread WHERE 1 AND forumid = 4 ORDER BY dateline DESC  LIMIT 0 , 1');
 $news1_title = "<a href=\"forums/showthread.php?"  . $vbulletin->session->vars['sessionurl'] . "t=$news1[threadid]\">$news1[title]</a>";
 $news1_readmore = "<a href=\"forums/showthread.php?"  . $vbulletin->session->vars['sessionurl'] . "t=$news1[threadid]\">[Read More]</a>";
 $news1_comment = "<a href=\"forums/newreply.php?do=newreply&noquote=1&"  . $vbulletin->session->vars['sessionurl'] . "t=$news1[threadid]\">[Post Comment]</a>";
 $news1_replies = "$news1[replycount]";
 $news1_views = "$news1[views]";
 $news1_post = $db->query_first('SELECT pagetext FROM ' . TABLE_PREFIX . 'post WHERE 1 AND threadid = ' . $news1[threadid] . ' ORDER BY dateline ASC  LIMIT 0 , 1');
 $news1_postfull = "$news1_post[pagetext]";
 $news1_postshort = substr($news1_post[pagetext],0,$postchars);
 $news1_date = vbdate($vbulletin->options['dateformat'], $news1['dateline']);
 $news1_time = vbdate($vbulletin->options['timeformat'], $news1['dateline']);
 $news1_posturl = "<a href=\"forums/member.php?" . $news1[postuserid] . "\">" . $news1[postusername] . "</a>";
Code in header template:
Code:
  <div id="lugianewscontent">
    <h3>$news1_title by $news1_posturl on $news1_date</h3>
    <p>$news1_postshort... [$news1_readmore]</p>
    <p>Replies: $news1_replies - Views: $news1_views $news1_comment</p>
  </div>
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:20 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.03400 seconds
  • Memory Usage 2,194KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.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_threaded
  • showthread_threaded_construct_link
  • 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