Site Builder
Editing:
updateukk.php
writable 0666
<?php // Adjust to the path where your geo folders start: $root = dirname(__DIR__) . '/USA'; // "/home/onlinemortgage/public_html/geo/USA" // Templates source: $pages = __DIR__; $cityIndexSrc = "$pages/city-index.php"; $stateIndexSrc = "$pages/state-index.php"; $bizSrc = "$pages/business.php"; // Find states $states = glob("$root/*", GLOB_ONLYDIR); foreach ($states as $stateFolder) { // Copy state index to state folder $stateIndexDest = "$stateFolder/index.php"; if (file_exists($stateIndexSrc)) { copy($stateIndexSrc, $stateIndexDest); echo "Copied state index to: $stateIndexDest\n"; } // For every city folder in this state: $cities = glob("$stateFolder/*", GLOB_ONLYDIR); foreach ($cities as $cityFolder) { $cityName = basename($cityFolder); // e.g., indian-rocks-beach // 1. Copy city index $cityIndexDest = "$cityFolder/index.php"; copy($cityIndexSrc, $cityIndexDest); echo "Copied city index to: $cityIndexDest\n"; // 2. Copy business.php $bizDest = "$cityFolder/business.php"; copy($bizSrc, $bizDest); echo "Copied business.php to: $bizDest\n"; // 3. Copy/rename JSON $jsonSrc = "$pages/city-name-biz-list.json"; $jsonDest = "$cityFolder/{$cityName}-biz-list.json"; if (file_exists($jsonSrc)) { copy($jsonSrc, $jsonDest); echo "Copied JSON to: $jsonDest\n"; } else { // Fallback: find any JSON with "city" in the name $jsons = glob("$pages/*-biz-list.json"); foreach ($jsons as $cand) { if (basename($cand, '-biz-list.json') == $cityName) { copy($cand, $jsonDest); echo "Copied JSON to: $jsonDest\n"; break; } } } } } echo "Done.\n";
Save changes
Create folder
writable 0777
Create
Cancel