PHP Classes

File: fwphp/glomodul/blog/msgmkd/altervista003.txt

Recommend this page to a friend!
  Classes of Slavko Srakocic   B12 PHP FW   fwphp/glomodul/blog/msgmkd/altervista003.txt   Download  
File: fwphp/glomodul/blog/msgmkd/altervista003.txt
Role: Documentation
Content type: text/plain
Description: Documentation
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change: Update of fwphp/glomodul/blog/msgmkd/altervista003.txt
Date: 1 year ago
Size: 17,309 bytes
 

Contents

Class file image Download
3\. Zwamp server development ibrowser menu ========================================== **[HOME](http://phporacle.altervista.org/php-oracle-main-menu/ "Main menu")**\- old downloads are here, but better[https://github.com/slavkoss/fwphp/ ](https://github.com/slavkoss/fwphp/) 2019.10.25 Recently I use XAMPP (since Apachefriends made 64 bit version) - simplest installation. Also fwphp is much simpler than MVC described below.[ ](https://github.com/slavkoss/fwphp/) **2.Sept.2015 Download - see site\_ver2.rar from my article 9.** Here is important **lsweb.php** - excellent for development (and very simple once you understand it). [zwamp.rar](http://phporacle.altervista.org/wp-content/uploads/2015/01/zwamp.rar) - this is old code, use it only to see how to work with static class elements**.** Folder names in .rar are simmilar to my development site folder names. (All is tested with ~newest 64 bit SW). Contains scripts to learn higher level begining PHP : 1. Apache & php config scripts 2. zwamp scripts - main development menu 3. ls scripts - web server dirs navigation 4. yiiinfo scripts Goal is basic web development site. Best way to learn is start with small portion of code and add few lines step by step. **May 2015** Code refactored 3 : Not finished yet, later I shall write new article "**Web development and production site** (virtual hosts, aliases) on Windows 8.1 , Oracle 11gXE (and 11g), PHP (all 64 bit) **on hard disk and on Usb stick**". Code refactoring 3 consists of: 1. simplify config class with static variables 2. simplify ls scripts for web server dirs navigation 3. simplify DBI - I tested PDOOCI DBI (**Eust?quio Rangel** http://github.com/taq/pdooci) -**works.** I think PDOOCI is usefull becouse it is PDO code sintax layer on OCI8 DBI code layer. One day, when PHP PDO will no more be experimental PDOOCI will not be needed.Eust?quio made also PHPreports (also on Github) **April. 2015** Code refactored 2 : 1. config file defines **constants** and contains config class with **static variables** (visible in all scripts, can be changed). This is last large refactoting. 2. Added top menu - I suppose best and simplest. 3. explanations in this page for now are not updated but code is in .rar at top of this page. 4. Now this scripts are : **OOP, SPA, MVC** **domain-style, PHP outside web doc root, (paths & URLs) set up with constants and static class variables.** **Feb. 2015** Code refactored 1 - **[php outside web doc root](#code "Scripts code"):** Intro explanations for now not updated. Now this scripts are : **OOP, SPA, MVC** **domain-style, PHP outside web doc root.** 10 scripts - It is not easy - same as **yii2 requirements scripts**. Both examples are excellent for learning PHP. 1. Installing [**Apache, PHP, Oracle**](http://phporacle.altervista.org/1-install-php-apache-oracle-db-11g-xe-win-8-1-64bit-apache-php/ "1. Install PHP, Apache, Oracle DB 11g XE on Win 8.1 64bit - Apache, PHP") 11XE (all 64 bit) 2. **[11g XE](http://phporacle.altervista.org/2-install-php-apache-oracle-db-11g-xe-win-8-1-64bit-apex/ "2. Install Oracle DB 11g XE on Win 8.1.1 (all 64bit) + APEX")** on Win 8.1.1, both 64bit - **APEX** VERSION 4.2.5, Maj 24, 2014 3. Zwamp server development ibrowser menu - all on Win 8.1.1, 64bi 4. How to recognize mobile device - [**oop, spa, mvc**](http://phporacle.altervista.org/how-to-recognize-mobile-device-oop-spa-mvc-domain-style-php-outside-web-doc-root/ "How to recognize mobile device - oop, spa, mvc domain-style, php outside web doc root") **domain-style, php outside web doc root** [![zwamp_taskbartray_icon](http://phporacle.altervista.org/wp-content/uploads/2015/01/zwamp_taskbartray_icon.png)](http://phporacle.altervista.org/wp-content/uploads/2015/01/zwamp_taskbartray_icon.png)[![zwamp](http://phporacle.altervista.org/wp-content/uploads/2015/01/zwamp.jpg)](http://phporacle.altervista.org/wp-content/uploads/2015/01/zwamp.jpg)<-- Z\_WAMP right click menu - Right click on house icon first left in the bottom \~~~~~~~~~~~ Page with blue Z: icon is output of view script view\_3cols\_list.php [http://zwamp.sourceforge.net/](http://zwamp.sourceforge.net/) [http://sourceforge.net/projects/zwamp/files](http://sourceforge.net/projects/zwamp/files) - operating system (32-bit/i386 or 64-bit/x86\_64). * * * ### MVC scripts which create this home page (ee bits 1-4 on picture above) SPA = Single Page web Application DOMAIN STYLE CODE structure = app. (form) scripts are in ONE subdir (and its subdirs), and index.php, if needed, is in dir above this ONE application directory. Eg - this DEVELOPMENT MAIN MENU SCRIPTS are in zwamp dir, \- Controller script: zwamp.php and all other .php, .css, .jpg... can be in same dir. (no subdirs becouse it is small app.). ZWAMP has no such home page, I made it from WAMPs home page, with many changes : 1. **SPA** was excellent 2. **DOMAIN STYLE CODE** was not implemented - everything was in appl. root dir, I had problems showing pictures (eg $imgwrench = "background: ...)... 3. **MVC** not clear I had work on it... bit 1.Alati (tools), eg link instalirano 1. view\_3cols\_list.php - View main body: lin.14: $fleview\_instalir = str\_replace('zwamp.php', 'view\_instalirano\_20150106.html',$flezwamp); ...MENU BIT CODE lin. 36 : <**a style="${imgwrench}" target="\_blank" href="instalirano=1"> instalirano/a>** ...CODE AT THIS PAGE BOTTOM lin 144: $fleview\_instalirano - Installed on my PC kod edit kod\_edit\_run($mdpath.$rel\_apldir\_adr, basename($fleview\_instalir)); 2. zwamp.php - Controller: **if (isset($\_GET\['instalirano'\])) {include( ** $mdpath.$rel\_apldir\_adr.'/view\_instalirano\_20150106.html' ); exit() #### Menu "2.Programi (projekti)" is list of dirs ($projectContents) not in array $projectsListIgnore 1. zwamp\_conf.php - Configuration 1\. is model script for dirs list (better not but this is simple example) 2\. and stores label **"2.Programi (projekti" in array $txtlang** (see script code) $txtlang array contains texts for more languages. **1\. Model: dirs list model code in zwamp.conf: **$projectContents = ''; if ($idmape = opendir($mdpath)) { **while (false !== ($mapa = readdir($idmape))) **{ //if ($mapa != "." && $mapa != "..") { if (is\_dir($mdpath."/".$mapa) === true && **!in\_array($mapa,$projectsListIgnore)** ) { //echo "DIRECTORY: ".$mapa.'<br />'; $projectContents .= '<li>' .'**<a style="'.$imgdirgo.'" target="\_blank" href="**' .( $suppress\_localhost 'http://dev:8083/inc/fw/' : '' ) **.$mapa.'">'.$mapa** .'</a>' .'</li>'; } else { //echo "FILE: ".$mapa.'<br />'; } } closedir($idmape); } if (empty($projectContents)) $projectContents = "<li>".$txtlang\[$jezik\]\['txtNoProjet'\]."</li>\\n"; 2. view\_3cols\_list.php - View main displays array $projectContents : <ul class="projects"> ${projectContents} </ul> #### Menu "3.Aliasi i virt.hostovi" is list of files ($aliasContents) 1. zwamp\_conf.php - Configuration (Aliases are .conf files in dir "alias" below Z:.) 1\. is model script for files list (better not but this is simple example) 2\. and stores label **"3.Aliasi i virt.hostovi" in array $txtlang** (see script code) $txtlang array contains texts for more languages. **1\. Model: files list model code in zwamp.conf:** $aliasContents = ''; // ucitavanje liste (r?cup?ration) alias-a if ($idmape = opendir($aliasDir)) { while (false !== ($konfig\_file = readdir($idmape))) { if (!is\_dir($aliasDir.$konfig\_file) && strstr($konfig\_file, '.conf')) { //echo "DIRECTORY: ".$konfig\_file.'<br />'; $alias\_ime = str\_replace('.conf','',$konfig\_file); $urlbit = $alias\_ime; if ($alias\_ime == 'dev') { // http://dev/ // apache sada nece dodati localhost/ ispred dev : $urlbit = 'http://'.$alias\_ime ; $alias\_ime = $alias\_ime . ' (vhost)'; } else // svi ostali aliasi su kao adminer ispod .sys : { // /.sys/adminer tj http://localhost/adminer/ $urlbit = 'http://dev/'.$alias\_ime ; } ; $aliasContents .= '<li>'.'<a style="'.$imgdir.'"' . ' href="'.$urlbit.'">'.$alias\_ime.'</a>'.'</li>'; } } closedir($idmape); } else { //echo "FILE: ".$konfig\_file.'<br />'; } if (empty($aliasContents)) $aliasContents = "<li>" . $txtlang\[$jezik\]\['txtNoAlias'\]."</li>\\n"; else $aliasContents = 'Aliasi su .conf u mapi "alias" ispod Z:.' .'<br />'.'Slu?e za aplik. u mapi "apps" ispod Z:.' .$aliasContents; 2. view\_3cols\_list.php - View main displays array $aliasContents : <ul class="aliases"> ${aliasContents} </ul> #### List "4.Server configuration" is list of PHP extensions ($loaded\_extensions) 1. zwamp\_conf.php - Configuration 1\. is model script PHP extensions (better not but this is simple example) 2\. and stores label **"3.Aliasi i virt.hostovi" in array $txtlang** (see script code) $txtlang array contains texts for more languages. **1\. Model: PHP exstensions list model code in zwamp.conf:** $phpExtContents = ''; // read liste des PHP extensions **$loaded\_extensions = get\_loaded\_extensions()**; // \[modif oto\] classement alphab?tique des extensions setlocale(LC\_ALL,"{$txtlang\[$jezik\]\['locale'\]}"); sort($loaded\_extensions,SORT\_LOCALE\_STRING); foreach ($loaded\_extensions as $extension) $phpExtContents .= "<li style=\\"${imgplugin};\\">${extension}</li>; view\_3cols\_list.php - View main displays array $phpExtContents : <dd><ul>${phpExtContents}</ul></dd> II. Notepad Replacer - handy for taskbartrayicon-rightclickmenu, but Notepad++ workspaces, projects and sessions are enough. ---------------------------------------------------------------------------------------------------------------------------- http://www.binaryfortress.com/NotepadReplacer/Discussions/View/wont-install-properly-on-win2008-sp2-x64/ID=04b032d7-ba27-49cf-b6cd-5057ec4a7b8e Replace Microsoft Notepad with Notepad++ (windows 8) : Regedit node created with **NotepadReplacerSetup-1.1.6.exe** : HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\notepad.exe. string (REG\_SZ) name "Debugger" value "C:\\Program Files (x86)\\Notepad Replacer\\NotepadReplacer.exe" /z --BEZ " i BEZ /z which opens J:\\aplp\\aplp\\3\_edit\\3\_Notepad++\\notepad++.exe III. SCRIPTS CODE (REFACTORED Feb, 2015) ----------------------------------------- 1. ****C:\\Windows\\system32\\drivers\\etc\\hosts **** ----------------------------------------------------- 127.0.0.1 localhost ::1 localhost 127.0.0.1 dev ::1 dev 2. **J:\\zwamp\\vdrive\\.sys\\Apache2\\conf\\httpd.conf** ------------------------------------------------------ or Z:\\.sys\\Apache2\\conf\\httpd.conf 3. **J:\\zwamp\\vdrive\\.sys\\Apache2\\conf\\vhosts.conf** ------------------------------------------------------- or Z:\\.sys\\Apache2\\conf\\vhosts.conf \# ZWAMP does: (subst Z: "J:\\zwamp\\vdrive") \# **http://dev:8083/** <VirtualHost \*:8083> Options All #Options +Includes +FollowSymLinks +Indexes +MultiViews #+ExecCGI DocumentRoot "**J:\\dev\_web\\htdocs**" ServerName **dev** </VirtualHost># **http://yii:8083/** - not available when listening port 8083 ! <VirtualHost \*:8083> DocumentRoot "**J:\\dev\_web\\htdocs\\aplyii\\frontend\\web**" ServerName **yii** </VirtualHost> \# --------------------------------- **\# http://localhost:8083/** <VirtualHost \*:8083> DocumentRoot "**J:\\zwamp\\vdrive\\web**" ServerName **localhost** </VirtualHost> 4. **J:\\zwamp\\vdrive\\.sys\\php\\php.ini** ----------------------------------------- \----- 5. **J:\\dev\_web\\htdocs\\index.php ** -------------------------------------- (if needed). Includes zwamp scripts - which all are **outside Apache doc.root J:\\dev\_web\\htdocs** (http://dev:8083/):**require**(realpath($\_SERVER\['DOCUMENT\_ROOT'\].'/../inc/zwamp/zwamp.php')) ; exit; 6. **J:\\dev\_web\\inc\\zwamp\\zwamp.php** --------------------------------------- \- Controller **outside Apache doc.root** (was : J:\\dev\_web\\htdocs\\01programi\\zwamp\\zwamp.php) [**....** ](http://phporacle.altervista.org/zwamp-server/zwamp-2/)\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* // 3. SHOW VIEW BITS - ee THIS SPA WEB PAGE - Single Page App. // \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* echo <<< EOPG $pghdr $view\_3cols\_list <br /><br /> $view\_nppreplacer $view\_zwamp $view\_hosts\_apachephpconf <br /><hr /> $view\_mongodb $view\_f3fw $view\_phpreports EOPG;/\*\* \* http://dev:8083/ = Apache virt.host \* or zwamp docroot: http://localhost/ \* J:\\dev\_web\\inc\\zwamp\\zwamp.php \* or J:\\zwamp\\vdrive\\web\\index.php \*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \* ~~~ C O N T R O L L E R ~~~ \* SPA web page (Single Page App.) - no url calls \* DOMAIN STYLE code organization - every app (page, oracle form form) own subdir \*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \*SHOWS VIEWS: main menu (1,2,3): \* 1.Alati (tools & help) \* 2.Programs (projects, dirs) \* 3.Aliases & virt.hosts \* 4.List below (php extensions) \* ... some help texts \* No DBI - CRUD scripts (could be sqlite for langs). \* - No page params of p o s t type - no forms \*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \* 1. PAGE PARAMS OF G E T TYPE (ACTION COMMANDS) \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \* 1.1 Display image code (from zwamp\_mdl.php) \* 1.2 Language icons in page hdr top right \* 1.3a PAGE NAVIGATION: PATH C A L L - I N C L U D E \* 1.3b URL C A L L - Location () \* \* No page params of p o s t type - no forms - no DBI \* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \* 2. INCLUDE VIEW BITS - LOAD THEM IN CONTENT VARIJABLES \* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \* \* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \* 3. SHOW VIEW BITS - ee THIS SPA WEB PAGE - Single Page App. \* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \* 7. J:\\dev\_web\\inc\\zwamp\\zwamp\_mdl.php ---------------------------------------- \- Configuration, set up, data (img code !) \----- 8. J:\\dev\_web\\inc\\zwamp\\zwamp\_hdr.php ---------------------------------------- \- View main hdr 9. J:\\dev\_web\\inc\\zwamp\\view\_3cols\_list.php ----------------------------------------------- \- View main body 10. J:\\dev\_web\\inc\\zwamp\\view\_zwamp.php ----------------------------------------- \- View zwamp and simmilar view code bits 11. Helpers - utils J:\\dev\_web\\htdocs\\inc\\utl\\showsource.php ---------------------------------------------------------------- & phpinfo & edservertxt.php & <php **// J:\\dev\_web\\inc\\utl\\kod\_edit\_run.php** function kod\_edit\_run($script\_dir\_path, $script\_name, $web\_docroot\_url) { $ds = DIRECTORY\_SEPARATOR; echo <<< EOKOD <a href="$web\_docroot\_url/inc/utl/showsource.php file=$script\_dir\_path$ds$script\_name &line=1&prev=10000&next=10000 " target="\_blank">&nbsp;kod</a> <a href="$web\_docroot\_url/inc/utl/edservertxt.php file=$script\_dir\_path$ds$script\_name " target="\_blank">&nbsp;edit</a> <a href="$web\_docroot\_url/phpinfo\_inc.php " target="\_blank">&nbsp;phpinfo</a> EOKOD; /\* call it so: kod\_edit\_run( $idx // script\_dir\_path , $idxscript // script\_name , MDURL); // web\_docroot\_url = (Apache) web server URL \*/ }