OS Property support center

Get name and value of extra field in custom theme

  • Bettina Steffan
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago #64265 by Bettina Steffan
Get name and value of extra field in custom theme was created by Bettina Steffan
Hello,
I created a custom theme, I made a copy of an existing theme and modified it. This works witthout problems.

What I would like to do is to use a specific field of an extra field group.
For example: I use the extra field group construction and i want to show only one field on specific place in my theme.
I have the field Built in and want to show it together with other details.

What is the php code to get the name and value of an extra field in custom template?

Thanks a lot,
Bettina

Please Log in or Create an account to join the conversation.

More
9 years 11 months ago #64298 by Mr. Dam
Hi Bettina,
You can modify the theme in file:
components > com_oproperty > templates > theme_name > details.html.tpl.php
This file is property details page.
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • Bettina Steffan
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago #64303 by Bettina Steffan
Replied by Bettina Steffan on topic Get name and value of extra field in custom theme
Thank you Dam, I know which file to edit, but I would like to know the following:


This php code shows all Extra Fields Groups and their Extra Fields:
<?php
if(count($row->extra_field_groups) > 0){
$extra_field_groups = $row->extra_field_groups;
for($i=0;$i<count($extra_field_groups);$i++){
$group = $extra_field_groups[$i];
$group_name = $group->group_name;
$fields = $group->fields;
if(count($fields)> 0){
?>

<h4>
<?php echo $group_name;?>
</h4>
<?php
$k = 0;
for($j=0;$j<count($fields);$j++){
$field = $fields[$j];
$k++;
?>
<div class="span8" style="margin-left:0px;">
<i class="osicon-ok"></i>&nbsp;
<?php
if($field->displaytitle == 1){
?>
<?php
if($field->field_description != ""){
?>
<span class="editlinktip hasTip" title="<?php echo $field->field_label;?>::<?php echo $field->field_description?>">
<?php echo $field->field_label;?>
</span>
<?php
}else{
?>
<?php echo $field->field_label;?>
<?php
}
}
?>
&nbsp;<?php echo $field->value; ?>
</div>
<?php
if($k == 3){
?>
<div class="clearfix"></div>
<?php
$k = 0;
}
}
}
?>

I have the Extra Field Group "Construction" with the extra field "Built In" and I want to get only this field label and value and show it at top position in my template. How can I get a specific extra field value?

Thanks Bettina

Please Log in or Create an account to join the conversation.

Moderators: Mr. DamNguyen Phu Quan