Empty Block

Documentation



  • - This is the documentation page for the Catmice PHP system. - Here You can learn and/or remind Your self on how to use Catmice script in order to sucessfuly boost Your visitor's good experience onto Your own website. - You may also want to click/tap onto Xeyez to quick jump to desired portion of the document, on this and other Query Dialect and GET config manual pages as well.

    • REQUIREMENTS

      - You have PHP >= 8.2 (php-cli is enough) with mbstring and ctype extensions installed. - Meaning any http server with PHP support will do, including built-in PHP (testing) server. - You are experienced enough so that You have built at least one dynamic web site so far.

    • FILE SYSTEM HIERARCHY

      CatMice has its own little order and rules when it comes to the file system. The items in the DIRECTORY_MASK constant determine how the directories will be named and created accordingly. The same applies to the TRADEMARK constant, which sits in both primary (root /cm/™) and secondary (/cm/script|style/™) level, while the `script` and `style` are always explicitly on the secondary level (/cm/script and/or /cm/style). TRADEMARK in the primary level, at the root of the directory structure, contains everything except .css and .js files ("mime.types", etc.), and is mainly used for templating. As a secondary sub-directory it contains (should contain actually) files strictly related to a stronger brand or just the brand. If it weren't for all of this, the interrogative dialect wouldn't work.

      SETUP TEST/RUN

      !! Assuming that You have already obtained the source code. !! Assuming that You have already figured out the names for trademark and extension directories. - Calling the script. Let's say that You are using PHP built-in server, and that You have started it over port 8080, where cm is. - Open Your favorite browser and type http://localhost:8080/cm/ in url bar and press enter. Something like this should appear on screen: Not a proper request. And that is expected. All good. There are no GET (cat or mice) variable(s) provided. - Type the following in the url bar: http://localhost:8080/cm/?cat=test&bc=1&s=1 and press enter. Let's say that You have determined Your directory name masks, in a manner where Your style is css and your script is js That request would create new css directory with one more trademark (default ) directory inside, and will write something like this on screen: @charset "UTF-8"; /* Bad request for `test.css`. */ /**: Hardcoder::catmice `style` against: "test" - Squeezed: false - Expand Externals: false - Block-Comments persist: true :*/ - Do the same for the mices. Type: http://localhost:8080/cm/?mice=test&bc=1&s=1 press enter. You should see the following on screen: /* Bad request for `test.js`. */ /**: Hardcoder::catmice `script` against: "test" - Squeezed: false - Comments persist: true - Block-Comments persist: true :*/ And just as with the css/style test request, this one will also create two new directories. js directory (in the cm root) with it's child trademark (default ) directory inside. HINT: It wrote /* Bad request for `...` */ as there is no test.js nor test.css anywhere, yet. - Now, for the final test/run step, let's provide real css file with some rules inside, and lets employ one of the _GET parameters. &ex=1 which will force the creation of trademark directory in the CatMice root directory. Here is the link *(below line) to the font file that is being used on this website. >>> OrtoRNIDS-Regular.woff2 <<< Save it right next to the CatMice `index.php` in cm directory. Now, copy and paste the contents below into new file, name it fonts.css. Save it right next to the previously downloaded font in cm root directory. @font-face { font-family: 'OrtoRNIDS'; src: url(/cm/OrtoRNIDS-Regular.woff2) format('woff2'); font-display: swap; font-weight: normal; font-style: normal; } - Once when You did that, make a final test, type: http://localhost:8080/cm/?cat=.fonts&ex=1 press enter. If all went well: 1. You have the above style contents printed on screen with downloaded font, encoded and embeded - into the stylesheet. In other words, You saw some extremely ugly and huge output as last screen result. 2. There are three new directories created in the cm root directory. In fact, five new directories in total. - One trademark directory sitting in cm root with mime.types file inside. - One directory for .css files with it's trademark, as child directory. - And one more for .js files with it's trademark, as child directory. -- Assuming all went well, it means CatMice system will work for You, just as it is working excellent for this very website since 2019. You may now continue reading a bit further about CatMice Templating System or FS hierarchy, Runtime Parameters and Query Dialect as it describes the most important parts, and about Default Auto-instance parameters as well, as those are working when You provide none of the _GET parameters as override. -- If You are having issues with all of this and You don't know what to do or how to overcome particular problem, feel free to use contact form and ask for help.


Runtime whitelist

  private const array OPT_ARGUMENT; CatMice::Line["55"]; 

This array is used by loop as a whitelist for all possible _GET parameters. It is not configurable, hence, here it is as a quick reminder with examples. - hours (js, css) - 'hrs' for $this-> hours ^ example -> /cm/?cat=myRootStyle~$wholeLotsOfcssFiles&hrs=1280 - squeeze (js, css) - 'sq' for $this-> squeeze ^ example -> /cm/?mice=myjsfile~$wholeDirOfJSFiles&sq=1 - comments (JS ONLY) - 'c' for $this-> comments ^ example -> /cm/?mice=myjsfile&c=0 - block-comments (js, css) - 'bc' for $this-> blockCmt ^ example -> /cm/?cat=style&bc=0 - signature@bottom (js, css) - 's' for $this-> sig ^ example -> /cm/?mice=`jjq|app.name&s=1 - expand-externals (CSS ONLY) - 'ex' for $this-> expandExternals ^ example -> /cm/?cat=%cms.font-face&ex=1

Empty Block
Empty Block
Empty Block
Empty Block