View Single Post
  #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
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01215 seconds
  • Memory Usage 1,782KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete