vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Translating PHP to vB specifications (https://vborg.vbsupport.ru/showthread.php?t=227589)

Anthony_RuBeZ 11-08-2009 06:41 AM

Translating PHP to vB specifications
 
Hi I've been using vB for a while now, while coding on the side I never got up the courage to ask for help on how to incorporate my style of coding with vB.
I learn best by visual representation and I was wondering if someone could a snippet of an example code that I provide, and rebuild it so that it fits the qualifications of vB.
Actually several little codes so that I can get the gist of how to do it myself, anyway here are the examples I need to be shown to translate into vB:


Code:

$query = "SELECT * FROM ".$prefix."users WHERE username='$loggedinname'";

$result = mysql_query($query);

$num = mysql_numrows($result);



//Loop out code

$i=0;

while ($i < 1) {



$newmessagenotify=@mysql_result($result,$i,"newmessagenotify");

$website=@mysql_result($result,$i,"website");



$website = stripslashes($website);


$i++;

}

I am trying to pick out codes that I know I need to use I need to make sure that I know how to write them correctly.

I realize my style of PHP is far from the effenciency that vB uses, which is why I am having so much trouble grasping it without visual representation.




Code:

    $act=$_REQUEST["act"];
    $action=$_REQUEST["action"];

    if($act=="changesettings" and $action==""){ $action="";}





       

        if($act=="changesettings" and $action=="1"){

        <a href='?act=changesettings&action=1'><b>Profile Design</b></a>-
        <a href='?act=changesettings&action=2'>Contact Info</a>-
        <a href='?act=changesettings&action=3'>Personal Info</a>-
        <a href='?act=changesettings&action=4'>Display Pictue</a>
        <a href='?act=changesettings&action=5'>Friends</a>-
        <a href='?act=changesettings&action=6'>Signature</a>
}
        elseif($act=="changesettings" and $action=="2"){


        <a href='?act=changesettings&action=1'>Profile Design</a>-
        <a href='?act=changesettings&action=2'><b>Contact Info</b></a>-
        <a href='?act=changesettings&action=3'>Personal Info</a>-
        <a href='?act=changesettings&action=4'>Display Pictue</a>
        <a href='?act=changesettings&action=5'>Friends</a>-
        <a href='?act=changesettings&action=6'>Signature</a>

<form name='form1' method='post' action='accountpost.php'>
  <p>Forum signature, a max character limit of 800 is in effect:<br />

    <textarea name='signature' type='text' id='signature' cols='40' rows='3'>".$signature."</textarea><br>
    <input name='act' type='hidden' id='act' value='changesettings'>
    <input name='action' type='hidden' id='action' value='6'>
</p>

  <p>

    <input type='submit' name='Submit' value='Submit Details'>

  </p>



</form>
       



        }

        elseif($act=="changesettings" and $action==""){



        <a href='?act=changesettings&action=1'>Profile Design</a>-
        <a href='?act=changesettings&action=2'>Contact Info</a>-
        <a href='?act=changesettings&action=3'>Personal Info</a>-
        <a href='?act=changesettings&action=4'>Display Pictue</a>
        <a href='?act=changesettings&action=5'>Friends</a>-
        <a href='?act=changesettings&action=6'>Signature</a>



        }

Again I am trying to see how to translate the common things. Any suggestions that you can offer would be helpfull, I learn quickly and I like to try and teach myself but I also know when I am in above my head. So I am seeking help.

Lynne 11-08-2009 04:14 PM

For queries, instead of:
PHP Code:

$result mysql_query($query);
$num mysql_numrows($result); 

Do this:
PHP Code:

$result $db->query_read($query);
$num $db->num_rows($result); 

I have found the best thing to do to learn this stuff is to take a look at the articles and also download a few modifications and see how the developer did things there.

Anthony_RuBeZ 11-10-2009 12:48 AM

@Lynne - Your help is appreciated.

As I mentioned before, I work best with visual representation. If there are any coders out there experienced enough with working with vB, please PM if you can help this new comer get started. I can't do this properly if I don't have someone who can answer my questions and better understand the coding that goes with vBulletin. All help is appreciated.


All times are GMT. The time now is 08:02 AM.

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.01077 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete