Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function xml_render(){
- $xml=simplexml_load_file(get_template_directory_uri()."/xml/airports.xml");
- $k = 0;
- $cities = array();
- foreach ($xml as $key => $value) {
- echo '<pre>';
- // var_dump($key);
- echo '</pre>';
- echo '<pre>';
- $city_ru = (array)$value->city_rus;
- $city_en = (array)$value->city_eng;
- // var_dump($city_ru[0]);
- echo '</pre>';
- $cities[$k]['rus'] = $city_ru[0];
- $cities[$k]['eng'] = $city_en[0];
- // if ($k == 100) break;
- $k++;
- }
- echo '<pre>';
- // var_dump($cities);
- echo '</pre>';
- $clean = array();
- $clean = array_unique($cities, SORT_REGULAR);
- $clean_num = array();
- foreach ($clean as $key => $value) {
- array_push($clean_num, $clean[$key]);
- }
- echo '<pre>';
- // var_dump($clean_num);
- echo '</pre>';
- $start = 0;
- $finish = 500;
- $next = 500;
- $previous = 0;
- if (isset($_GET['nextvisible']) && is_numeric(intval($_GET['nextvisible'])) ) {
- $next = intval($_GET['nextvisible']) + 500;
- $start = intval($_GET['nextvisible']);
- $finish = intval($_GET['nextvisible']) + 500;
- }
- for ($n=$start; $n < $finish; $n++) {
- echo '<div>---'.$n . ' - '. $clean_num[$n]['eng'] .'</div>';
- }
- 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>';
- }
Advertisement
Add Comment
Please, Sign In to add comment