WebsitedataT.json: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m
m (→‎How the file is used: correct where code not showing)
m (→‎How the file is used: Made clearer)
Like any other [[Cumulus template file]], MX has to be told to [[Customised_templates#What_is_meant_by_.27Cumulus_processes_templates.27|process]] the template in order to generate "CumulusMX/web/websitedata.json" which is a JavaScript file where the tags have been replaced by values. [[Cumulus.ini#Optional_Web_Server|Settings for Optional_Web_Server]] describes how choosing the default web pages enables the processing and uploading of this file with values onto your web server.
 
The data file is used with the [[New Default Web Site Information|Web Pages]] supplied in the [[Webfiles folder|'''webfiles''']] sub-folder of the MX distribution from release 3.10.1 onwards. On your web server, each HTML page will call the JavaScript file "/CumulusMX/webfiles/js/setpagedata.js" (after uploading this file once to web site), it is that script that will read the uploaded data file, and insert the relevant value into HTML pages in a span which has the "cmxdata" attribute, with a value for that attribute set to the JSON object name. For example <code>&lt;span data-cmxdata="recordsbegandateISO"&gt;&lt;/span&gt;</code> would instruct the "setpagedata.js" script to insert the object we examined in detail earlier and <code>&lt;span data-cmxdata="temperatureChange24hours"&gt;&lt;/span&gt;</code> would make it insert the temperature difference we added as a modification earlier.
 
For example <code>&lt;span data-cmxdata="recordsbegandateISO"&gt;&lt;/span&gt;</code> would instruct the "setpagedata.js" script to insert the date in the JSON line that we examined in detail at the start of this Wiki page, and <code>&lt;span data-cmxdata="temperatureChange24hours"&gt;&lt;/span&gt;</code> would make it insert the temperature difference we used to show how arithmetic can be used in what we presented earlier as an example of what can be added as a modification to the JSON template.
In the tables below, the [[webtags|tag name]] together with any [[Webtags/Parameters|input/output modification parameter]], and the span attribute value of a JSON object is also shown because they do not always match. Please note that in the tables below, for simplicity, not every element is shown, often just an example, this is enough to show you the format, again the JSON attribute and the ID do not always match.
 
In the tables below, that explain the data represented by various lines in the template file, the Cumulus [[webtags|tag name]] and its meaning are explained, it is made clear whether any [[Webtags/Parameters|input/output modification parameter]] appears, and the table clearly identifies what JSON object name is used for the span attribute value. It might seem there is some repetition, but the tag name and JSON object name do not always match. Please note for simplicity, not every line in the file is explained, sometimes just one example is given representing multiple lines, this is enough to show you the format (with or without parameters), and whether the tag name and JSON object name do match.
 
=File details=
5,838

edits

Navigation menu