- Posts: 2
COMMUNITY FORUM
how can i extract and extra field item?
- bournaud
- Offline
- New Member
Less
More
13 years 9 months ago #88993
by bournaud
Replied by bournaud on topic how can i extract and extra field item?
Thanks for this code, but i have a little problem :
it works fine with one group of extra fields on one template (templatejoomla\html\com_k2\templates\nametemplate1) (> dev.feteduconte.agglo-sqy.fr/index.php/programme)
but it does'nt work with an other group of extra fields on an other template (templatejoomla\html\com_k2\templates\nametemplate2) (> dev.feteduconte.agglo-sqy.fr/index.php/bibliographie)
the nametemplate2 is recognized but he does'nt extract the extra fields...
Please how can i do ?
ThanksFrank said:
Thanks for the advice. I was also working on extracting only certain extra fields and surprisingly it works! Below is my code for those who still need a more concrete version:
//Code<?php foreach ($this->item->extra_fields as $key=>$extraField):?> <?php if($extraField->name == 'Ort'): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> <span class="catItemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span> <span class="catItemExtraFieldsValue"><?php echo $extraField->value; ?></span> </li> <?php endif; ?> <?php endforeach; ?>
//Code
it works fine with one group of extra fields on one template (templatejoomla\html\com_k2\templates\nametemplate1) (> dev.feteduconte.agglo-sqy.fr/index.php/programme)
but it does'nt work with an other group of extra fields on an other template (templatejoomla\html\com_k2\templates\nametemplate2) (> dev.feteduconte.agglo-sqy.fr/index.php/bibliographie)
the nametemplate2 is recognized but he does'nt extract the extra fields...
Please how can i do ?
ThanksFrank said:
Thanks for the advice. I was also working on extracting only certain extra fields and surprisingly it works! Below is my code for those who still need a more concrete version:
//Code<?php foreach ($this->item->extra_fields as $key=>$extraField):?> <?php if($extraField->name == 'Ort'): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> <span class="catItemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span> <span class="catItemExtraFieldsValue"><?php echo $extraField->value; ?></span> </li> <?php endif; ?> <?php endforeach; ?>
//Code
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
13 years 9 months ago #88994
by william white
Replied by william white on topic how can i extract and extra field item?
if($extraField->name == 'Ort'): ?>
is referring to an extra field with the name of Ort. If you have two groups of extra fields they will probably have different names
bournaud said:
Thanks for this code, but i have a little problem :
it works fine with one group of extra fields on one template (templatejoomla\html\com_k2\templates\nametemplate1) (> dev.feteduconte.agglo-sqy.fr/index.php/programme)
but it does'nt work with an other group of extra fields on an other template (templatejoomla\html\com_k2\templates\nametemplate2) (> dev.feteduconte.agglo-sqy.fr/index.php/bibliographie)
the nametemplate2 is recognized but he does'nt extract the extra fields...
Please how can i do ?
ThanksFrank said:
Thanks for the advice. I was also working on extracting only certain extra fields and surprisingly it works! Below is my code for those who still need a more concrete version:
//Code<?php foreach ($this->item->extra_fields as $key=>$extraField):?> <?php if($extraField->name == 'Ort'): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> <span class="catItemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span> <span class="catItemExtraFieldsValue"><?php echo $extraField->value; ?></span> </li> <?php endif; ?> <?php endforeach; ?>
//Code
is referring to an extra field with the name of Ort. If you have two groups of extra fields they will probably have different names
bournaud said:
Thanks for this code, but i have a little problem :
it works fine with one group of extra fields on one template (templatejoomla\html\com_k2\templates\nametemplate1) (> dev.feteduconte.agglo-sqy.fr/index.php/programme)
but it does'nt work with an other group of extra fields on an other template (templatejoomla\html\com_k2\templates\nametemplate2) (> dev.feteduconte.agglo-sqy.fr/index.php/bibliographie)
the nametemplate2 is recognized but he does'nt extract the extra fields...
Please how can i do ?
ThanksFrank said:
Thanks for the advice. I was also working on extracting only certain extra fields and surprisingly it works! Below is my code for those who still need a more concrete version:
//Code<?php foreach ($this->item->extra_fields as $key=>$extraField):?> <?php if($extraField->name == 'Ort'): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> <span class="catItemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span> <span class="catItemExtraFieldsValue"><?php echo $extraField->value; ?></span> </li> <?php endif; ?> <?php endforeach; ?>
//Code
Please Log in or Create an account to join the conversation.
- bournaud
- Offline
- New Member
Less
More
- Posts: 2
13 years 9 months ago #88995
by bournaud
Replied by bournaud on topic how can i extract and extra field item?
William White said:
if($extraField->name == 'Ort'): ?>
is referring to an extra field with the name of Ort.
> yes i know that (dev.feteduconte.agglo-sqy.fr/index.php/programme)
If you have two groups of extra fields they will probably have different names
> yes my extra fields have different name and i change the name but they does'nt appear in my second template. I must specify the name of the group in the code ? how ?
if($extraField->name == 'Ort'): ?>
is referring to an extra field with the name of Ort.
> yes i know that (dev.feteduconte.agglo-sqy.fr/index.php/programme)
If you have two groups of extra fields they will probably have different names
> yes my extra fields have different name and i change the name but they does'nt appear in my second template. I must specify the name of the group in the code ? how ?
Please Log in or Create an account to join the conversation.
- Jeff Whitmore
- Offline
- Junior Member
Less
More
- Posts: 24
13 years 9 months ago #88996
by Jeff Whitmore
Replied by Jeff Whitmore on topic how can i extract and extra field item?
Please Log in or Create an account to join the conversation.