Build PHP Puzzle Parts Scroll To Bottom


build-puzzle-parts

This metawork article explains how I build the PHP files for each part of a logic puzzle.

Puzzle Part Links

For puzzles that have an associated JavaScript module, there are additional pages (the puzzle parts) that are generated. These pages are in two subfolders under the help folder: the puzzle folder (before the puzzle was solved), and the solved folder (after the puzzle was solved). The pages in each folder have the same name as the puzzle. The links along the bottom of the page are given below.

Build Puzzle Parts Script

The JavaScript build-puzzle-parts.mjs builds the puzzle part files for one or all puzzles that have a JavaScript module. For this to work the Viewer.js module requires the Filer.js module in the server folder. The line in the Viewer module that does this is:

const Filer = require("../server/Filer.js");

To have build-puzzle-parts.mjs invoke just one puzzle, set puzzleName to the name of the puzzle. Otherwise, set puzzleName to the empty string.

The files before the puzzle is solved are in subfolders under the help/puzzle folder. The files after the puzzle is solved are in subfolders under the help/solved folder. Some of these files show up as links on the puzzle page.

Here are the steps to generate the PHP puzzle part files.

  1. Open the command window
  2. Change the directory: cd /projects/mysterymaster.com/metawork/js/server
  3. Run the Node script: node build-puzzle-parts.mjs