Nothing fancy or special here, just a little tool that I needed as I launched a new site and thought I would share it.
Code: Select all
<?php
################################################################
# Simple program to make a sitemap.txt file from wCMS menuItems.
# Authored Jan-2020 by Lester Hightower
#
# To use, set $BASE_URL as needed for your site, then from the root of
# the wCMS install (location of index.php) run:
#
# prompt> php make_sitemap.php > sitemap.txt
################################################################
const PHPUNIT_TESTING = true; # Prevents normal www behavior
include 'index.php'; # when index.php is included.
$Wcms = new Wcms();
$Wcms->init();
$BASE_URL = 'https://your-site.com';
$output = array( $BASE_URL );
foreach ($Wcms->get('config', 'menuItems') as $item) {
if ($item->visibility === 'hide') {
continue;
}
array_push($output, $BASE_URL . '/' . $item->slug);
}
print join("\n", $output);
?>