本文整理匯總了PHP中XMLParser::setContentOnly方法的典型用法代碼示例。如果您正苦於以下問題:PHP XMLParser::setContentOnly方法的具體用法?PHP XMLParser::setContentOnly怎麽用?PHP XMLParser::setContentOnly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XMLParser
的用法示例。
在下文中一共展示了XMLParser::setContentOnly方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadTemplate
public function loadTemplate()
{
PHPWS_Core::initCoreClass('XMLParser.php');
$xml = new XMLParser($this->file);
$xml->setContentOnly(true);
if (PHPWS_Error::isError($xml->error)) {
return $xml->error;
}
$result = $xml->format();
if (empty($result['TEMPLATE'])) {
return;
}
$this->data = $result['TEMPLATE'];
if (!isset($this->data['TITLE'])) {
$this->error[] = PHPWS_Error::get(PS_TPL_NO_TITLE, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
return;
}
$this->title =& $this->data['TITLE'];
if (isset($this->data['SUMMARY'])) {
$this->summary =& $this->data['SUMMARY'];
}
if (empty($this->data['THUMBNAIL'])) {
$this->error[] = PHPWS_Error::get(PS_TPL_NO_TN, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
return;
}
$this->thumbnail =& $this->data['THUMBNAIL'];
if (isset($this->data['STYLE'])) {
$this->style =& $this->data['STYLE'];
}
if (empty($this->data['STRUCTURE']['SECTION'])) {
$this->error[] = PHPWS_Error::get(PS_TPL_NO_SECTIONS, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
return;
}
$this->structure =& $this->data['STRUCTURE']['SECTION'];
if (isset($this->data['FOLDERS'])) {
if (is_array($this->data['FOLDERS']['NAME'])) {
$this->folders =& $this->data['FOLDERS']['NAME'];
} else {
$this->folders = array($this->data['FOLDERS']['NAME']);
}
}
}