HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/topswtwmobile.komma.pro/app/controllers/SitemapController.php
<?php

/**
 * Short description for the file.
 *
 * @author      Tim Van Samang <timvansamang@komma.pro>
 * @copyright   (c) 2012-2015, Komma Mediadesign
 */

use KommaApp\Shop\Sitemap\SitemapService;

class SitemapController extends \BaseController
{
    /**
     * @var RouteService
     */
    private $sitemapService;

    public function __construct(SitemapService $sitemapService)
    {
        $this->sitemapService = $sitemapService;

    }


    /**
     * This will generate the sitemap xml
     * and return this with xml header
     *
     * @return Xml
     */
    public function generateXml()
    {
        //Get the sitemapClass with the default settings
        $sitemap = $this->sitemapService->getSitemap();
        //return the sitemap renderded as xml (headers are also generated)
        return $sitemap->render('xml');
    }

    /**
     * This method will generate the sitemap
     * And return this as an html page
     *
     * @return View
     */
    public function showPage(){

        //Load the sitemap with the given parameters
        $sitemap = $this->sitemapService->getSitemap(['pages','categories'],0.5,false, false);
        //Get the sitemap items (raw)
        $items =  $sitemap->model->getItems();

        //return the view with the raw items and a static Title
        return \View::make( viewPrefix() . 'pages.sitemap')
            ->with([
                'title' => 'Sitemap',
                'items' =>$items
            ]);
    }


}