Is there a way to change the template a page uses through a snippet call?
For example, I have a page with all my header and footer data and displays a table with my report data that looks very nice. I then want to be able to export the data to a csv file. Rather than creating a new page for every report so I can use a blank template for that resource, I want to have a GET trigger that will remove the template and send my header tags to read the page as a downloadable csv file. Everything works great, except the header and footer html code in my csv file.
-
☆ A M B ☆
- 3,112 Posts
<?php
$resource = $modx->getObject('modResource', $resId);
if ($resource) {
$resource->set('template', 0);
// ... continue with your snippet's output preview
}
Rico
Genius is one percent inspiration and ninety-nine percent perspiration.
Thomas A. Edison
MODx is great, but knowing how to use it well makes it perfect!
www.virtudraft.com
Security, security, security! |
Indonesian MODx Forum |
MODx Revo's cheatsheets |
MODx Evo's cheatsheets
Author of
Easy 2 Gallery 1.4.x,
PHPTidy,
spieFeed,
FileDownload R,
Upload To Users CMP,
Inherit Template TV,
LexRating,
ExerPlan,
Lingua,
virtuNewsletter,
Grid Class Key,
SmartTag,
prevNext
Maintainter/contributor of
Babel
Because it's hard to follow all topics on the forum, PING ME ON TWITTER
@_goldsky if you need my help.