I hope somebody here can give an answer to my question.
I am using several custom k2 templates assigned to categories & corresponding extra field groups (data types lets say). My site is bilingual ... For example i have:
extra field group: efg1
custom k2 template: templ1
extra fields: ef1, ef2, ..., ef20
I have modified my item.php file in order only to show some (lets say: ef1, ef3, ef5, ef6) extra fields in the following way (item.php):
The code for Function OnDesign::GetFields is the following:
The PROBLEM is that if an extra field is translated through joomfish, the corresponding field label and value are not been populated.
a test page is shown here:
where the fields: nudism, and free camping are not populated (there are translated in greek) ...
I am using several custom k2 templates assigned to categories & corresponding extra field groups (data types lets say). My site is bilingual ... For example i have:
extra field group: efg1
custom k2 template: templ1
extra fields: ef1, ef2, ..., ef20
I have modified my item.php file in order only to show some (lets say: ef1, ef3, ef5, ef6) extra fields in the following way (item.php):
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
<!-- Item extra fields -->
<div class="itemExtraFields">
<h3><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h3>
<ul>
<?php
$fields = OnDesign::GetFields($this->item->extra_fields, "Dinning Facilities,Accommodation Facilities,Other Facilities,Free Camping,Nudism,Related Routes & Paths,Regions,Location,Access - full information");
?>
<?php
$cnt = 0;
foreach ($fields as $key => $value):?>
<li class="<?php echo ($cnt++ % 2) ? "odd" : "even"; ?>">
<span class="itemExtraFieldsLabel"><?php echo $key; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $value; ?></span>
</li>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>The code for Function OnDesign::GetFields is the following:
<?php
class OnDesign
{
public static function GetFields($extraFields, $fieldsToGet)
{
$res = array();
if (is_string($fieldsToGet))
{
$fieldsToGet = explode(",", $fieldsToGet);
foreach($fieldsToGet as &$f)
$f = trim($f);
}
foreach($extraFields as $key => $extraField)
{
if (in_array($extraField->name, $fieldsToGet))
$res[$extraField->name] = $extraField->value;
}
return $res;
}
}The PROBLEM is that if an extra field is translated through joomfish, the corresponding field label and value are not been populated.
a test page is shown here:
where the fields: nudism, and free camping are not populated (there are translated in greek) ...