How to get sitemap URLs?

In this example, we will read the list of non-disabled URLs of news pages and put it into the variable $TEST. We will then iterate through this list to print its elements.

Source Code

Please paste this code snippet into your template to see how it works.

Let's experiment with a template like tiny.news.feed/Themes/default/404.tpl by pasting code into it and then opening some non-existent page associated with that template.

<?php
    $TEST = $cms->getSitemap('news');
    $site = printSiteUrl(FALSE);
    foreach ( $TEST as $item ) {
        echo $site . $item['prefix'] . $item['url'] . ' <br>';
    }
?>

Note that the $cms variable is a system pointer to your web application. And getSitemap is a public method for reading non-disabled URLs. If you are interested in the algorithm of this method, look at the file tiny.news.feed/Application.php.

* This page is a demo post designed to display page content for testers. You need delete this page when you run the website in production mode.