Today in Joshua Tree National Park
How It Works
Joshua Tree
National Park Service
U.S. Department of the Interior
Joshua Tree National Park
Today in Joshua Tree National Park
How It Works
How it works
The site works by periodically (like every 1/2 hour) querying various web resources to get updated information on weather, alerts, air quality, etc. This information is stored (cached) until the next update.
When a web page is requested, the stored information is
retrieved and compiled into the form needed for display,
and then sent to a template that exists for each web page or piece of a web page.
The template does the final formatting for displaying the page.
CacheManager runs the refresh operations, stores caches, and retrieves caches. No other page touches the caches.
DisplayManager retrieves data from CacheManger, formats it for display. It may utilize another class like Calendar or Camps.
All data is displayed using Templates in directory plates/.
Pages start out with
- namespace:DigitalMx\jotr;
- set aliases for Utility and Definitions class
use DigitalMx\jotr\Definitions as Defs;
use DigitalMx\jotr\Utilities as U;
- Require init.php - starts session and calls config/Initialize
//BEGIN START
require_once $_SERVER['DOCUMENT_ROOT'] . '/init.php';
- Initialize sets constants and paths
- Initialize runs services, which creates a container for all classes.
- sets a "meta" array with page title and location, and other properties that may be needed in head areas, like rotate parameters
$meta=array('meta'=>[
'file' => basename(__FILE__),
'title' => 'How It Works',
]);
basename is used to display file name in the browser's title or tab heading.
- echos template head to create <head> content
echos template titles to create < body> tag and titles.
echo $Plates->render('head',$meta);
echo $Plates->render('title',$meta);
This will be replaced by a PageManager class, when I get round toit.
- php/html from here on out, often something like
- Get an array of data from the Display manager
- Send the data to a template to render it
$z = DisplayManager('prepare_topic_weather');
echo Plates->render('weather',$z);
Web Sites
There are 4 web sites used for this site (see Sites and Security for details).
- Live
- The live site, accessed at https://jotr.digitalmx.com
- Beta
- The "next" version of the live site. Has its own data caches (weather, etc.) and admin settings, because structure may be different from current live. For testing before release.
- Livex
- An exact copy of the live site, but with it's own local settings (ranger admin, calendar, campgrounds). This is for people to learn how to use the site or try something out.
- Dev
- For developer test purposes only. Password protected. For testing work in process.
Local caches are the ones controlled by local admin settings: calendar, camps, ranger admin. Each site has its own set of local caches. External caches are caches refreshed by api to another place, like weather.gov.
Css
All sites use the css file main.css. It contains media rules for print which lowers font size and sets margins. The rotate page adds an additional file tv.css. This uses media rules to increase the root type size based on screen width, and changes the widely used h3 tag from left justified to center and underline.
Uses google font Rubik everywhere. san-serif fallback.
The "today.php" page is designed to be printed, so there are css pagebreaks between pages. The "rotate.php" page is divided into sections also, and a javascript is used to rotate visibility among the desired sections.
Development Process
Branch live is always the code on remote live and jotrx.
Branch work is branched from live and is the main working copy
Feature branches are branched from work
- Develop
- Development occurs on developers machine in repo work or branches derived from work and merged back in.
- Keep dev branches rebased to work
- For testing, push dev <dev branch>:dev
- Beta Test
- switch work,
- merge dev and commit
- push beta (work branch)
- make sure it works
- Live
- switch to live,
- merge --squash work
- change tag
- Commit -m "what's new" to set version/build in data/version
- push live to live
- push live to jotrx