- Posts: 11
COMMUNITY FORUM
Enable HTML/styling in extra fields
- Fjorten Syvogtredive (1437dk)
-
Topic Author
- Offline
- New Member
Less
More
9 years 7 months ago #147665
by Fjorten Syvogtredive (1437dk)
Enable HTML/styling in extra fields was created by Fjorten Syvogtredive (1437dk)
Anyone know how to enable HTML in a Extra Field dropdown in K2?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 7 months ago #147673
by Krikor Boghossian
Replied by Krikor Boghossian on topic Enable HTML/styling in extra fields
Hello,
Unfortunately HTML is not allowed inside select elements.
Unfortunately HTML is not allowed inside select elements.
Please Log in or Create an account to join the conversation.
- Fjorten Syvogtredive (1437dk)
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 11
9 years 7 months ago #147903
by Fjorten Syvogtredive (1437dk)
Replied by Fjorten Syvogtredive (1437dk) on topic Enable HTML/styling in extra fields
Thanks for your quick reply. And sorry for the late reply. I don't know why i did not receive an email that you answered already.
Is there any other way to style a specific line.
The page is: www.rentemesterhaven.dk/boligerne/lejlighedsliste
And i would like to emphasis the apartments currently for sale like this: www.dropbox.com/s/tt80f3ix7k3u39i/after-styling.jpg?dl=0
…as an alternative i could mark them as "featured", but i don't know how i would style those either.
This is the code for the K2 list template i created: www.dropbox.com/s/ugwr2sx51m86a5w/liste.zip?dl=0
If it is a complex job – what would it cost?
Peter.
Is there any other way to style a specific line.
The page is: www.rentemesterhaven.dk/boligerne/lejlighedsliste
And i would like to emphasis the apartments currently for sale like this: www.dropbox.com/s/tt80f3ix7k3u39i/after-styling.jpg?dl=0
…as an alternative i could mark them as "featured", but i don't know how i would style those either.
This is the code for the K2 list template i created: www.dropbox.com/s/ugwr2sx51m86a5w/liste.zip?dl=0
If it is a complex job – what would it cost?
Peter.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 7 months ago #147913
by Krikor Boghossian
Replied by Krikor Boghossian on topic Enable HTML/styling in extra fields
You have done most of the job actually.
Featured items would be my choice since all you need is a flag in your code which prints a css class.
In category.php I would do:
Using this css class you can create a different styling for featured items.
Featured items would be my choice since all you need is a flag in your code which prints a css class.
In category.php I would do:
<?php foreach($this->items as $item): ?>
<tr<?php if ($item->featured) { echo ' class="featured-item"'; } ?>>
Using this css class you can create a different styling for featured items.
Please Log in or Create an account to join the conversation.
- Fjorten Syvogtredive (1437dk)
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 11
9 years 6 months ago #148522
by Fjorten Syvogtredive (1437dk)
Replied by Fjorten Syvogtredive (1437dk) on topic Enable HTML/styling in extra fields
Hey just a follow-up: The "featured items" function worked as a charm. Thanks!
But i found a even better solution from a friend that knows javascript:
Thanks for a great forum and fast competent responses!
But i found a even better solution from a friend that knows javascript:
var allTds = document.getElementsByTagName("td");
for(var i=0; i<allTds.length; i++){
td = allTds[i]
switch(td.innerHTML){
case "Til salg":
td.parentNode.className = "forSale featured-item"
break;
case "Solgt":
td.parentNode.className = "sold"
break;
case "Udbydes senere":
td.parentNode.className = "forLater"
break;
case "Reserveret":
td.parentNode.className = "reserved"
break;
}
}
Thanks for a great forum and fast competent responses!
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 6 months ago - 9 years 6 months ago #148533
by Krikor Boghossian
Replied by Krikor Boghossian on topic Enable HTML/styling in extra fields
You 're welcome Fjorten :)
Yes, the JS solution is really solid. You can also manually render the fields value or a string directly as a CSS class.
JS will work as a charm as well.
Yes, the JS solution is really solid. You can also manually render the fields value or a string directly as a CSS class.
JS will work as a charm as well.
Last edit: 9 years 6 months ago by Krikor Boghossian.
Please Log in or Create an account to join the conversation.