<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Прямой вызов API Битрикса на странице");
?>
<?
if(!CModule::IncludeModule("iblock"))
die('iblock module is not included!');
$property_enums = CIBlockPropertyEnum::GetList(Array("DEF"=>"DESC", "SORT"=>"ASC"), Array("IBLOCK_ID"=>3, "CODE"=>"METRO_2"));
$dom = new DomDocument('1.0','utf-8');
$contents = $dom->createElement("contents");
$dom->appendChild($contents);
while($enum_fields = $property_enums->GetNext())
{
$par1 = $enum_fields["XML_ID"];
$par2 = $enum_fields["VALUE"];
print($par1."-".$par2."<br>");
$new = $dom->createElement("item");
$ParId = $new->appendChild($dom->createElement("id"));
$ParName = $new->appendChild($dom->createElement("Name"));
$ParId->appendChild($dom->createTextNode($par1));
$ParName->appendChild($dom->createTextNode($par2));
//$new->setAttribute("id",$par1);
//$new->setAttribute("Name",$par2);
$contents->appendChild($new);
}
$dom->formatOutput = true;
$dom->save('xml_id.xml');
?>
|