Search the Community
Showing results for tags 'call'.
-
Hello All, I am trying to turn a PHP application I made about a year ago into a WordPress plugin. I'm reasonably new in the world of WordPress plugins and have what I think will be a simple question. My plugin creates a shortcode, and when the WordPress page with that short code on is loaded, the program calls a function and displays it. My question is, within that function, how do I create a link or button (or something else) which will run the chosen function. Here is what I mean: function welcome() { ?>Welcome. This is the first screen of the plugin. Click <a href="???">here</a> to register. } function register() { register here } How would I make the above piece of code work. My thanks in advance.
-
I have a dropdown menu created from javascript, so the onchange event should call a function called updateForBodyfittingoptions(). The thing here is that this function updateForBodyfittingoptions() should actually run dependent on a loop that is part of another function called UpdateDivision. So if I were to put the function UpdateBodyfitting directly within the loop of the other function updateSelectClothByDiv(division) then I get "Object Expected". Remember the onchange calls the UpdateBodyfitting function. Here is the code which I've shortened for purposes of posting on here, I've also attached the main php file with all the code just in case anyone wants to reference it. , the main function is "generateUpdateSelectClothByDiv", within this function are "updateForBodyfittingoptions" and "updateSelectClothByDiv(division)". Really appreciate any help I can get, thanks in advance. function generateUpdateSelectClothByDiv() { global $connect,$hriconnect,$division_array,$cloth_array,$lining_array,$lining_sleeve_array,$bodyfitting_array,$pantstyle_array,$veststyle_array,$glob_div; $indexdiv=1; $indexbody=1; //global $field1_array,$field2_array,$field4_array,$extras_array,$field5_array; // echo "\t\tdocument.pickDivision.bodyfitting.selectedIndex=-1;\n"; $cloth_numrows = 0; $clothArray = array(); $div_query = "SELECT distinct DIVISION, CLOTHDB FROM MTM_DIVISIONS_S ORDER BY CLOTHDB"; $div_result = oci_parse($connect,$div_query); oci_execute($div_result); while ($div_row = oci_fetch_array($div_result, OCI_ASSOC)) { $divArray[] = "{$div_row['CLOTHDB']}"; $divDivArray[] = "{$div_row['DIVISION']}"; } oci_free_statement($div_result); // print("//TEST\n\n"); echo "\tfunction updateSelectClothByDiv(division)\n"; echo "\t{\n"; $first = 0; echo "\tClearOptionsFastAlt('cloth');\n"; echo "\t\tdocument.pickDivision.textInput.value='';\n"; echo "var divcomp = division.replace(/^\s+|\s+$/g, '');"; //echo "alert(divcomp)"; for ($i = 0; $i < sizeof($divArray); $i++) { $cloth_query="SELECT CLOTH, CODE FROM ".$divArray[$i]." where CODE <>'OUT' or CODE is null ORDER BY cloth"; $cloth_result = oci_parse($connect,$cloth_query); oci_execute($cloth_result); $cloth_numrows = count_rows($connect,$cloth_query); $maxclothrows=$cloth_numrows+1; $bodyfitting_query="SELECT BODYFITTING, BFCODE FROM MTM_STYLES_S WHERE DIVISION= '".$divDivArray[$i]."' AND STYLE_TYPE='BODY' GROUP BY BODYFITTING, BFCODE ORDER BY BODYFITTING"; $bodyfitting_result = oci_parse($connect,$bodyfitting_query); oci_execute($bodyfitting_result); $bodyfitting_numrows = count_rows($connect,$bodyfitting_query); $maxclothrows=$bodyfitting_numrows+1; if($first == 0) { $first++; } else { echo "\telse\t"; } //echo "\talert('$divArray[$i]' +' '+ '$divDivArray[$i]'+' :aaa:' + divcomp);"; echo "\tif (divcomp == \"{$divDivArray[$i]}\") {"; $y=1; echo "var selectObj = document.pickDivision.cloth;\n"; echo "var numShown = selectObj.options.length;\n"; echo "selectObj.selectedIndex = -1;\n"; echo "\t\t\tselectObj.options[numShown] = new Option('- Select Cloth -', '');\n"; echo "\t\t\tnumShown++;\n"; while ($cloth_row = oci_fetch_array($cloth_result, OCI_ASSOC)) { $newCloth=$cloth_row['CODE']; $newStyle=$cloth_row['CLOTH']; echo "\t\t\tselectObj.options[numShown] = new Option('".$newStyle.' '.$newCloth."', '".$newStyle."');\n"; echo "\t\t\tnumShown++;\n"; $y++; } echo "\t\t\tdocument.pickDivision.cloth.options[0].selected = true;\n\n"; echo "\tClearOptionsFastAlt('lining');\n"; echo "\t\tdocument.pickDivision.textInput.value='';\n"; echo "var divcomp = division.replace(/^\s+|\s+$/g, '');"; echo "var selectObj = document.pickDivision.lining;\n"; echo "var numShown = selectObj.options.length;\n"; echo "selectObj.selectedIndex = -1;\n"; echo "\t\t\tselectObj.options[numShown] = new Option('- Select Lining -', '');\n"; echo "\t\t\tnumShown++;\n"; while ($lining_row = oci_fetch_array($lining_result, OCI_ASSOC)) { $newLining=$lining_row['CLOTH']; echo "\t\t\tselectObj.options[numShown] = new Option('".$newLining."' ,'".$newLining."');\n"; echo "\t\t\tnumShown++;\n"; $y++; } echo "\t\t\tdocument.pickDivision.lining.options[0].selected = true;\n\n"; //Setup new dropdown for Style Selection echo "\tClearOptionsFastAlt('bodyfitting');\n"; echo "\t\tdocument.pickDivision.textInput.value='';\n"; echo "var divcomp = division.replace(/^\s+|\s+$/g, '');"; echo "var selectObj = document.pickDivision.bodyfitting;\n"; echo "var numShown = selectObj.options.length;\n"; echo "selectObj.selectedIndex = -1;\n"; echo "\t\t\tselectObj.options[numShown] = new Option('- Select Style -', '');\n"; echo "\t\t\tnumShown++;\n"; while ($bodyfitting_row = oci_fetch_array($bodyfitting_result, OCI_ASSOC)) { $newBodyfitting=$bodyfitting_row['BODYFITTING']; $newBfcode=$bodyfitting_row['BFCODE']; $bodyfitArray[] = "{$bodyfitting_row['BFCODE']}"; $bodyfitbodyarray[]="{$bodyfitting_row['BODYFITTING']}"; echo "\t\t\tselectObj.options[numShown] = new Option('".$newBfcode.' '.$newBodyfitting."', '".$newBfcode."');\n"; echo "\t\t\tnumShown++;\n"; $y++; echo "\tfunction updateForBodyfittingoptions()\n"; echo "\t{\n"; echo "\t\tif(document.pickDivision.bodyfitting.options.value == '{$bodyfitting_row['BFCODE']} {$bodyfitting_row['BODYFITTING']}')\n"; echo "\t\t{\n"; //Show selection for front $field1_query = "SELECT MTM_STYLES_S.CODE,MTM_SUFFEX_S.TEXT FROM MTM_STYLES_S,MTM_SUFFEX_S WHERE MTM_SUFFEX_S.DIVISION='".$divDivArray[$i]."' AND (MTM_STYLES_S.FIELD=MTM_SUFFEX_S.FIELD AND MTM_STYLES_S.CODE=MTM_SUFFEX_S.CODE) AND MTM_STYLES_S.STYLE_TYPE='BODY' AND MTM_STYLES_S.BODYFITTING='".$bodyfitting_row['BODYFITTING']."' AND MTM_STYLES_S.FIELD=1 ORDER BY MTM_STYLES_S.FIELD,MTM_STYLES_S.CODE"; $field1_result = oci_parse($connect,$field1_query); oci_execute($field1_result); echo "\t\t\tdocument.pickDivision.field1.options[0].value = '';\n"; echo "\t\t\tdocument.pickDivision.field1.options[0].text = '- Select Frontaaa';\n\n"; $y=1; while ($field1_row = oci_fetch_array($field1_result, OCI_ASSOC)) { $newField1=$field1_row['TEXT']; $newField1Code=$field1_row['CODE']; $bodyfitArray[] = "{$bodyfitting_row['BFCODE']}"; $bodyfitbodyarray[]="{$bodyfitting_row['BODYFITTING']}"; echo "\t\t\tselectObj.options[numShown] = new Option('".$newField1Code.' '.$newField1."', '".$newField1Code."');\n"; echo "\t\t\tnumShown++;\n"; $y++; } echo "\t\t\tdocument.pickDivision.field1.options[0].selected=true;\n\n"; $indexfield1=1; oci_free_statement($field1_result); echo "\t\t}\n\n"; echo "\t\t}\n\n"; } echo "\t\t\tdocument.pickDivision.bodyfitting.options[0].selected=true;\n\n"; echo "\t}\n\n"; oci_free_statement($bodyfitting_result); $indexbody=1; oci_free_statement($cloth_result); } $indexdiv++; echo "\t\treturn true;\n"; echo "\t}\n\n"; oci_close($connect); } mtm.php
- 14 replies
-
- php
- javascript
-
(and 2 more)
Tagged with:
-
Hello everybody. First: Sory for my english. I'm searching a way to know wich lines of files are executed in all the request... Or something like that. Example: If we have this code: line 01: <?php line 02: function foo(){ line 03: echo 'Hello'; line 04: return false; line 05: } line 06: line 07: echo 'We are testing'; line 08: foo(); line 09: echo 'end of script'; line 10: ?> I need get the lines and the files executeds... For example, a log-file with this information: file index.php lines executeds: 07, 08, 02, 03, 04, 09, 10 Or something like that... I don't know... Anybody can help me? Tnks! Noel