Jon P.
11-01-2001, 10:00 PM
The following minor code and template modifications will allow Planetweb browser users to actively participate in your vBulleitn forums. The Planetweb browser is a small-footprint browser suite used in several internet devices, including the Sega Dreamcast and Sony PlayStation 2 videogame consoles. As an operator of a site that specifically caters to gamers that use their consoles to access the Internet, I've found it necessary to modify vBulletin to make it as compatible as possible with the Planetweb browser. If you expect any Planetweb users to visit your forums you will want to make the modifications below.
1) The first thing you'll want to do is configure a textarea value for the Planetweb browser. Because it's designed to output to a television screen, the Planetweb browser makes fonts and form objects larger than you're used to seeing in PC browsers. The vBulletin default textarea of 60 columns will require a Planetweb user to horizontally scroll to view the entire input area when filling out forms. Changing this to 37 columns will require no horizontal scrolling from the user.
Inside admin/functions.php, Find:
} elseif (eregi("Mozilla/4.",$HTTP_USER_AGENT)) { // browser is NS4
return "50";
Directly below it add:
} elseif (eregi("Planetweb",$HTTP_USER_AGENT)) { // browser is Planetweb
return 37;
2) The "Code Buttons" and "Clicky Smilies" JavaScript goodies used in posting threads, replies, Private Messages, and calendar events don't work with the Planetweb browser. All they do is take up space and cause unnecessary horizontal scrolling, so you'll want to supress them for Planetweb users. To do this, we'll enclose the code inside the getcodebuttons and getclickysmilies functions inside an if statement that determines if the user is using a Planetweb browser.
Inside admin/functions.php, Find:
function getcodebuttons () {
Directly below it add:
global $HTTP_USER_AGENT;
if (!eregi("Planetweb",$HTTP_USER_AGENT)) {
Inside admin/functions.php, Find:
return $vbcode_buttons;
Directly below it add:
}
Also inside admin/functions.php, Find:
function getclickysmilies () {
Directly below it add:
global $HTTP_USER_AGENT;
if (!eregi("Planetweb",$HTTP_USER_AGENT)) {
Also inside admin/functions.php, Find:
} else {
return "";
}
Directly below it add:
}
3) If you've noticed, the message icons that are selectable on the new thread, reply, and Personal Message forms, are forcefully wrapped with a <br> tag after 7 icons are displayed (creating multiple rows of icons). On the Planetweb browser, the wrapping gets ugly. 5 icons are diplayed on one row (they wrap to the next row due to lack of space), and then on the next row only 2 icons are diplayed because the <br> tag after the 7th icon forces another wrap. So you get alternating rows of 5 icons and 2 icons. Forcing the wrap after 5 icons instead of 7 creates even rows for Planetweb users.
Inside admin/functions.php, Find:
if ($counter%7==0 and $counter!=0) {
Replace it with:
if ($counter%5==0 and $counter!=0) {
4) In the newreply, newthread, editpost, priv_forwardmultiple, priv_sendprivmsg, and priv_sendtobuddies templates the JavaScript validate(theform) function prevents Planetweb users from submitting the form (thus preventing them from posting new threads, replying, or sending Personal Messages). There's nothing wrong with JavaScript function but for some reason it isn't properly parsed by the Planetweb browser. To fix this, I've simply removed the offending code from the templates. This JavaScript function is merely a convenience that can be safely removed, as all form input is double checked by vBulletin.
The snippet to remove from the listed templates follows:
function validate(theform) {
if (theform.message.value=="") {
alert("Please complete the message field.");
return false; }
if (postmaxchars != 0) {
if (theform.message.value.length > $postmaxchars) {
alert("Your message is too long...");
return false; }
else { return true; }
} else { return true; }
}
That's it.
1) The first thing you'll want to do is configure a textarea value for the Planetweb browser. Because it's designed to output to a television screen, the Planetweb browser makes fonts and form objects larger than you're used to seeing in PC browsers. The vBulletin default textarea of 60 columns will require a Planetweb user to horizontally scroll to view the entire input area when filling out forms. Changing this to 37 columns will require no horizontal scrolling from the user.
Inside admin/functions.php, Find:
} elseif (eregi("Mozilla/4.",$HTTP_USER_AGENT)) { // browser is NS4
return "50";
Directly below it add:
} elseif (eregi("Planetweb",$HTTP_USER_AGENT)) { // browser is Planetweb
return 37;
2) The "Code Buttons" and "Clicky Smilies" JavaScript goodies used in posting threads, replies, Private Messages, and calendar events don't work with the Planetweb browser. All they do is take up space and cause unnecessary horizontal scrolling, so you'll want to supress them for Planetweb users. To do this, we'll enclose the code inside the getcodebuttons and getclickysmilies functions inside an if statement that determines if the user is using a Planetweb browser.
Inside admin/functions.php, Find:
function getcodebuttons () {
Directly below it add:
global $HTTP_USER_AGENT;
if (!eregi("Planetweb",$HTTP_USER_AGENT)) {
Inside admin/functions.php, Find:
return $vbcode_buttons;
Directly below it add:
}
Also inside admin/functions.php, Find:
function getclickysmilies () {
Directly below it add:
global $HTTP_USER_AGENT;
if (!eregi("Planetweb",$HTTP_USER_AGENT)) {
Also inside admin/functions.php, Find:
} else {
return "";
}
Directly below it add:
}
3) If you've noticed, the message icons that are selectable on the new thread, reply, and Personal Message forms, are forcefully wrapped with a <br> tag after 7 icons are displayed (creating multiple rows of icons). On the Planetweb browser, the wrapping gets ugly. 5 icons are diplayed on one row (they wrap to the next row due to lack of space), and then on the next row only 2 icons are diplayed because the <br> tag after the 7th icon forces another wrap. So you get alternating rows of 5 icons and 2 icons. Forcing the wrap after 5 icons instead of 7 creates even rows for Planetweb users.
Inside admin/functions.php, Find:
if ($counter%7==0 and $counter!=0) {
Replace it with:
if ($counter%5==0 and $counter!=0) {
4) In the newreply, newthread, editpost, priv_forwardmultiple, priv_sendprivmsg, and priv_sendtobuddies templates the JavaScript validate(theform) function prevents Planetweb users from submitting the form (thus preventing them from posting new threads, replying, or sending Personal Messages). There's nothing wrong with JavaScript function but for some reason it isn't properly parsed by the Planetweb browser. To fix this, I've simply removed the offending code from the templates. This JavaScript function is merely a convenience that can be safely removed, as all form input is double checked by vBulletin.
The snippet to remove from the listed templates follows:
function validate(theform) {
if (theform.message.value=="") {
alert("Please complete the message field.");
return false; }
if (postmaxchars != 0) {
if (theform.message.value.length > $postmaxchars) {
alert("Your message is too long...");
return false; }
else { return true; }
} else { return true; }
}
That's it.