- Posts: 13
COMMUNITY FORUM
Extra Field - Multi Select as a list?
- Mike Dove
-
Topic Author
- Offline
- New Member
Please Log in or Create an account to join the conversation.
- Jiliko.net
-
- Offline
- Platinum Member
- Posts: 567
You are right concerning the construction of the formatted string.
Take a look at the file 'components/com_k2/models/item.php' line 745.
Olivier
Please Log in or Create an account to join the conversation.
- Mike Dove
-
Topic Author
- Offline
- New Member
- Posts: 13
thanks for that!
do you have any idea where I would need to insert the li open and close tags?
Please Log in or Create an account to join the conversation.
- Mike Dove
-
Topic Author
- Offline
- New Member
- Posts: 13
$value=@implode('(/li)(li) ',$values);
, although it skips the first value.
i think there is something on the lines before that i need to change that would apply the brackets to EVERYTHING?
What I would like to do is add (li) wrapper to EVERY value aswell as give each (li) a class that is a copy of the option value so you output (please change in the tag brackets in your head ;)) :
(li class="value") value (/li)
for each selection..
(the reason for doing this is so i can apply css to the li individually and based upon the value)
i will keep experimenting but as i said my .php knowledge is very limited, if anyone could give me a hint it would be much apreciated!
Please Log in or Create an account to join the conversation.
- Jiliko.net
-
- Offline
- Platinum Member
- Posts: 567
One solution is to add code in your item.php k2 template file and not to modifiy k2 core files.
in attachment, some code that could do the job but if the value contains special caracters like space, comma then the class of the li element won't work as desired.
Olivier
Please Log in or Create an account to join the conversation.
- FeSys
-
- Offline
- Elite Member
- Posts: 262
You Rock...
Olivier Nolbert said:Mike,
One solution is to add code in your item.php k2 template file and not to modifiy k2 core files.
in attachment, some code that could do the job but if the value contains special caracters like space, comma then the class of the li element won't work as desired.
Olivier
Please Log in or Create an account to join the conversation.
- Mike Dove
-
Topic Author
- Offline
- New Member
- Posts: 13
Please Log in or Create an account to join the conversation.
- Mike Dove
-
Topic Author
- Offline
- New Member
- Posts: 13
first of all THANK YOU SO MUCH Oliver.
to confirm your method works perfectly for standard extra feild setups i can confirm.
HOWEVER for me its not working quite as i need.. let me explain.
im actually designing something very non standard, I have been using a method to call extra fields individually and too custom locations as described in this tutorial :
community.getk2.org/forum/topics/tutorial-adding-googlemaps?commentId=3536014%3AComment%3A46239
what i have been doing is by adding (to my template/html/com_k2/templates/item.php)
(?php $custom = $this->item->extra_fields; ?)
(added at the top)
and calling my individual extra feilds using
(?php echo $custom[0]->value;?)
(added where i want o call a value (the number refers to the specific extra feild starting from 0))
is there anyway i can modify your suggested code to attach directly to one of these calls?
sorry for the trouble!
Please Log in or Create an account to join the conversation.
- Jiliko.net
-
- Offline
- Platinum Member
- Posts: 567
In attachment an example of a php function that create an ul li structure with the extraField object passed
in your item.php
just use : (?php echo createLiWithExtraField($custom[0]);?)
Code not tested but should work
Olivier
Mike Dove said:right..
first of all THANK YOU SO MUCH Oliver.
to confirm your method works perfectly for standard extra feild setups i can confirm.
HOWEVER for me its not working quite as i need.. let me explain.
im actually designing something very non standard, I have been using a method to call extra fields individually and too custom locations as described in this tutorial :
community.getk2.org/forum/topics/tutorial-adding-googlemaps?...
what i have been doing is by adding (to my template/html/com_k2/templates/item.php)
(?php $custom = $this->item->extra_fields; ?)
(added at the top)
and calling my individual extra feilds using
(?php echo $custom[0]->value;?)
(added where i want o call a value (the number refers to the specific extra feild starting from 0))
is there anyway i can modify your suggested code to attach directly to one of these calls?
sorry for the trouble!
Please Log in or Create an account to join the conversation.
- Mike Dove
-
Topic Author
- Offline
- New Member
- Posts: 13
(?php $custom = $this->item->extra_fields; ?)
?
or seperatley?
Please Log in or Create an account to join the conversation.
- Jiliko.net
-
- Offline
- Platinum Member
- Posts: 567
and call the function where you need it.
Olivier
Mike Dove said:cool, where do I add that? to the
(?php $custom = $this->item->extra_fields; ?)
?
or seperatley?
Please Log in or Create an account to join the conversation.
- Marek Wojtaszek
-
- Offline
- Junior Member
- Posts: 27
("name":"Some name","value":1,"target":null)
how to get this values (name, value, target) into the item?
Please Log in or Create an account to join the conversation.
- Marek Wojtaszek
-
- Offline
- Junior Member
- Posts: 27
Please Log in or Create an account to join the conversation.
- Fred heise
-
- Offline
- New Member
- Posts: 15
thx for all your work. I have the same Problem with my template/item.php.
I just want to erase the comma. Is there any way to do this ?
thx
fred
Please Log in or Create an account to join the conversation.