I?m only happy when it rains
I?m only happy when it?s complicated
And though I know you can?t appreciate it
I?m only happy when it rains
You know I love it when the news is bad
Why it feels so good to feel so sad
I?m only happy when it rains
This is the basic code. Its already password protected, so if you create a myscript.php with that code and upload to the "admincp" folder, you can call it from a browser and it will ask for the admin password.
You can use "ignore_user_abort(true);" as described in this post.
You can use can_administer() to check for admin permissions, 'canadminstyles' in this case:
(to-do: describe print_cp_header() optional parameters title, onload, headinsert, marginwidth and bodyattributes defined in adminfunctions.php)
You can put anything you like inside the html page. vBulletin has a good number of standard functions that builds the html code for you. These functions can be found in "admincp/adminfunctions.php" (thanks Zero Tolerance for pointing it out). Im going to describe them in this how-to as time lets me.
Creating a message box with a "go back" link:example image
PHP Code:
print_cp_message('This is a control panel message box.');
An empty "print_table_footer" adds a "</form>" after closing the table.
Function "print_table_footer" parameters (from adminfunctions.php)
Quote:
Prints a closing table tag and closes the form tag if it is open
* colspan integer Column span of the optional table row to be printed
* rowhtml string If specified, creates an additional table row with this code as its contents
* tooltip string Tooltip for optional table row
* echoform boolean Whether or not to close the <form> tag
function print_table_footer( colspan, rowhtml, tooltip, echoform )
Creating a form:
vBulletin has standard functions to build forms. You call "print_form_header()", which opens the form and table tags, call a few functions to build the form inputs, and then close the form with a submit button row.
Function "print_form_header" parameters (from adminfunctions.php)
Quote:
Prints the standard form header, setting target script and action to perform
* phpscript string PHP script to which the form will submit (ommit file suffix)
* do string 'do' action for target script
* uploadform boolean Whether or not to include an encoding type for the form (for file uploads)
* addtable boolean Whether or not to add a <table> to give the form structure
* name string Name for the form - <form name="$name" ... >
* width string Width for the <table> - default = '90%'
* target string Value for 'target' attribute of form
* echobr boolean Whether or not to place a <br /> before the opening form tag
* method string Form method (GET / POST)
Here I'll use common examples, but each function has a set of parameters that should be read in "admincp/adminfunctions.php" if you are going to use them.
i need insert a field for file upload (in admincp custom page)
so, what code do i use (let it show browser button)
it upload into database as blob stype
i already tried print_input_row but it's missing a browser button (unable to load file from computer)
any help or suggestion will be appreciated
Sincerely,
Never mind, i found it from images.php
it uses the code as
Code:
print_upload_row("upload file", 'images');
hope someone needed .... but that for the template in admincp page .... about coding for file upload that it's up to you or you own your way )