<?php

include 'php/classes/page.php';
include 'functions/func_xml.php';
$page = new Page();

$page->attr('title','Discipling the Nations: Prayer Requests');
$page->content('prayerrequests.php');
$page->addCSSFile('prayerrequests.css');
$page->addJSFile('ssm.js','ssmItems.js','ssmItems_prayerrequests.js');

# get the ministry moments data
$xml = array();
$res_files = array('emailupdates','prayerletters');
$res_path = $DOCROOT.'/site/data/prayerrequests';
foreach($res_files as $key => $value)
{
	$xml[$value] = new SimpleXMLElement(file_get_contents($res_path.'/'.$value.'.xml'));
	unset($xml[$key]);
}
# get the missionary moments separately since it's not in the
# prayerrequest's data folder
$xml['missionarymoments'] = new SimpleXMLElement(file_get_contents($DOCROOT.'/site/data/missionarymoments.xml'));

// # get the latest prayer letter
// $num_letters = count($xml['prayerletters']->prayerletter);
// if($num_letters > 0)
// 	$page->data('latestprayerletter',$xml['prayerletters']->prayerletter[$num_letters - 1]);

# get the random verse and pass it to the template
$page->data('verse',xml_random_child($FILES['verses']));
$page->data('xml',$xml);

$page->process();

?>