nlozovan

Untitled

May 14th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1.  
  2. function xml_render(){
  3. $xml=simplexml_load_file(get_template_directory_uri()."/xml/airports.xml");
  4. $k = 0;
  5. $cities = array();
  6. foreach ($xml as $key => $value) {
  7. echo '<pre>';
  8. // var_dump($key);
  9. echo '</pre>';
  10. echo '<pre>';
  11.  
  12. $city_ru = (array)$value->city_rus;
  13. $city_en = (array)$value->city_eng;
  14.  
  15.  
  16. // var_dump($city_ru[0]);
  17. echo '</pre>';
  18.  
  19. $cities[$k]['rus'] = $city_ru[0];
  20. $cities[$k]['eng'] = $city_en[0];
  21.  
  22. // if ($k == 100) break;
  23.  
  24. $k++;
  25. }
  26.  
  27. echo '<pre>';
  28. // var_dump($cities);
  29. echo '</pre>';
  30.  
  31. $clean = array();
  32.  
  33. $clean = array_unique($cities, SORT_REGULAR);
  34.  
  35. $clean_num = array();
  36.  
  37. foreach ($clean as $key => $value) {
  38. array_push($clean_num, $clean[$key]);
  39. }
  40.  
  41.  
  42.  
  43.  
  44. echo '<pre>';
  45. // var_dump($clean_num);
  46. echo '</pre>';
  47.  
  48. $start = 0;
  49. $finish = 500;
  50. $next = 500;
  51. $previous = 0;
  52.  
  53.  
  54. if (isset($_GET['nextvisible']) && is_numeric(intval($_GET['nextvisible'])) ) {
  55. $next = intval($_GET['nextvisible']) + 500;
  56. $start = intval($_GET['nextvisible']);
  57. $finish = intval($_GET['nextvisible']) + 500;
  58. }
  59.  
  60.  
  61. for ($n=$start; $n < $finish; $n++) {
  62. echo '<div>---'.$n . ' - '. $clean_num[$n]['eng'] .'</div>';
  63. }
  64.  
  65.  
  66.  
  67. echo '<a href="admin.php?page=cosmothemes__general&prevvisible='.$previous.'" class="prev-snippet"> << PREVIOUS 500 </a><a href="admin.php?page=cosmothemes__general&nextvisible='. $next .'" class="next-snippet">NEXT 500 >> </a>';
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment