Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 11-08-2009, 06:41 AM
Anthony_RuBeZ Anthony_RuBeZ is offline
 
Join Date: Jan 2009
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 11-08-2009, 04:14 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 11-10-2009, 12:48 AM
Anthony_RuBeZ Anthony_RuBeZ is offline
 
Join Date: Jan 2009
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@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.
Reply With Quote
Reply

Thread Tools
Display Modes

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

Forum Jump


All times are GMT. The time now is 11:01 PM.


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.06279 seconds
  • Memory Usage 2,180KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete