Skip to content

Instantly share code, notes, and snippets.

@zaurmag
Last active December 1, 2017 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaurmag/a7560924b35bc6bfd94d3fd7267f24a3 to your computer and use it in GitHub Desktop.
Save zaurmag/a7560924b35bc6bfd94d3fd7267f24a3 to your computer and use it in GitHub Desktop.
Вывод дополнительных полей Joomla в шаблоне
<?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