Cheap Web Hosting for Developers

PHP, MySQL, Java, Unix Cheap Web Hosting

CHAPTER 7 SIMPLEXML 265 } } }

Filed under: PHP and XML — webmaster @ 16:14

CHAPTER 7 SIMPLEXML 265 } } } } /* Return array containing any captured errors */ return $arRet; } /* Initial states for application variables */ $sxetemplate = NULL; $bPreview = FALSE; $bError = FALSE; $bSave = FALSE; /* BEGIN ACTUAL PROCESSING */ if ($sxe = simplexml_load_file($padspec)) { if (isset($_POST[’Save’]) || isset($_POST[’Preview’]) || isset($_POST[’Edit’])) { /* Working template in hidden field is Base64 encoded and must be decoded */ $sxetemplate = new SimpleXMLElement(base64_decode($_POST[’ptemplate’])); /* Loop through $_POST vars. vars that are arrays are PAD fields to be set */ foreach($_POST AS $name=>$value) { if (is_array($value)) { setValue($sxetemplate, $name, $value); } } if (isset($_POST[’Save’])) { /* Save finalized working template to file */ $sxetemplate->asXML($savefile); $bSave = TRUE; } elseif (isset($_POST[’Preview’])) { /* Validate the working template */ $arRet = validatePAD($sxe, $sxetemplate); if (count($arRet) > 0) { $bError = TRUE; print “ERRORS FOUND
“; /* Print out errors returned from validatePAD() */ foreach ($arRet AS $key=>$value) { print $value[0].”: “.$value[1].”
“; } } else { /* Working template was validated so allow data to be previewed */ $bPreview = TRUE; } } } else {

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Cheap Web Hosting services

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by Cheap Web Hosting