Style Guide

Style Guide Jon Diamond

This section is aimed at contributors to the BGA website. It summarises editorial policy, coding standards and assorted other best practices. It was written for the orginal site and not the new look site from Spring 2008.

However, the section on Composition Tips is new and specifically written for our Drupal environment.

Content is King

Content is King Jon Diamond

The most important thing about this site is the content. Let there be no doubt about that.

So if you have some valuable content, and it is a choice between slapping it up on the site any old how, or trying to obey all of these guidelines and therefore never getting around to it, do the former.

If you want help in making your content meet these guidelines, then by all means ask the webmaster for help.

Most of these guidelines reflect the general consensus for how things should be done in any quality publication. A few of them are, perhaps, coloured by the prejudices of the webmaster. You will just have to live with that.

Editorial Conventions

Editorial Conventions Anonymous (not verified)

Typography

Typography Anonymous (not verified)

Composition Tips

Composition Tips Jon Diamond

The following Drupal Input formats can be used to help you create content:

  • Filtered HTML:
    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

      This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy. This table provides examples for each tag that is enabled on this site.

      For more information see W3C's HTML Specifications or use your favourite search engine to find other sites that explain HTML.

      Tag DescriptionYou TypeYou Get
      Anchors are used to make links to other pages.<a href="http://www.britgo.org">British Go Association</a>British Go Association
      Emphasized<em>Emphasized</em>Emphasized
      Strong<strong>Strong</strong>Strong
      Cited<cite>Cited</cite>Cited
      Coded text used to show programming source code<code>Coded</code>Coded
      Unordered list - use the <li> to begin each list item<ul> <li>First item</li> <li>Second item</li> </ul>
      • First item
      • Second item
      Ordered list - use the <li> to begin each list item<ol> <li>First item</li> <li>Second item</li> </ol>
      1. First item
      2. Second item
      Definition lists are similar to other HTML lists. <dl> begins the definition list, <dt> begins the definition term and <dd> begins the definition description.<dl> <dt>First term</dt> <dd>First definition</dd> <dt>Second term</dt> <dd>Second definition</dd> </dl>
      First term
      First definition
      Second term
      Second definition

      Most unusual characters can be directly entered without any problems.

      If you do encounter problems, try using HTML character entities. A common example looks like &amp; for an ampersand & character. For a full list of entities see HTML's entities page. Some of the available characters include:

      Character DescriptionYou TypeYou Get
      Ampersand&amp;&
      Greater than&gt;>
      Less than&lt;<
      Quotation mark&quot;"
    • Lines and paragraphs are automatically recognised. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognised simply add a couple blank lines.
    • Go board Diagrams

      See http://senseis.xmp.net/?HowDiagramsWork

  • PHP code:
    • Using custom PHP code

      If you know how to script in PHP, Drupal gives you the power to embed any script you like. It will be executed when the page is viewed and dynamically embedded into the page. This gives you amazing flexibility and power, but of course with that comes danger and insecurity if you do not write good code. If you are not familiar with PHP, SQL or with the site engine, avoid experimenting with PHP because you can corrupt your database or render your site insecure or even unusable! If you do not plan to do fancy stuff with your content then you are probably better off with straight HTML.

      Remember that the code within each PHP item must be valid PHP code - including things like correctly terminating statements with a semicolon. It is highly recommended that you develop your code separately using a simple test script on top of a test database before migrating to your production environment.

      Notes:

      • You can use global variables, such as configuration parameters, within the scope of your PHP code but remember that global variables which have been given values in your code will retain these values in the engine afterwards.
      • register_globals is now set to off by default. If you need form information you need to get it from the "superglobals" $_POST, $_GET, etc.
      • You can either use the print or return statement to output the actual content for your item.

      A basic example:

      You want to have a box with the title "Welcome" that you use to greet your visitors. The content for this box could be created by going:

        print t("Welcome visitor, ... welcome message goes here ...");
      

      If we are however dealing with a registered user, we can customise the message by using:

        global $user;
        if ($user->uid) {
          print t("Welcome $user->name, ... welcome message goes here ...");
        }
        else {
          print t("Welcome visitor, ... welcome message goes here ...");
        }
      

      For more in-depth examples, we recommend that you check the existing Drupal code and use it as a starting point, especially for sidebar boxes.

  • Full HTML:
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs are automatically recognised. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognised simply add a couple of blank lines.
    • Go board Diagrams

      See http://senseis.xmp.net/?HowDiagramsWork

  • Unfiltered HTML:
  • Markdown:
    • Go board Diagrams

      See http://senseis.xmp.net/?HowDiagramsWork

    • Quick Tips:
      • Two or more spaces at a line's end = Line break
      • Double returns = Paragraph
      • *Single asterisks* or _single underscores_ = Emphasis
      • **Double** or __double__ = Strong
      • This is [a link](http://the.link.com "The optional title text")
      For complete details on the Markdown syntax, see the Markdown documentation.
      <span class="clear"></span>

Styling parts of pages

Styling parts of pages Jon Diamond

In general you don't need to use any specific styling for pages as it is all catered for by the general BGA style sheet. This controls how lists, headings etc. are displayed.

Headings

The main heading styles used are H2 and H3, as below:

H2 style - major heading

H3 style - sub heading

Area Style

If you want to style an area of the screen then you can use something like the following:

<div style="background-color: rgb(240,230,230); max-width: 95%; margin: 0em 1em; padding: 0.5em 2em;">
Text here
</div>

Multi-column formats

You can use a table such as in http://www.britgo.org/hof/stacey, extracted below, although this creates messy HTML:
<table>
<tr><td>
<a href="/files/trophypics/stacey.jpg">
<img src="/files/trophypics/stacey-t.jpg" title="Stacey Trophy" alt="Stacey Trophy"></a></td>
<td>
<h3>Final Points 2009-10</h3> 1. 38 Matthew Macfadyen<br> 2. 34 Yohei Negi<br>
</td>
<td>
<h3>Top Place Getters 1990-2010</h3> 1. Francis Roads<br> 2. Alistair Wall<br> 3. Matthew Macfadyen
</td>
</tr></table>

Stacey trophy

Final Points 2009-10

1. 38 Matthew Macfadyen
2. 34 Yohei Negi
3. 22 Sandy Taylor

Top Place Getters 1990-2010

1. Francis Roads
2. Alistair Wall
3. Matthew Macfadyen

Changing <td> to <td valign="top"> in the second and third columns would align the text at the top of the cells.

Note: If you use a table then you'll always get a horizontal line between rows and before/after the table. Also the total widths must be less than 100% to allow for Internet Explorer bugs.

An example of 3 column table format is the BGJ archive page:

<table> <tr>
<td width=40% valign=top>
<p > These pages reproduce a selection of old (see note *below) British Go Journals and articles from them. </p> <br>... </td>
<td valign="top" width=27%> <p align="center"> There is also a list of available <a href="/bgj/bgj_updt.html" > BGJs sorted in order of web updates</a>. </p>
<br>...
</td>
<td valign="top" width=27%> <p align="center">Go to the most recent issues</p> <br>...
</td></tr>
</table>

These pages reproduce a selection of old (see note *below) British Go Journals and articles from them.


...

There is also a list of available BGJs sorted in order of web updates.


...

Go to the most recent issues


...

An alternative using pure CSS bits in a two column format is:

<div style="width: 48%; float: left">
Left hand column
</div>
<div style="width:48%; float:right">
Right hand column
</div>
<div clear=all></div>
<div style="width:100%;float:left">
Right hand column

<

div style="width:100%;float:left">

See the front page or http://www.britgo.org/hof/trophies for an example of this.

However, this doesn't automatically align the various items from side to side as do the table examples above; but the front page shows how to achieve this.

Note: Due to some Drupal issue this must be the last text on the page.

Miscellaneous

Miscellaneous Jon Diamond

Horizontal menu with links

Extract from Forthcoming Tournaments page, note the internal links within the page for key etc.

<p class="navbar">
<a href="#key">Key to the symbols</a> |
<a href="#mobile">The BGA mobile phone</a> |
<a href="#tournorg">To tournament organisers</a> |
<a href="#hostnat">Hosting a national event</a>
</p>
produces

Other BGA styles

<span class="date">Saturday 29th May - Sunday 30th May. Small board rapid on evening of 28th May.</span>
<span class="location>Mason's Hall, Dundee, <a href="http://multimap.co.uk/map/browse.cgi?pc=DD1+1PE&mapsize=big" >DD1 1PE</a>.</span>
<span class="format" >5 round McMahon. 80 minutes without overtime.</span>
<span class="contact" >Contact xxx</span>
<a href="#rating_class" class="rc">A</a>
<a href="#book_shop" class="bk">BOOKS</a>
<a href="/files/Shropshire2012.pdf" class="entry" title="Shrewsbury Go Tournament flyer(PDF)">More Info</a>
produces

Saturday 29th May - Sunday 30th May. Small board rapid on evening of 28th May. Mason's Hall, Dundee, DD1 1PE. 5 round McMahon. 80 minutes without overtime. Contact xxx A BOOKS More Info

There is also a list of miscellaneous items of pedantry.