Table Style & Text Color

Status
Not open for further replies.

PMJ2kx

Member
Premium Subscriber
Joined
Oct 7, 2007
Messages
695
Location
Utah County, Utah
I wanted to snaz up a table on a page I edit regularly (for reference, Joint CAD Incident Tracking System - The RadioReference Wiki), and noticed that I can't format an entire table to one text color. Since I will be using alternating colors that are dark, the end result is that all text needs to be white.

So here's what I tested: I went to MediaWiki's help pages, and copy & pasted a table that's supposed to work:
Code:
{| class="wikitable" style="text-align: center; color: green;"
|Orange
|Apple
|12,333.00
|-
|Bread
|Pie
|500.00
|-
|Butter
|Ice cream
|1.00
|}

...which should produce the result of...

lp0KLF9.png


...but instead on our wiki, produces....

DJJZ6YA.png


In order to produce what I'm looking for, I have to go through and edit each individual cell, and while I'm not opposed to hard work (because it will look a LOT better after), I'm hoping for a solution that requires a lot less typing and formatting.

Here's an example of a few cells stylized to how I'd like it:

U3Nk7qm.png


...and here's my code that got me there:

Code:
====Washington County====
{| border="2" cellpadding="3" cellspacing="0"
|- 
! align="center" style="background: #8B0000; color:white"| Unit ID
! align="center" style="background: #8B0000; color:white"| Description
! align="center" style="background: #8B0000; color:white"| Notes
|- style="background: #666666"
! align="center" style="color:white" | 1T
! align="center" style="color:white" | Hillsboro Air Tower
| style="color:white" | Used during aircraft emergencies
|- style="background: #777777" 
! align="center" style="color:white" | 911OPS
! align="center" style="color:white" | 3rd Alarm Admin Notification
| style="color:white" | Used rarely
|- style="background: #666666" 
! align="center" style="color:white" | AIR
! align="center" style="color:white" | Air Trailer
| style="color:white" | AIR333 out of Sherwood is the only known unit
|- style="background: #777777" 
! align="center" style="color:white" | ALM / ALARM
! align="center" style="color:white" | Alarm Designator
| style="color:white" | Designates what alarm level the current incident is at (1ALM, 2ALM, etc); one or two letters after ALM will indicate which department (V=TVFR, FG=Forest Grove, etc) – Note that medical calls can have multiple alarms and are designated with an extra M (2ALMM)
|}

Is there a work-around to this problem, or am I stuck doing this manually?

Thanks for any and all help. I am by no means versed in Wiki Markup, so I may be missing something really obvious here.
 

QDP2012

Member
Joined
Feb 8, 2012
Messages
1,921
Templates could be one solution

It might not be the only solution, but Templates will make your task easier.

As an example, and as the first step, two new templates have been created to get you started.

The templates were named with an abbreviation JCADITS for the related page (Joint CAD Incident Tracking System) and a brief description to indicate its purpose (Row format 1 and Row format 2).

In case you haven't used templates much before, templates are invoked by using two pairs of curly-braces surrounding the Template name and the variable values separated by the vertical bar like this:
Code:
{{Template Name | value 1 | value 2 | value 3}}
The actual code in the template is used to display the values whenever a Wiki-page calls the template.

For your convenience, the first few rows and the last row of the Washington County table have been replaced with the equivalent template statements.

Hopefully this will get you started. If you wish to use this technique, you will need to continue replacing the existing table rows with the equivalent template statements.

EDIT: One caution: The equal sign is a reserved symbol when using Templates, because it is used to assign values to variables. This means you cannot display it when calling the template. Please notice that the equal sign formerly used in the first few rows has been replaced with a colon and space. You will need to replace all equal signs with something else of your choosing, like a colon or a hyphen, etc..

EDIT 2: As you will notice when viewing the source-code of the Wiki page, the vertical bar can be used with or without spaces around it, and can be on the same line or on the next line, as you wish for convenience and clarity. The Wiki-page code includes an example of each.

Hope this helps,
 
Last edited:
Status
Not open for further replies.
Top