- Posts: 4
COMMUNITY FORUM
Extra fields show image instead of text
- Daniel
-
Topic Author
- Offline
- New Member
Less
More
12 years 1 month ago #112254
by Daniel
Extra fields show image instead of text was created by Daniel
I have an extra field selection called "hotel category" with the values "1,2,3,4,5" and I want on the front end instead of showing the numbers show the image with the stars according to the selected number.
I know I can use something like: <
I know I can use something like: <
Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
12 years 1 month ago #112255
by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Extra fields show image instead of text
Hello Daniel,
this will give you some hints getk2.org/community/New-to-K2-Ask-here-f...K2-after-Item-Fields
this will give you some hints getk2.org/community/New-to-K2-Ask-here-f...K2-after-Item-Fields
Please Log in or Create an account to join the conversation.
- Daniel
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 4
12 years 1 month ago - 12 years 1 month ago #112256
by Daniel
Replied by Daniel on topic Re: Extra fields show image instead of text
Hi, thanks for your answer but the ink gives a 404 error, anyway I think you meant this:
getk2.org/community/New-to-K2-Ask-here-first/171284-Where- to-edit-K2-after-Item-Fields
But I still do not understand how to show an image according to the number you selected in the field. ?
Some more specific example?
Thanks in advanced.
getk2.org/community/New-to-K2-Ask-here-first/171284-Where- to-edit-K2-after-Item-Fields
But I still do not understand how to show an image according to the number you selected in the field. ?
Some more specific example?
Thanks in advanced.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
12 years 1 month ago #112257
by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Extra fields show image instead of text
You have to check which value is enabled and then show the appropriate image, the example is with one value but you can modify it easily.
It's all in the if else statement.
It's all in the if else statement.
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
- Offline
- Platinum Member
- Joomla Developer
12 years 1 month ago #112258
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Replied by Mohamed Abdelaziz on topic Re: Extra fields show image instead of text
Say that the field alias is hotel_category, and its values are 1,2,3,4 and 5
And your images names are 1.png, 2.png, 3.png, 4.png and 5.png
and the images relative path is: images/hotelcategory/
in the item.php file, you will insert the following html code in the required position:
Make sure to add it as html code.
It is planned to add this feature to my MEFG plugin, where it will be possible to map select/mutliselect/checkbox/radiobutton field values to images.
And your images names are 1.png, 2.png, 3.png, 4.png and 5.png
and the images relative path is: images/hotelcategory/
in the item.php file, you will insert the following html code in the required position:
<img src="images/hotelcategory/<?php echo $this->item->extraFields->hotel_category->value;?>.png" />
Make sure to add it as html code.
It is planned to add this feature to my MEFG plugin, where it will be possible to map select/mutliselect/checkbox/radiobutton field values to images.
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.