Last active
December 1, 2017 09:12
-
-
Save zaurmag/a7560924b35bc6bfd94d3fd7267f24a3 to your computer and use it in GitHub Desktop.
Вывод дополнительных полей Joomla в шаблоне
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// GET CUSTOM FIELDS | |
$myCustomFields = array(); | |
foreach($this->item->jcfields as $field) { | |
$myCustomFields[$field->name] = $field->value; | |
} | |
// RECOVER CUSTOM FILED NAME | |
if (isset($myCustomFields['url']) and !empty($myCustomFields['url'])) : ?> | |
<div class="field"> | |
<?php echo $myCustomFields['url']; ?> | |
</div> | |
<?php endif; ?> | |
<!-- Распчатка массива полей --> | |
<pre><?php print_r($this->item->jcfields); ?></pre> | |
<!-- Вывод всех полей в цикле --> | |
<?php | |
foreach($this->item->jcfields as $field) : ?> | |
<div class="field"> | |
<div class="field__name"><?php echo $field->title; ?></div> | |
<div class="field__val"><?php echo $field->value; ?></div> | |
</div> | |
<?php endforeach; ?> | |
// Подробнее - https://www.giudansky.com/news/12-coding/146-joomla-custom-fields |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment