PHP Classes

File: fwphp/glomodul/mkd/01/001_php_html_js/B12phpfw.mkd

Recommend this page to a friend!
  Classes of Slavko Srakocic   B12 PHP FW   fwphp/glomodul/mkd/01/001_php_html_js/B12phpfw.mkd   Download  
File: fwphp/glomodul/mkd/01/001_php_html_js/B12phpfw.mkd
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change: Update of fwphp/glomodul/mkd/01/001_php_html_js/B12phpfw.mkd
Date: 1 year ago
Size: 8,634 bytes


Class file image Download
## How mkd module skeleton code (ee B12phpfw) works I. CONTROLLER (ROUTING & DISPATCHING) URLs are nice like with mod_rewrite if mod_rewrite is not used (I have no time to explore differences between nginx and Apache on Windows 10 or on Linux, 32/64 bit ... - bad code problems). URL rewriting can be used (set QS = ''). Simplest possible (to me) routing (code < 50 lines) and dispatching (code < 50 lines). Module's single entry point is Home class controller. Configuration (property palette) is in rps array. Assigned is in : vendor\_02autoload.php (contains my autoloading class, used also for Composer's PSR-4 autoloading classes) zinc\core\_config_global.php Home class __construct() II. MODEL Articles (posts, pages) are in MySQL (Mariadb), Postgres, Oracle, SQLite... database (CRUD with PDO). Database can be also articles in .md / .html oper.system files (CRUD with rich text markdown SimpleMDE or html Summernote). III.VIEW Page template+CSS are in _tpl_main.html < 8 kB has all we need. If used in more scripts CSS should be separate script (like my second css skin, see www\index.php). Here I use it only in _tpl_main.html. Bootstrap >= ver. 4.1.1 template is also easy to use (see six beautiful examples which I found on inet in zinc\themes\bootstrap). Native PHP page template _tpl_main.html with echo $varijable_name simplify and standardize coding and is fast. I do not use {{such placeholders}} - more coding. ABOUT B12phpfw PHP framework Why framework ? Every coding style is framework (code skeleton-flow is link of code snippets) like every concluding-thinking-speaking is philosophy (ideas skeleton-flow is links of premisses, conclusions). B means CRUD blocks like in Oracle Forms 12 sybolizes that coding steps (snippets flow) must be clear visible in code / code comments phpfw = PHP framework. It can (be but must not) our directory name on hosting provider server (IMPORTANT : see $upto_rootm_str = '../../..' or $upto_rootm_str = '..' in index.php - same idea as in yii framework). Good SW has goodFLOW of data blocks and code blocks. ABOUT Mkd module - simplest B12phpfw example(no DB table rows CRUD). Mkd module allows to post (as some logged in user) rich text markdown SimpleMDE (or html Summernote) articles to .md / .html oper.system files. Using Summernote is simmilar to SimpleMDE. Good replacement for Dreamweaver, simplest help writter. When we log in we can see logged in user's posts - can be implemented simmilar to Msg module. Newest PHP programming techniques - eg namespaced classes, own classes autoloader and error handler. I tested Xdebug (which we maybe do not need). It is easy to use Composer's PSR-4 classes autoloader, just uncomment/comment code in vendor\_02autoload.php. CODE SIZE & SPEED: Main (PHP native) template contains CSS (both ~7 kB, background picture is ~11kB, own code ~70 kB + markdown SimpleMDE or html Summernote rich txt editor less than 200 kB). Pages are rendered in 4-30 miliseconds. ## ABOUT B12phpfw PHP framework **Why framework ? ** Every coding style is framework (skeleton-link of code snippets) like every concluding (skeleton - links of premisses) is philosophy. **B** means CRUD blocks like in Oracle forms, **12** sybolizes that coding steps (snippets flow) must be clear visible in code / code comments. Good SW has good **code an data FLOW**. mkd module allows CRUD rich text oper.system files (articles, posts), format **.txt or .md or .mkd** using SimpleMDE (or .html Summernote - it is simmilar to SimpleMDE). Newest PHP programming techniques - eg namespaced classes, own classes autoloader and own error handler (+ Xdebug I do not use any more, we may be do not need it). It is easy to use Composer's PSR-4 classes autoloader. CODE SIZE & SPEED: 1. Markdown rich text edit/show application Mkd is 25 kB. 2. Core B12phpfw.php is 9 kB, Helper.php is 9 kB. 3. Main (PHP native) template layout_tpl_main.html contains CSS (both ~10 kB, 4. background picture is ~11kB 25 + 18 + 10 + 11 = **~65 kB** 5. markdown SimpleMDE or html Summernote rich txt editor less than 200 kB 6. Pages are rendered in **2-50 miliseconds** (RecursiveIteratorIterator PHP class is slow). ## ZWAMP 64 bit 2013-02-23 with newest Apache and PHP on Windows 10 64 bit On Windows 10 64 bit I briefly tried 5-6 this or others or others , but ZWAMP with unpacking newest ZIPs & little config works best for me ! Others portable WAMP-s were "portable" when I tested them. Eg WAMP 3.0.4 seemed excellent but I did not know how to use Composer with it (and I have no time to discover basic things). XAMPP is also not clear enough to me and made troubles on Windows. Same for others - SW authors should test/write help for basic functionality, then rings & bells which mean nothing without clear/simple help. Meaning children play for SW author and his friends - nobody understands his job without clear/simple help (which is hader work then coding). MAMP, like XAMPP, doesn?t give you much help in creating virtual hosts and while it does give you a couple of options for server environments (you can use Apache or Nginx, as well as select between a couple PHP and MySQL versions), it doesn?t let you run multiple types of environments at the same time or do any of the legwork of setting up new sites for you. MAMP Pro, on the other hand, does all of this and more via an easy-to-use, albeit ugly, native application. Update Apache, PHP, MySQL to the latest versions On Win 32 bit is simmilar, on Win XP also works but older ZWAMP, older PHP and VC++ 2008 32 bit. Newest MySQL and PHPMyAdmin both portable is also not problem to unzip (I did it, you need a bit suffer with config files - that is what I say : SW authors do not explain enough basic actions with their SW - programming is nice but help is equaly important). I need ZWAMP 64 bit for Oracle DB 11g 64 bit. or newer For newest Apache and PHP install Visual C++ Redistributable for Visual Studio 2015 x64 For zwamp.exe install Visual C++ Redistributable for Visual Studio 2008 x64, and - I think also 2010 x64). Unzip and copy 2 conf files from older Apache2 to : J:\zwamp64\vdrive.sys\Apache2\conf\httpd.conf J:\zwamp64\vdrive.sys\Apache2\conf\vhosts.conf c:/Apache24 is ServerRoot in httpd.conf Default folder for your your webpages is DocumentRoot "c:/Apache24/htdocs" When you unzip to an other location, change in httpd.conf : ServerRoot, Documenroot, Directories, ScriptAlias. Also when you use the extra folder config file(s) change to your location there. Unzip THREAD SAFE or newer and copy conf file from older php (if you have older PHP) to : J:\zwamp64\vdrive.sys\php\php.ini IF ZWAMP WILL NOT START when you 2click zwamp.exe AS ADMIN (has error messaging) start apache in a DOS box so : httpd.exe and see J:\zwamp64\vdrive.sys\Apache2\logs\error.log NOT NEEDED Install as a service: httpd.exe -k install NOT NEEDED ApacheMonitor: Double click ApacheMonitor.exe, or put it in your Startup folder. ## New kid : Local by Flywheel - ONE-CLICK WORDPRESS INSTALLATION Local SSH + WP-CLI ACCESS - simple root SSH access to individual sites HASSLE-FREE LOCAL SSL SUPPORT - any site created a Local by Flywheel will automatically have a self-signed certificate created. Green padlock achieved! FLEXIBLE ENVIRONMENT OPTIONS - Hot-swap between NGINX or Apache 2.4, or switch between PHP versions. INSTALAC : C:\Users\slavk\Local Sites\afwww Site name : phporacle (nginx) then afwww (apache) Local Site Domain : afwww.local Local Site Path : ~\Local Sites\afwww No creation from Blueprint ENVIRONMENT : Wordpress usr=phporacle psw=MYPSW (dev-email@flywheel.local) Local afwww site below C:\Users\slavk\Local Sites\afwww\app\public Local phporacle's wordpress site in C:\Users\slavk\Local Sites\phporacle\app\public Local admin phporacle's wordpress C:\Users\slavk\AppData\Local\Programs\local-by-flywheel C:\Users\slavk\.docker\machine\machines\local-by-flywheel In order to use Local with non-WordPress setups, create a new site like normal and then delete all WordPress files. You can also delete any WP related tables in the database, but make sure the database connection stays the same.