vBulletin Modifications

[How-To] usefull admincp print_xxx functions

Welcome to vBHackers.com! - vBHackers Updates:

Go Back   vBulletin Modifications > General vBulletin Section > General vBulletin Support > vBulletin Modification Tutorials

Reply
 
LinkBack Thread Tools
Old 09-03-2006, 10:46 AM   #1
Coder
Idan's Avatar
Join Date: Feb 2005
Real Name: Idan
Location: Israel
Idan is on a distinguished road

Smile [How-To] usefull admincp print_xxx functions

In this tutorial i'll list & explan about some very common & usefull print_xxxxx functions that are builtin into vbulletin system. those can make you life much easier when trying to customize the admincp config screens.

note that desspite the fact a detailed description & params list for all of these functions can be found inside /includes/adminfunctions.php file that bundled in your copy of vbulletin, i think having a quick quide on this can be good & can bring knowledge to those who are not familer with those functions.

so lets start:
print_table_break()
parameters: can have optional 2 parameters in it:
param1 string Code to be inserted between the two tables
param2 string Width for the new table - default = '90%'
description: Prints out a closing table tag and opens another for page layout purposes. whenever you add new controls to existing admincp screen, use this function first.
code & screenshot of how this looks: not needed - just a spacer between 2 tables blocks.

print_table_header('title header')
parameters: 1 required, all the rest are optional:
param1 string Title for the row
param2 integer Number of columns to span
param3 boolean Whether or not to htmlspecialchars the title
param4 string Name for <a name=""> anchor tag
param5 string Alignment for the title (center / left / right)
param6 boolean Whether or not to show the help button in the row
description: Makes a column-spanning bar with a named <A> and a title, then reinitialises the background class counter.
code & screenshot of how this looks:
You must first be a registered member to view any code.


print_input_row('title','name','value')
parameters: 2 required, all the rest are optional:
param1 string Title for row
param2 string Name for input field
param3 string Value for input field
param4 boolean Whether or not to htmlspecialchars the input field value
param5 integer Size for input field
param6 integer Max length for input field
param7 string Text direction for input field
param8 mixed If specified, overrides the default CSS class for the input field
description: Prints a row containing an <input type="text" />
code & screenshot of how this looks:
You must first be a registered member to view any code.


print_yes_no_row('title','name','value')
parameters: 2 required, all the rest are optional:
param1 string Title for row
param2 string Name for radio buttons
param3 string Selected button's value
param4 string Optional Javascript code to run when radio buttons are clicked - example: ' onclick="do_something()"'
description: Prints a row containing 'yes', 'no' <input type="radio" / > buttons
code & screenshot of how this looks:
You must first be a registered member to view any code.


print_cp_header()
parameters: all are optional:
param1 string The page title
param2 string Javascript functions to be run on page start - for example "alert('moo'); alert('baa');"
param3 string Code to be inserted into the <head> of the page
param4 integer Width in pixels of page margins (default = 0)
param5 string HTML attributes for <body> tag - for example 'bgcolor="red" text="orange"'
description: prints admincp page header
code & screenshot of how this looks:
You must first be a registered member to view any code.
- starts admincp standart header, no screenshot needed.
Realted function: print_cp_footer() - same, just for footer (NO params are required)

print_form_header()
parameters: all are optional:
param1 string PHP script to which the form will submit (ommit file suffix)
param2 string 'do' action for target script
param3 boolean Whether or not to include an encoding type for the form (for file uploads)
param4 boolean Whether or not to add a <table> to give the form structure
param5 string Name for the form - <form name="$name" ... >
param6 string Width for the <table> - default = '90%'
param7 string Value for 'target' attribute of form
param8 boolean Whether or not to place a <br /> before the opening form tag
param9 string Form method (GET / POST)
description: prints form tags (action target) - in case you have custom script target to process this form, be sure to put it here (param1).
code & screenshot of how this looks:
You must first be a registered member to view any code.
no screenshot needed

that's it for those common functions. again there are few more out there, you can check the file for complete listing & declaration of them.

now some practical example: remember that it is handy to use vars for these controls that are built in into vbulletin. for example, if i were to add any new option for "per user" (lets assume for example called "my_field"), i would first add an extra filed under "user" table named "my_field" (via phpmyadmin for example), then would use for var name 'user[my_field]' for example: place line like:
You must first be a registered member to view any code.
into "useradmin_edit_column1" hook.
in addition don't forget to add code that saves it using vbulletin engine: just add line like:
You must first be a registered member to view any code.
into "userdata_start" hook.

that's it for this tutorial - hope you find it usefull enough for those who need quick start quide into admincp functions :classic:
__________________
Idan / vBHackers.com
vBSEO 3.1 GOLD Released vB Blogs Compatible | Non-Encrypted | Branding Removal Option | Sitemaps 2.1 | Language Packs

Crawlability Network: vBulletin SEO | vBulletin Hackers

Last edited by Idan; 09-03-2006 at 10:48 AM.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 09-03-2006, 10:50 AM   #2
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

Thanks for making a tutorial this will make other peoples lives eaiser.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-30-2006, 05:08 PM   #3
vB User
ninjamaster's Avatar
Join Date: Nov 2006
ninjamaster is on a distinguished road

Default

thanks nice work ;)




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[How To] set usernames in color/bold/italic GirlsOnTop vBulletin Modification Tutorials 17 05-13-2008 02:24 AM
[How to] Set User Titles Rex vBulletin Modification Tutorials 24 11-20-2007 05:25 PM
[How to] Add navigation groups to your admincp left panel Ken Iovino vBulletin Modification Tutorials 11 07-15-2007 11:59 PM
[How to] submit a press release Rex Growing Your vB Forum 1 06-19-2006 03:36 PM
[How To] How to in AdminCP Kiko General vBulletin Support 7 05-11-2006 05:14 AM


All times are GMT -3. The time now is 04:25 PM.


SEO by vBSEO 3.1.0 ©2007, Crawlability, Inc. (Patent Pending)