BeerEngine

Campaign for Real Ale

Content tags

Content tags are a method to insert content. In some cases this will be automatically updated, either from other content on the site or external sources.

All such tags have a common format. They are all enclosed by double square brackets, like so:

[[ ... ]]

The first piece of text within the square brackets should be the tag type. These are listed below. The type is then followed by a colon (:), and a number of parameters.

Each tag type has a different set of possible parameters. Some are required and some are optional. Parameters are separated by commas, and are specified like name=value. Values can be surrounded by double quotes ("). If the value itself contains a comma then the value must be surrounded by quotes.

In some cases, multiple values can be provided for a particular parameter. In this case the parameter should be repeated, like name=value1,name=value2. If multiple copies of a parameter that only expects a single value is passed the behaviour is undefined.


The most basic type of content tag ... a link to some other content, which might be a page, a link to an external web site, or a document to download. To find the ID for any type of content use List Available Content.

Required parameters

Examples

[[link:id=27]] : include a link to a page.
[[link:id=27,title=text on link]] : include a link to a page, using "text on link" as the text.
[[link:id=27,"pub guide page"]]:include a link to a page with a comment to document what the ID refers to.
[[image:id=22460,link=150698]]: add an image as a link


image

Inserts an image within the content, with an adjustable size.

Required parameters

Optional parameters

width An explicit width for the image. A numeric width, in CSS pixels. This overrides the width from "size". not set
style An inline CSS style specification. A valid CSS style attribute. empty
showcaption Whether the image caption should be displayed. (no value required) Don't display the caption
caption A text caption displayed below the image. Overrides showcaption. Any valid text. empty
link An optional node ID to link to from this image A number representing a valid node ID. empty

Note

The only default values for the class parameter are left and right. Custom CSS classes can be created and either added to a specific page within a <stlye> ... </style> block or preferably adding to a set of custom CSS via admin_appearance.php. If any branch would like more control over image layout, but lack the skills and experience with CSS to add a custom class or use the style parameter themselves, help can be provided (support@beerengine.camra.org.uk). 

Examples

[[image:id=27]] : include image 27 at a medium size.
[[image:id=27,size=large]] : include image 27 at a large size.
[[image:id=27,class=right]] : include image 27 formatted with the CSS class .right.
[[image:id=22460,link=150698]]: add an image as a link


Inserts a system logo within the content, with an adjustable size.

Required parameters

Optional parameters

link An optional node ID to link to from this logo A number representing a valid node ID. empty

The current valid set of logo images is:

  • [[logo:name=whatpub]]
  • [[logo:name=whatpub-white]] (logo background is not grey!!)
  • [[logo:name=locale]]
  • [[logo:name=cider]]
  • [[logo:name=mild]]
  • [[logo:name=voucher]]
  • [[logo:name=discount]]
  • [[logo:name=facebook]]
  • [[logo:name=instagram]]
  • [[logo:name=twitter]]

If both width and height are specified the height will be ignored, to ensure the logo retains the correct aspect ratio.

Example

[[logo:name=whatpub, link=151013]]: add the Whatpub logo as a link


rss

Include the data from one or more RSS (Really Simple Syndication) feeds. This is used to get headlines from an external site. The national CAMRA website used to provide a number of useful feeds, but these haven't existed for some time.

Required parameters

Optional parameters

Examples

These all refer to the old CAMRA feed addresses - they are retained here merely to demonstrate the syntax.

[[rss:url=http://www.camra.org.uk/rss/camra-rss.xml,limit=5]] : show the 5 latest headlines from CAMRA.
[[rss:title="National CAMRA News",url=http://www.camra.org.uk/rss/camra-rss.xml,limit=5]] : show the 5 latest headlines from CAMRA with a different title.
[[rss:title=National CAMRA News,limit=4,agelimit=14,url=http://www.camra.org.uk/rss/camra-rss.xml,url=http://www.camra.org.uk/rss/camra-pressrelease-rss.xml]] : show up to 5 headlines no more than 2 weeks old, taken from two different feeds. The two feeds are merged by date order, and duplicates are removed where possible.


twitter

Include the recent tweets from a specified twitter user. Text is converted to links where appropriate. Replies (tweets starting with @) are not shown.

Required parameters

Optional parameters

** There is an enhanced CSS layout available for twitter feeds called "twit-feed".

Examples

[[twitter:user=CAMRA_Official,limit=5]] : show the 5 latest tweets from CAMRA's official account.

[[twitter:user=CAMRA_Official,limit=5, class=twit-feed]] :as above using the enhanced layout.


list

Include a list of specified site content. This is the most useful content tag as it provides a ready means of selecting and displaying as a group individual instances of content types, for example a list of events or a list of contacts.

Required parameters

None, although any such listing would be of limited use, as everything would be listed!

Optional parameters

Type and Style

The type determines the content(s) to be included in the list. It is possible to specify more than one type, but such has limited value.

**There are enhanced CSS style layouts available for improving the layout of various list types. See below...

  • contact - style=contact-card : Lays out the content of a contact like a business card
  • event - style=event-diary : Lays out the detail of an event with the DATE / TIME as the lead part of the listing
    [Not yet part of the system CSS, needs local customisation - see Looking smart]
  • news^^ - style=event-diary : Lays out the content of a news item with the DATE / TIME as the lead part of the listing
    [Not yet part of the system CSS, needs local customisation - see Looking smart]
  • pub - style=pub-guide : Lays out the full content of a pub item
  • pub - style=pub-list : Lays out the summary information about a pub

^^If a news item has the TEASER field completed this will "crash" into the content of the displayed output, as there is no means of displaying the BODY part and not the TEASER part of the record. This can be remedied by adding the style "noteaser" on news lists.

pub list content is update every 24 hours from WhatPub? around 3am.

Display and Select

The parameters display and select together control what is included in the listing, each can take an optional filter expression in (brackets) and an optional sort order on the selected field name. To all intents and purposes they work the same in respect of filtering (selecting) content items to be included in the list, display determining what is included from the content in the output. Their various syntaxes are as follows...

display=field
select=field(sort_order)
select=field(filter rule)sort_order

Sort order of ascending or descending is specified by appending + or - after the filter expression.

The field name can be one of those provided by the content type, such as when or location or body. See the details of the type descriptions for details of the available fields.

For event, news and download content types, the field when supports filtering based on dates. Date filter rules define an absolute or relative threshold date before or after which to include items.

  • (before=YYYY-MM-DD) : include items having a date before or on the specified date
  • (after=YYYY-MM-DD) : include items having a date after or on the specified date
  • (before_rel=offset-value) : include items having a date before or on the offset date
  • (after_rel=offset-value) : include items having a date after or on the offset date

Relative dates use date offset-values specified in terms of minutes, hours, days, weeks, months or years. If a minus sign is included then the relative date will be in the past. Only one unit can be used at a time. The singular or plural form may be used. For example:

  • 1 day
  • -1 week
  • 2 weeks
  • -3 months
  • 1 year

Dates

Understanding the mechanism for handling relative dates may be helpful. The filter value specified ends up in an SQL WHERE clause with the form...

date >= (now() + interval [value]) for after_rel
date <= (now() + interval [value]) for before_rel

Date Ranges

Combining all these together, you can do something like these: the first displays all branch meeting minutes downloads for 2017; the second displays all events for the preceding 90 days.

[[list: type=download, title=Branch Meeting Minutes 2017, category=BranchMeetingMinutes, display=when-, select=when(after=2017-01-01), select=when(before=2017-12-31), style=brief]]
[[list: type=event, display=when(after_rel=-90 day), display=when(before_rel=0 day)-, display=location.locality, style=event-diary, title=Recent Activities]]

Categories

One or more categories are allowed, i.e. ",category=X," or ",category=X,category=Y,". This means that you can provide a branch diary with Meetings, Socials and Beer Festivals each under separate headings (first 3 examples below) or as a single list under one heading (last example below).

[[list: type=event, title=Branch Meetings, category=BranchMeeting, display=when(after_rel=0 week)+, display=location, style=brief]]
[[list: type=event, title=Branch Socials, category=BranchSocial, display=when(after_rel=0 week)+, display=location, style=brief]]
[[list: type=event, title=Branch Beer Festivals, category=BranchBeerFestival, display=when(after_rel=0 week)+, display=location, style=brief]]
[[list: type=event, title=Branch Meetings and Socials, category=BranchMeeting, category=BranchSocial, category=BranchBeerFestivals, display=when(after_rel=-0 week)+, display=location, style=brief]]

Examples

Event Lists

Show upcoming events with their location, including those that finished in the last week.

[[list: type=event, display=when(after_rel=-1 week)+, display=location]]

Show upcoming events which are in the category BranchMeeting, including only future events, and display "brief" with all the main details on a single line, including the location.

[[list: type=event, title=Branch Meetings, category=BranchMeeting, display=when(after_rel=0 week)+, display=location, style=brief]]
News Lists

[[list:type=news]]
[[list:type=news,title=News and press releases]]
[[list:type=news,title=News and press releases,style=brief]]
[[list:type=news,title=News and press releases,style=brief,display=body]]
[[list:type=news,title=Pub and Brewery News, style=event-diary noteaser, display=body]] : list news items using the enhanced truncated display, hiding the TEASER content
[[list:type=news,title=News and press releases,style=brief,display=when(after_rel=-1 week)+,display=body]]

Contact Lists

[[list:type=contact,category=BranchCommitteeRole,display=contact.name,display=contact.email,style=contact-card]] brief display
[[list:type=contact,category=BranchCommitteeRole,display=description,display=contact.name,display=contact.address,display=contact.phone,display=contact.email,style=contact-card]] detailed display - note display=description is different to all other fields

Download Lists

[[list:type=download]]
[[list:type=download,category=BranchMeetingMinutes,display=when-,style=brief]]
[[list:type=download,category=BranchNewsletter,display=description,display=when-,style=brief]]
display=description allows the display of the body/description field of the download, which might be an image of the front cover of the magazine

Pub Lists

To add an online pub guide page you need to go through the following steps:
1. have your pub data uploaded to WhatPub
2. send a request to the Admin that your web site imports pub data from WhatPub
3. add a list of the type shown below into a BeerEngine page

[[list:type=pub,display=location,map=show,select=pub(realale=y),select=pub(status=O),group=location.locality]]

select=pub(realale=y) is one instance of a select by feature or facility option. Pubs displayed can be filtered on any of the following features:
realale, realfire, quiet, familyfriendly, garden, accommodation, lunchtimemeals, eveningmeals, separatebar, disabledaccess, games, cider, parking, smoking, linedglasses, restaurant, functionroom, dogfriendly, newspapers, sportstv, wifi, locale, livemusic, memberdiscount, voucherscheme, beerfestival, acv, additionalservices

select=pub(status=O) is one instance of selecting by premises status, with O=open, and C=temporarily closed. Permanently closed is currently not an option but could be.

Member Discounts: select=pub(discountorvoucher=y) should be used to display both memberdiscount or voucherscheme. The field memberdiscount_comment provides the comment.

group=location.locality effects the way in which the list below the map is displayed, so that a set of pubs with a common locality (town), are grouped under a common heading, the town/locality.
To display a map but not the list of pubs use the following:
[[list:type=pub,display=location,map=show,select=pub(realale=y),select=pub(status=O),group=location.locality]]
<style>ul.listing {display:none !important;}</style>

List parameters:
title= - used as the title
limit= - limits number of displayed results
style= - applies class to generated results
type= - restricts listed nodes to just the given type - "page", "event", "news", "venue", "pub", "contact", "download", "link"
map= - the value is ignored - if the tag is there a map is generated.
include/display= - include the field in the output.
"include" is the original name, "display" is perhaps clearer. Allows filtering, as describe in the docs.
select= - allows filtering on a field but without actually showing the field in the results.
group= - group results by a particular field. Used for pubs when grouping by locality. Currently only groups by an exact match, so doesn't allow (e.g.) grouping by year.
category= - filter by category

depend on the node type.
page: body
event: location, when, body
news: when, body
venue: location, description
pub: location, contact, pub, description
contact: contact, description
download: download, description, when
link: uri

Where there's a common subset between node types you can include both in a listing. So, you could list venues and pubs if you only use the "location" and "description" options.
Some fields also have "sub parts", accessed by a dot notation. location fields includes "address", "latlng" and "locality". So, in pub listings we do group=location.locality.

Download Stats

Statistics of the number of downloads of a specific download can be generated using /dl-stat.php?id=node which creates a CSV file of download times and whether it was (probably) a mobile device. For example, https://beerengine.camra.org.uk/dl-stat.php?id=185321 creates a CSV file showing the downloads of the Quick Start Guide


WhatPub pub link

You can link to any pub on WhatPub by using something like:
[[pub:id=CAM/1,title=Queen's Head - Newton]]

data

The data tag allows inclusion of third-party data within text. At present this has one possible source: the membership count for the branch. To include this, use [[data:source=member-count]].

You can also round the value: to round to the nearest ten, use [[data:source=member-count, round=-1]]. For the nearest hundred, use -2.

This is best used as part of other text, for example: The branch has around [[data:source=member-count, round=-2]] members.

Admin Tasks