Skip to content

Instantly share code, notes, and snippets.

Created October 1, 2012 14:01
Show Gist options
  • Save anonymous/3811961 to your computer and use it in GitHub Desktop.
Save anonymous/3811961 to your computer and use it in GitHub Desktop.
<?
include 'config.core.php';
include MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$modx->initialize('web');
$childIds = getChildIds(2);
$childIds = implode(',',$childIds);
$c = $modx->newQuery('modResource');
$c->select(array('id', 'pagetitle'));
$c->where(array('hidemenu'=> 0,'deleted'=>0));
$struct = $modx->getCollection('modResource',$c);
$output = '';
foreach ($struct as $value) {
$page = $modx->getObject('modResource', $value->get('id'));
$pagetitle = $value->get('pagetitle');
$id = $value->get('id');
$address = $page->getTVValue('Address1');
$city = $page->getTVValue('City');
$zip = $page->getTVValue('Zip Code');
$feat = $$page->getTVValue('Featured');
$email = $page->getTVValue('Email');
$country = $page->getTVValue('Country');
$phone = $page->getTVValue('Phone');
$output .= '"'.$phone.'","","","","","'.$pagetitle.'","'.$address.'","'.$city.'","'.$state.'","'.$zip.'","'.$id.'","'.$feat.'","'.$email.'","'.$country.'"';
}
echo $output;
//"[[+tv.Phone]]","","","","","[[+pagetitle]]","[[+tv.Address1]]","[[+tv.City]]","[[+tv.state]]","[[+tv.Zip Code]]","[[+id]]","[[+tv.Featured]]","[[+tv.Email]]","[[+tv.Country]]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment