vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   How do I change the code of VB3 to VB4 (https://vborg.vbsupport.ru/showthread.php?t=264224)

uhking 05-26-2011 03:22 AM

How do I change the code of VB3 to VB4
 
Hi,

I would like to make the below plugin for vbulletin 4.1.2, can anybody tell me what to change in the code and what to use in the template instead of ($threadlist) to use the below plugin:
HTML Code:

$threadlist='';
$last_threads = $vbulletin->db->query("SELECT DISTINCT(threadid), title FROM " . TABLE_PREFIX . "thread ORDER BY rand() LIMIT 0,12");

while ($mthreads = $vbulletin->db->fetch_array($last_threads))
{

$threadlist.=  "<a href=\"showthread.php?t=$mthreads[threadid]\">".fetch_trimmed_title($mthreads[title])."</a><br />";

}


cellarius 05-26-2011 05:05 AM

Not tested, but I don't think you'll have to change the code. At first glance I see nothing that would not work with vB4.

You just need to register the variable $threadlist for any template you want to use it in.

Example for FORUMHOME:
PHP Code:

vB_Template::preRegister('FORUMHOME', array('threadlist' => $threadlist)); 

Then call it like that in FORUMHOME template:
HTML Code:

{vb:var threadlist}


All times are GMT. The time now is 10:29 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.01054 seconds
  • Memory Usage 1,711KB
  • 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
  • (2)bbcode_html_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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