WebsitedataT.json: Difference between revisions

m
→‎How the file is used: correct where code not showing
m (Improved the initial explanation about this file, in response to feedback)
m (→‎How the file is used: correct where code not showing)
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.
 
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.
 
 
=File details=
5,838

edits