D
D
drewandrew2020-06-24 23:25:20
1C-Bitrix
drewandrew, 2020-06-24 23:25:20

How to display a custom field of the File type in Bitrix?

In the catalog section, you need to display a link to download the pdf file.
5ef3b6a891101068627832.png

This method does not work:

$rsResult = CIBlockSection::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => $arItems["IBLOCK_ID"], "ID" => $arItems["ID"]), false, $arSelect = array("UF_*"));
if($arSection = $rsResult->GetNext()) { 
$pdf_Link = $arSection["UF_PDF"];
}


<a href="<?=CFile::GetPath($pdf_Link);?>">pdf</a>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2020-06-25
@gromdron

Do you need to display a link to download a pdf file in the section?

Do you need to display a download link - I do not know.
How to display a custom field of the File type in Bitrix?

For the administrative panel, when uploading a file, it will be shown automatically.
Also, if you use the bitrix:news* components, then you can specify the property to receive, and in some cases it will even display itself (in specially designated places).
There are other ways to display a file: in the result_modifier.php of the template, get a list of sections and additionally request the data for this field, and then get direct links to files through CFile.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question