0

I need some guidence in how to make an frontend xml export of resources.

I use getresources to show resources with title, image, and some info data (like blog). In one page I show about 15 resources. I would like to export this page with resources as xml with click on a button.

Thanks!

Denis
  • 11
  • 1
  • 4

2 Answers2

0

How about to create a page like htttp://your_site/export.html?pageids=1,2,3,... where 1,2,3 - IDs of exported resources. On this page, create a snippet like this -

<?php

$template = 2;

$list_ids = explode(',', $_GET['pageids']);

$out_list = array();

foreach($list_ids as $id) { // check allowed templates
    $document = $modx->getObject('modResource', $id);
    if ($document->get('template') == $template) {
        $out_list[] = $id;
    }
}

$modx->setPlaceholder('list_ids', implode(',',$out_list));

and then place

[[!getResources? &resources=`[[+list_ids]]` &tpl=`myRowTpl_XML`]]
Vasis
  • 2,281
  • 1
  • 16
  • 23
0

Theres a tutorial on this very thing, specifically for creating a google xml sitemap here: http://rtfm.modx.com/display/ADDON/getResources.Google+XML+Sitemap