Import php array into pod table, wordpress


/ Published in: PHP
Save to your folder(s)

Function to import array of php data to pod table


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. $data = array(
  4. "Performance Coaching",
  5. "Principal Responsibilities of Leadership",
  6. "Strategic Performance Template",
  7. "Team Performance Compact",
  8. "Team Performance One",
  9. "Management Performance Compact",
  10. "Management Performance One",
  11. "Leadership Performance Compact",
  12. "Leadership Performance One",
  13. "Executive Performance Compact",
  14. "Executive Performance One",
  15. "How to Advance the Performance of a Team",
  16. "Performance Coaching",
  17. "Principal Responsibilities of Leadership",
  18. "Strategic Performance Template",
  19. "Team Performance Compact",
  20. "Team Performance",
  21. "Sales Performance Compact",
  22. "Sales Performance",
  23. "Sales Manager Compact",
  24. "Sales Manager",
  25. "Management Performance Compact",
  26. "Management Performance",
  27. "Leadership Performance Compact",
  28. "Leadership Performance",
  29. "Executive Performance Compact",
  30. "Executive Performance",
  31. "How to Advance the Performance of a Team",
  32. "Performance Coaching",
  33. "Pro-Sport compact",
  34. "Pro Sport",
  35. "Advanced Performer",
  36. "Performance Coaching",
  37. "The Principal Responsibilities of Coaching",
  38. "Pro-Sport Coach compact",
  39. "Pro-Sport Coach",
  40. "How to Advance the Performance of an Athlete"
  41. );
  42.  
  43.  
  44. //$data_new = array();
  45. $i = 0;
  46.  
  47. foreach($data as $d){
  48. //echo $d;
  49. $data_new[$i] = array(
  50. "name" => $d,
  51. "ref" => "",
  52. "bpm" => "",
  53. "dpm" => "",
  54. "info_pack" => "",
  55. "tdm" => "",
  56. "description" => ""
  57. );
  58. $i++;
  59. }
  60.  
  61. echo "<pre>";
  62. print_r($data_new);
  63. echo "</pre>";
  64.  
  65. $api = new PodAPI('programme_content', 'php');
  66. $api->import($data_new);
  67.  
  68.  
  69.  
  70. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.