Answer the question
In order to leave comments, you need to log in
How to get image path from custom element in Bitrix?
There is an infoblock for example with Id (14), inside I created a custom field "SLIEDER_FOTO" of type "file" property id 183.
I want to get the path to this image.
According to the idea, they are extracted into the $ar_fields array and can be accessed - $ar_fields['PROPERTY_DOCS_VALUE'] only displays through checked -
Array
(
[0] => 4572
[1] => 4573
[2] => 4574
)
foreach($ar_fields['PROPERTY_SLIEDER_FOTO'] as $pic):
$arFile = CFile::GetFileArray($pic);
//print_r($arFile);
//$name = substr($arFile['FILE_NAME'], 0, -4);
echo '<p><img"'.$arFile['SRC'].'"></p>';
endforeach;
$APPLICATION->AddChainItem('Таунхаусы','/townhouses');
$arFilter = Array(
"IBLOCK_ID"=>14,
"ACTIVE"=>"Y",
"CODE"=>$_REQUEST['ID']
);
$res = CIBlockElement::GetList(Array("ID"=>"ASC"), $arFilter,false,false,Array("ID","CODE","NAME","PREVIEW_PICTURE","PROPERTY_NAPRAVLENIE_VALUE","PROPERTY_COMMUNICATIONS","PROPERTY_TIME","PROPERTY_MKAD","PROPERTY_AREA_1","PROPERTY_AREA_2","PROPERTY_PRICE_MIN","PROPERTY_PRICE_MAX","DETAIL_TEXT","PROPERTY_DOCS","PROPERTY_NEWS","PROPERTY_MAP","PROPERTY_PHOTO","PROPERTY_SPEC_OFFER","PROPERTY_LOGO","PROPERTY_MANAGER","PROPERTY_CREDIT","PROPERTY_GENPLAN","PROPERTY_SLIEDER_FOTO"));
if($ar_fields = $res->GetNext()){
$APPLICATION->AddChainItem($ar_fields['NAME'],'/townhouses/'.$_REQUEST['ID']);
$APPLICATION->AddChainItem('Генплан');
$APPLICATION->SetTitle('Генплан '.$ar_fields['NAME']);
global $NAMEPROJ,$LOGOS,$MANAGER;
$NAMEPROJ=$ar_fields['NAME'];
$MANAGER=$ar_fields['PROPERTY_MANAGER_VALUE'];
$LOGOS=$ar_fields['PROPERTY_LOGO_VALUE'];
Answer the question
In order to leave comments, you need to log in
dump the array via print_r - you'll see.
try $ar_fields['PROPERTY_DOCS_DISPLAY_VALUE']
it's strange that you don't have data in the field, but it's not clear why the id...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question