1. Go to this page and download the library: Download workofstan/mycms library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
new Controller(['requestUri' => $_SERVER['REQUEST_URI']])
│ // request URI is set in multiple places
│ ->requestUri
│ ->projectSpecific->requestUri
│ ->friendlyUrl->requestUri
│ ->friendlyUrl->projectSpecific->requestUri
│ ->result['template'] = TEMPLATE_DEFAULT
│
└───run()
│ └── $controller->MyCMS->template = $this->result['template'];
│ │
│ └───$controller->friendlyUrl
│ └── ->determineTemplate(['REQUEST_URI' => $this->requestUri]) // returns mixed string with name of the template when template determined, array with redir field when redirect, bool when default template SHOULD be used
│ ├── ->friendlyIdentifyRedirect(['REQUEST_URI' => $this->requestUri]) // returns mixed 1) bool (true) or 2) array with redir string field or 3) array with token string field and matches array field (see above)
│ │ ├──if $token === self::PAGE_NOT_FOUND
│ │ │ └──$this->MyCMS->template = self::TEMPLATE_NOT_FOUND
│ <──────── @return true
│ ├──FORCE_301
│ │ ├── ->friendlyfyUrl(URL query) // returns string query key of parse_url, e.g var1=12&var2=b
│ │ │ └── ->switchParametric(`type`, `value`) // project specific request to database returns mixed null (do not change the output) or string (URL - friendly or parametric)
│ │ │ └──If something new calculated, then
│ <────────────── @return redirWrapper(URL - friendly or parametric)
│ │ └── if !isset($matches[1]) && ($this->language != DEFAULT_LANGUAGE) // no language subpatern and the language isn't default
│ <─────────── @return 302 redirWrapper(languageFolder . interestingPath) // interestingPath is part of PATH beyond applicationDir
│ ├──REDIRECTOR_ENABLED
│ │ └──if old_url == interestingPath (=part of PATH beyond applicationDir)
│ <─────────── @return redirWrapper(new_path)
│ └──If there are more (non language) folders, the base of relative URLs would be incorrect, therefore
│ <──────── @return **redirect** either to a base URL with query parameters or to a 404 Page not found
│ <──── @return [token, matches]
│ <──── @return array with redir field when redirect || bool when default template SHOULD be used
│ │
│ ├──[token, matches]
│ ├──loop through $myCmsConf['templateAssignementParametricRules'] and if $this->get[`type`] found:
│ <────── @return template || `TEMPLATE_NOT_FOUND` (if invalid `value`)
│ │
│ └── ->pureFriendlyUrl(['REQUEST_URI' => $this->requestUri], $token, $matches); //FRIENDLY URL & Redirect calculation where $token, $matches are expected from above
│ ├──default scripts and language directories all result into the default template
│ <─────────── @return self::TEMPLATE_DEFAULT
│ <──── @return self::TEMPLATE_DEFAULT
│ │
│ └── ->findFriendlyUrlToken(token) // project specific request to database @return mixed null on empty result, false on database failure or one-dimensional array [id, type] on success
│ │ If there is a pure friendly URL, i.e. the token exactly matches a record in content database, decode it internally to type=id
│ │ SQL statement searching for $token in url_LL column of table(s) with content pieces addressed by FriendlyURL tokens
│ │ Overide the method if the default UNION on tables, where relevant types are stored, isn't sufficient
│ │ spoof $this->get[$found['type']] = $this->get['id'] = $found['id']
│ <────────────── @return $this->determineTemplate(['REQUEST_URI' => $this->requestUri]) RECURSION
│ <─────────── @return null
│ <──── null => @return self::TEMPLATE_NOT_FOUND
│ <──── redir or continue with calculated $controller->MyCMS->template
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.