Post by Vixered on Sept 23, 2017 5:59:02 GMT -8
Ayo! For starters, I'm sorry if this is hard to understand - I know what I want to do and what problems I've been having, but I'm not totally sure how to explain it. I'll try my best anyways :') I also hope this is the correct board for this!
Dunno if it's needed, but the site I'm testing this on is here.
I'm looking to modify my mini profiles, and they're essentially done, but there's something I want to do that I've been having trouble with. I have custom profile fields where members can enter links to different things (applications and the like, since it's an RP site), and those are working fine. I also have a custom profile field where they can enter a hex that'll alter the look of their profile. Thing is, I want the links in the mini profile to appear as whatever color the member has entered, specifically if they've entered a link. If they haven't filled out the link yet, I'd like the link to just appear white. I've been running into trouble, though, because I can't nest two foreach variables (loops? I dunno), or I can, but it doesn't work - I'm not sure why, since I don't know the first thing about foreach... stuff. I know this code doesn't work, but here's what I tried anyways:
I also tried to deal with the problem by adding the hex code outside of the link code instead, like this:
But it just made all of the links whatever color the first user to post in the thread had entered for their hex; apart from that, it technically "worked". For now I've settled with just making the links whatever color the member has entered regardless of whether or not they've entered a URL, like this:
And of course it works fine, but it's not exactly what I want. It seems like a lot of trouble just to make links show up as a certain color when they're filled out, but! I guess I'm kind of nit picky :') It's totally alright if there's not any way for this to be done, especially if it's super complex, but I am pretty curious as to why the solutions I tried didn't work. Like I said, I don't know anything about foreach stuff (I don't even know what it's technically referred to as), so honestly I'm kind of feeling around in the dark. I would like to understand more, though, if anyone wants to help! This is getting really long, so :'D Anyways! Thank you in advance!
Dunno if it's needed, but the site I'm testing this on is here.
I'm looking to modify my mini profiles, and they're essentially done, but there's something I want to do that I've been having trouble with. I have custom profile fields where members can enter links to different things (applications and the like, since it's an RP site), and those are working fine. I also have a custom profile field where they can enter a hex that'll alter the look of their profile. Thing is, I want the links in the mini profile to appear as whatever color the member has entered, specifically if they've entered a link. If they haven't filled out the link yet, I'd like the link to just appear white. I've been running into trouble, though, because I can't nest two foreach variables (loops? I dunno), or I can, but it doesn't work - I'm not sure why, since I don't know the first thing about foreach... stuff. I know this code doesn't work, but here's what I tried anyways:
<!--div when a link isn't filled out, appears white-->
<div class="mini-link" title="no application"><i class="fa fa-address-card"></i></div>
<!--div when a link is filled out, /supposed/ to appear as a custom hex - there's a negative margin so it hides the first div-->
{foreach $[user.mini_custom_field]}{if $[user.mini_custom_field.name] == "Application"}
<a href="$[user.mini_custom_field.value]" class="mini-link2" title="application" style="{foreach $[user.mini_custom_field]}{if $[user.mini_custom_field.name] == "Profile Color Hex"}color:#$[user.mini_custom_field.value];{/if}{/foreach}"><i class="fa fa-address-card"></i></a>
{/if}{/foreach}
I also tried to deal with the problem by adding the hex code outside of the link code instead, like this:
<style type="text/css">
.mini-link2 a {
color:#{foreach $[user.mini_custom_field]}{if $[user.mini_custom_field.name] == "Profile Color Hex"}$[user.mini_custom_field.value]!important;{/if}{/foreach}
}
</style>
But it just made all of the links whatever color the first user to post in the thread had entered for their hex; apart from that, it technically "worked". For now I've settled with just making the links whatever color the member has entered regardless of whether or not they've entered a URL, like this:
<!--div when a link isn't filled out, always appears as custom hex color-->
<div class="mini-link" title="no application"><i class="fa fa-address-card" style="{foreach $[user.mini_custom_field]}{if $[user.mini_custom_field.name] == "Profile Color Hex"}color:#$[user.mini_custom_field.value];{/if}{/foreach}"></i></div>
<!--div when a link is filled out - there's a negative margin so it hides the first div-->
{foreach $[user.mini_custom_field]}{if $[user.mini_custom_field.name] == "Application"}
<a href="$[user.mini_custom_field.value]" class="mini-link2" title="application"><i class="fa fa-address-card"></i></a>
{/if}{/foreach}
And of course it works fine, but it's not exactly what I want. It seems like a lot of trouble just to make links show up as a certain color when they're filled out, but! I guess I'm kind of nit picky :') It's totally alright if there's not any way for this to be done, especially if it's super complex, but I am pretty curious as to why the solutions I tried didn't work. Like I said, I don't know anything about foreach stuff (I don't even know what it's technically referred to as), so honestly I'm kind of feeling around in the dark. I would like to understand more, though, if anyone wants to help! This is getting really long, so :'D Anyways! Thank you in advance!