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 08-13-2007, 05:34 PM
nascimbeni nascimbeni is offline
 
Join Date: Aug 2006
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How do I make a vbulletin plugin ?

How do I 'make' a plug in ?
Sorry I did not grasp how vbulletin works yet.
On the top of my forum ( next to the logo ) at http://my.lifeinitaly.com
I want to add a piece of php code that selects 4 / 5 random images. I hove the code and it works : you can see the images here
http://my.lifeinitaly.com/images.php ( the code is below ) - I need then to add something to the header template but what and how ?
I could not find any instruction on how to built a plugin

<?php
$host = 'localhost';
$dbUser = '';
$dbPass = '';
$db = 'photopost';
mysql_connect("$host", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());
$result = mysql_query("SELECT id,cat,bigimage,width,height FROM pp_photos WHERE storecat = '0' and width > height ORDER BY rand() LIMIT 6" ) or die(mysql_error());
$imgs1='';
while($row = mysql_fetch_array( $result )) {
$imgs1 = $imgs1 . "<a href=\"/photopost/showphoto.php?photo=" . $row['id'] . "\"><img width=105 height=75 src=\"/photopost/data/" . $row['cat'] . "/thumbs/" . $row['bigimage'] . "\" border=\"0\"></a>";

}
print $imgs1;
?>
Reply With Quote
  #2  
Old 08-13-2007, 08:38 PM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How to make a plugin instructions can be found on this board. Do a bit of searching. Really, you just did the equivalent of logging onto a php site and asking "how do I code in php?"

Here is a couple of pointers...

If you import global.php into your script you have access to the $vbulletin object, including the $vbulletin->db object which is already connected to your database and comes with a bunch of helper functions

vbulletin uses a template system, which means it separates php and html. It is rare you concatenate some html and print it, much more likely you eval template.

Do some research, ask a specific question.
Reply With Quote
  #3  
Old 03-09-2009, 01:02 PM
cbiweb cbiweb is offline
 
Join Date: May 2004
Location: Nova Scotia, Canada
Posts: 238
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Eikinskjaldi View Post
How to make a plugin instructions can be found on this board. Do a bit of searching.
Can you direct me (and anyone else) to where it is? I tried searching and got pages of results that do not take me where I want to go. (and I didn't even find this thread by searching here, I got from Google! )

I tried searching the following:
- make plugin
- how do i make a plugin
- plugin
- vbulletin plugin

All I get is pages and pages of mods, articles or programming discussions that tell me everything except how to make a plugin. So when someone does search around here for how to make a plugin, he gets no help. Since you seem to know where to find it, how about helping by telling? Please?
Reply With Quote
  #4  
Old 03-09-2009, 01:09 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In the manual: Plugin System
And in our Articles section.
Reply With Quote
  #5  
Old 03-09-2009, 01:31 PM
cbiweb cbiweb is offline
 
Join Date: May 2004
Location: Nova Scotia, Canada
Posts: 238
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, the vB manual is a good resource, and I'm guessing there isn't a standalone article that explains it? At least you pointed me in the right direction. Thanks.
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 08:14 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.03523 seconds
  • Memory Usage 2,198KB
  • 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_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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_postinfo_query
  • fetch_postinfo
  • 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