| [ Index ] |
PHP Cross Reference of Drupal 6 (heimberg) |
[Summary view] [Print] [Text view]
1 <?php 2 3 function sqlInputText($text) 4 { 5 return ereg_replace("'", "\'", $text); 6 7 } 8 9 function sqlOutputText($text) 10 { 11 return ereg_replace('"', "'", $text); 12 } 13 14 15 require_once ('DbLib-12.php'); 16 17 //Creates a drop down list that looks like: 18 19 // Category 20 // - SubCategory 21 // - SubCategory 22 // Category 23 // Cateory 24 25 function createCategoryDropDownListItems($parent = null) 26 { 27 $dbListCat = &new DbLibMySQL; 28 $dbListCat->OpenConnection(); 29 $dbSubsList = &new DbLibMySQL; 30 $dbSubsList->OpenConnection(); 31 $sqlCat = "SELECT id, name FROM category WHERE parentCatId is null ORDER BY name"; 32 $dbListCat->Query($sqlCat); 33 34 $dropDownList = ""; 35 while($dbListCat->GetNextRecord()) { 36 $dropDownList = $dropDownList . '<option value="' . $dbListCat->GetField('id') . '"'; 37 if($parent == $dbListCat->GetField('id')){ 38 $dropDownList = $dropDownList . " selected"; 39 } 40 $dropDownList = $dropDownList . '>' . strtoupper($dbListCat->GetField('name')) . '</option>'; 41 42 $sqlSubsList = "select id, name from category where parentCatId = ". $dbListCat->GetField('id')." order by name"; 43 $dbSubsList->Query($sqlSubsList); 44 45 while($dbSubsList->GetNextRecord()) { 46 $dropDownList = $dropDownList . '<option value="' . $dbSubsList->GetField('id') . 47 '"> - ' . $dbSubsList->GetField('name') . '</option>'; 48 } 49 } 50 51 return $dropDownList; 52 53 } 54 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 23 13:22:29 2011 | Cross-referenced by PHPXref 0.7 |