Welcome, Guest
Username: Password: Remember me
If you expect answers you should describe your problem and give as much information's as possible. (SQL-Structure, Template Code, Joomla Version ...) Please read this before posting: joodb.feenders.de/support.html
  • Page:
  • 1

TOPIC:

IF function for color change 1 month 1 week ago #6335

  • kloemi
  • kloemi's Avatar Topic Author
  • Offline
  • Posts: 1
  • Thank you received: 0
hi together,

I have a column in the database with the type set, which contains three values (administration, drinking water, waste water). Now I want to have a different color depending on what is selected. For two I can do this with ifis and else but how do I do this for three values?

Quasi: Administration = black
Drinking water = blue
Waste water = green

current variant for two color changes:

<dt>Bereichneu2:</dt>
<dd>{joodb ifis|bereich|Bereich Verwaltung|ge} <strong><span style="color: blue;">Bereich Verwaltung</span></strong>
{joodb else|bereich|Bereich Trinkwasser|ge} <strong><span style="color: green;">Bereich Trinkwasser</span></strong>
{joodb endif}</dd>


Thanks for your help

Please Log in or Create an account to join the conversation.

IF function for color change 1 month 1 week ago #6336

  • Dirk
  • Dirk's Avatar
  • Offline
  • Posts: 1186
  • Karma: 21
  • Thank you received: 225
Joodb else has no parameter.

If you want to do it this way you must open and close 3 ifis condition requests.
Like this. And don't take GE for string compare use EQ.
And remove Bereich from the values in your table.

Instead "Bereich Verwaltung" only "Verwaltung";
<dt>Bereich:</dt>
<dd>
{joodb ifis|bereich|Administration|eq} <strong><span style="color: black;">Bereich Administration</span></strong>{joodb endif}
{joodb ifis|bereich|Verwaltung|eq} <strong><span style="color: blue;">Bereich Verwaltung</span></strong>{joodb endif}
{joodb ifis|bereich|Trinkwasser|eq} <strong><span style="color: green;">Bereich Trinkwasser</span></strong>{joodb endif}
</dd>

But it would be more elegant to define class names (Verwaltung,Trinkwasser and Administration) with the desired colors and add the Field value as class attribute.
<dt>Bereich:</dt>
<dd><strong><span class="{joodb field|bereich}">Bereich {joodb field|bereich}</span></strong></dd>
The following user(s) said Thank You: kloemi

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: Dirkjoest