News:

Wondering if this will always be free?  See why free is better.

Main Menu

doubt with hardcoded text

Started by -Rock Lee-, January 31, 2019, 12:06:41 PM

Previous topic - Next topic

-Rock Lee-

I am trying to create a modification for the users to change color, which everything is fine or so I thought. I was thinking about sending it to SMF when I realize something:

<a href="' . $scripturl . '?action=profile;u='. $message['member']['id'] . '" style="color: ' . $message['member']['color'] . ';" title="' . $txt['profile_color'] . ' ' . $message['member']['name'] . '">', $message['member']['name'], '</a>';

I have reference other modifications of how to add it and I remembered hardcoded text is not accepted... Search and look at several codes but I can not find what I want :'( How can I get it out and fulfill the same function "style="color:"?


Regards!

ADD: Looking at some SMF files I found that in Subs-MembersOnline.php on the line 106-110:
// Some basic color coding...
if (!empty($row['online_color']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';


That is why I am doubtful about the regulation for the approval of the modifications! ???
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Aleksi "Lex" Kilpinen

If I understand right, and that's part of the url - then no worries. Hardcoded text refers to actual text output, which should be translatable.
To do a translatable string, you just use a $translatablestring and add a corresponding language string in modifications.english.php :)
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

SychO

hardcoded text refers to hardcoded language text strings, not inline CSS which is what I'm assuming you mean
looks okay since there is no better way of assigning custom colors
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Kindred

that's not hardcoded text... :)


color is a CSS statement and, as such is acceptable.

However, you are including that because you have included inline styles.
Those should be avoided, in favor of actual CSS, if possible.
Instead of
style="color: ' . $message['member']['color'] . ';"
try something like
class="colorize-'. $message['member']['color'] .';"

and then in the CSS file
a.colorize-blue { color:"blue"; }
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

-Rock Lee-

To my mistake then for misinterpreting it :P what modifications.english.php with the previous envie I understood, now I just need to solve that. Thank you so much @Lex!

@Kindred That way I had thought about it but in this case what I try to achieve is to assign each member a predetermined color, which I do not know how to achieve it the way you tell me. It can be easier if the same user declares said variable and I keep it together with other configurations of the user but I am again in the same doubt when I show that color to each user.

Quote from: SychO on January 31, 2019, 12:14:08 PM
hardcoded text refers to hardcoded language text strings, not inline CSS which is what I'm assuming you mean
looks okay since there is no better way of assigning custom colors

Looking at other modifications and looking for several references I found the best solution, but I was left with some doubts when translating some words I did not finish understanding them.
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

SychO

Kindred's right if you were to give users a selection of colors to choose from, however if the users specify the color value themselves then there is no better way of doing it then how you're doing it.
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Advertisement: