Adding Extensibility - ΩJr. Publizjr Creates Web Pages

This information lives on a webpage hosted at the following web address: 'https://omegajunior.globat.com/code/publizjr/'.

Allowing a page author to extend their page with custom, page-specific functionality (think HTML, Javascript, and CSS), is that a wise decision?

Yes, for instance in the Pantheon Online Games world, where each page may contain its own game. And in the zjrJS API Documentation, where each function has its own test case.

Here's how Publizjr Generator Templates allow for such extensibility.

In Publizjr 2 Templates,

page authors can use 3 ways of extending their page:
* Adding Javascript
* Adding CSS
* Adding HTML

Place customizations in 3 files, respectively:
* xtend.js
* xtend.css
* xtend.htmls

For those unfamiliar with .htmls: no, that 's' does not stand for "secure", but for "snippet". It indicates an incomplete piece of HTML, in that it only contains the additional content the page should show, without any of the page structure.

The Publizjr 2 Generator template detects the presence of each file, and adds it to the page.

The Javascript and CSS go into the page head element (CSS first, for optimization reasons), and the extra HTML goes into the page after the body.


For Publizjr 1 Templates,

have a PHP programmer add something like the following in the right places:
$pathXtendJS = "./$strFileID/xtend.js";
if ( file_exists( $pathXtendJS ) && is_file( $pathXtendJS ) ) {
print( "<script src='$strFileID/xtend.js'></script>" );
}

Note that a PHP path and an HTML path, though pointing at the same file, may differ in coding.


Suggested Approval Workflow

The editor-in-chief and webmaster may require a review and approval of the material before it goes live. Luckily, due to the granularity of Publizjr, an error on one page stays on that page, without affecting the rest of the site.

To test each customization, the author may create their own sandbox. To do so they copy their page folder, and in that copy they can upload any change desired. The webmaster may set this up so that the author does not get editing access to the live version of that page.

The author then could inform the editor-in-chief and the webmaster, who should review the changes, and copy the changes to the live version.

Because of the folder structure of the webpages, usage of a version control system like GitHub should prove rather straightforward, which is why Publizjr does not sport its own version control.

Interested?

Let's meet for coffee or over lunch. Talk to me using this form.