Follow vBSEO on Twitter
vBulletin Modifications
  • Forums
  • Add-Ons
  • Template Modifications
  • Styles
  • Graphics
  • Tutorials
  • Support Center
  • Register
  • vBulletin SEO

Member Log In

Site Navigation

  • Register
  • Members List
  • Social Groups
  • Search
  • Today's Posts
  • Mark Forums Read

Latest Modifications

  • [vB 3.8.4] THX - Hack for VB. 3.8.4
    By: bluedog
  • [vB 3.8.4] Cyb - Chatbox V.2.3
    By: bluedog
  • [vB 4.0.x] PHPKD - Advanced Quick...
    By: PHPKD
  • [vB 3.6.x] StopSpam
    By: flappi282
  • [vB 3.8.x] vBulletin Chat Addon for...
    By: 123flashchat

Latest Template Mods

  • [vB 4.0.x] Remove My Profile Link...
    By: Ak Worm
  • [vB 3.8.x] Images DownloadBox...
    By: cRs!MP
  • [vB 3.8.x] Adviertise Mod On Forum...
    By: MG4
  • [vB 3.8.4] Images PassWordBox...
    By: cRs!MP
  • [vB 3.8.4] Footer Follow Ups
    By: Ak Worm

Latest Styles

  • [vB 4.0.x] 4.0.3 - VB4STYLE-TWEETA...
    By: Belon
  • [vB 4.0.x] [4.0.3] vbdesigns.de...
    By: Belon
  • [vB 3.8.4] CompletevB - Skylight
    By: DreadKnight
  • [vB 3.8.3] [vB 3.8.4] Barcelona...
    By: hoiquantinhoc.com
  • [vB 3.8.3] Natures Walk by vBSkin...
    By: Chri5

Latest Graphics

  • [vB ] [anim.]Team Ranks
    By: cRs!MP
  • [vB ] Abstract Circles (3...
    By: cRs!MP
  • [vB ] PlayStation Rank Images
    By: cRs!MP
  • [vB 3.6.12] Heavy Stroked Button...
    By: Shelley
  • [vB ] Minature Ranks.
    By: Shelley
vBulletin Modifications » General vBulletin Section » vBulletin Modification Tutorials » [How-To] usefull admincp print_xxx functions
Reply

 

  • Thread Tools
Old 09-03-2006, 01:46 PM   #1
Idan
Coder
Idan's Avatar

Activity Longevity
0/20 18/20
Today Posts
0/3 sssss1484
Location: Israel
Age: 29
Idan is on a distinguished road
Status: Offline [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:
PHP Code:
print_table_header('My Table Header'); 


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:
PHP Code:
print_input_row('my sample input line', 'var_name', $var_name); 


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:
PHP Code:
print_yes_no_row('my sample yes/no input', 'var_name', $var_name); 


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:
PHP Code:
print_cp_header(); 
- 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:
PHP Code:
print_form_header('my_script.php', 'my_action',0,1,'my_form_name',,,,'post') 
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:
PHP Code:
print_input_row('bla bla some text describing my field', 'user[my_field]', $user['my_field']); 
into "useradmin_edit_column1" hook.
in addition don't forget to add code that saves it using vbulletin engine: just add line like:
PHP Code:
$this->validfields['my_field'] = array(TYPE_STR, REQ_NO); 
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:
Regards,
Idan.

* Support will only be given via forums !
* If this post solved/aided your problem, please click "mark as aid" / "mark as solution" as explained in here

Last edited by Idan; 09-03-2006 at 01:48 PM.
Reply With Quote
Old 09-03-2006, 01:50 PM   #2
Nick R
vBulletin Guru

Nick R's Avatar

Activity Longevity
0/20 14/20
Today Posts
0/3 sssss4450
Location: Cyberspace, UK
Age: 30
Nick R is on a distinguished road
Send a message via MSN to Nick R Send a message via Yahoo to Nick R
Status: Offline Default
Thanks for making a tutorial this will make other peoples lives eaiser.
Reply With Quote
Old 11-30-2006, 08:08 PM   #3
ninjamaster
vB User

ninjamaster's Avatar

Activity Longevity
0/20 12/20
Today Posts
0/3 sssssss71
ninjamaster is on a distinguished road
Status: Offline Default
thanks nice work
Reply With Quote
Old 08-10-2009, 01:05 PM   #4
KoD
vB Newbie

Activity Longevity
0/20 4/20
Today Posts
0/3 ssssssss2
KoD is on a distinguished road
Status: Offline Default
Great work as always

keep the hard work up
Reply With Quote
Old 09-11-2009, 06:57 AM   #5
lovely09
vB Newbie

Activity Longevity
0/20 3/20
Today Posts
0/3 sssssss10
lovely09 is on a distinguished road
Status: Offline Default
Yeah,always provide the best and accurate tutorial ever.Save it again and used as a reference in the future.
Reply With Quote

Reply

« Photoshop Toolbox Explained | [FAQ] Change the Postbit »

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

 
Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

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

Forum Rules

Similar Threads
Thread Thread Starter Forum Replies Last Post
[How To] set usernames in color/bold/italic GirlsOnTop vBulletin Modification Tutorials 19 11-28-2009 05:35 PM
[How to] Set User Titles Rex vBulletin Modification Tutorials 24 11-20-2007 08:25 PM
[How to] Add navigation groups to your admincp left panel Ken Iovino vBulletin Modification Tutorials 11 07-16-2007 02:59 AM
[How to] submit a press release Rex Growing Your vB Forum 1 06-19-2006 06:36 PM



All times are GMT. The time now is 05:18 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.
Transverse Styles
  • Top
  • Archive
  • vBSEO
  • Contact Us
LinkBack
LinkBack URL LinkBack URL
About LinkBacks About LinkBacks
Bookmark & Share
Digg this Thread! Digg this Thread!
Add Thread to del.icio.us Add Thread to del.icio.us
Bookmark in Technorati Bookmark in Technorati
Furl this Thread! Furl this Thread!