Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. <?php
  2. switch ($requiredVar) {
  3. case "brand":
  4. $brandFieldsArray = $dbA->retrieveAllRecordsFromQuery("select * from tableFields where type='X' and visible=1");
  5. $result = $dbA->query("select bID from tableItems where iID = $x");
  6. if ($dbA->count($result) != null) {
  7. $thisrecord = $dbA->fetch($result);
  8. $bID = $thisrecord["bID"];
  9. } else {
  10. $bID = null;
  11. }
  12. $bQuery = $dbA->query("select * from tableB where bID=$bID");
  13. $theBrandArray = $dbA->retrieveAllRecordsFromQuery($bQuery);
  14. $bcCount = count($theBrandsArray);
  15. $brandContentArray = null;
  16. foreach ((array) $theBrandArray as $brandContent) {
  17. $allBrandFields = "";
  18. if (is_array($brandFieldsArray)) {
  19. $cc = count($brandFieldsArray);
  20. foreach ($brandFieldsArray as $brField) {
  21. $thisBrandField = $brField;
  22. switch ($thisBrandField["fieldtype"]) {
  23. case "TEXT":
  24. case "TEXTAREA":
  25. case "IMAGE":
  26. if ($thisBrandField["fieldtype"] == "IMAGE") {
  27. if ($brandContent["brandfield".$brField["fieldname"]] == "") {
  28. $thisBrandField["content"] = $brfield["defaultimage"];
  29. } else {
  30. $thisBrandField["content"] = $brandContent["brandfield".$brField["fieldname"]];
  31. }
  32. $thisField = generateImageVariables($brField["x"],$brField["y"]);
  33. $thisBrandField["style"] = $thisField["style"];
  34. $thisBrandField["stylefull"] = $thisField["stylefull"];
  35. } else {
  36. $brandContent["brandfield".$brField["fieldname"]] = findCorrectLanguage($brandContent,"brandfield".$brField["fieldname"]);
  37. if (retrieveOption("convertToBR") == 1 && retrieveOption("WYSIWYGEnabled") == 0) {
  38. $thisBrandField["content"] = str_replace("rn","<br/>",$brandContent["brandfield".$brField["fieldname"]]);
  39. } else {
  40. $thisBrandField["content"] = $brandContent["brandfield".$brField["fieldname"]];
  41. }
  42. }
  43. break;
  44. }
  45. $brandContent[$brField["fieldname"]] = @$thisBrandField;
  46. }
  47. if (is_array($allBrandFields)) {
  48. $brandContent["brandfields"] = $allBrandFields;
  49. } else {
  50. $brandContent["brandfields"] = null;
  51. }
  52. }
  53. $brandContentArray[] = $brandContent;
  54. }
  55. return ($type != "m") ? $brandContentArray[0] : $brandContentArray;
  56. }
  57. $tpl->addVariable("brand",$brandContentArray);
  58. break;
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement