{"id":18850,"date":"2015-12-14T02:01:13","date_gmt":"2015-12-13T16:01:13","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=18850"},"modified":"2015-12-14T09:59:15","modified_gmt":"2015-12-13T23:59:15","slug":"the-three-p-three-modes-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/the-three-p-three-modes-primer-tutorial\/","title":{"rendered":"The Three P Three Modes Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/interactive_becomes_web.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"The Three P Three Modes Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/profile.jpg\" title=\"The Three P Three Modes Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">The Three P Three Modes Primer Tutorial<\/p><\/div>\n<p>Today we show three PHP modes of use with a Rudimentary Profile Report application, showing our usual (modes of use (ideas of)) &#8230;<\/p>\n<ul>\n<li>Surfing the Web &#8211; with a URL typed into web browser address bar and interactively piecing together the (profile) report<\/li>\n<li>Command Line PHP &#8211; with an interactive entry session on the (Bash) Linux command line on a MacBook Pro Terminal application session, and then firing off the report to a web browser (profile) report<\/li>\n<li>Curl use of PHP &#8211; with a command on the (Bash) Linux command line on a MacBook Pro Terminal application session, and then firing off an interactive web page piecing together the (profile) report to a web browser report<\/li>\n<\/ul>\n<p>And today we detect The Three P&#8217;s sleigh riding again, with &#8230;<\/p>\n<ul>\n<li>PHP as the primary web server language used, using its <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'>exec<\/a> method to call &#8230;<\/li>\n<li>Python helps the Command Line PHP and Curl use of PHP modes fire up the web page in a web browser from the command line via the <a target=_blank title='Advice for this came from this useful link ... thanks' href='http:\/\/stackoverflow.com\/questions\/3124556\/clean-way-to-launch-the-web-browser-from-shell-script'>-mwebbrowser<\/a> (Python command line usage) switch<\/li>\n<li>Perl is used, a bit like the Linux <i>sed<\/i> command, to help the Command Line PHP and Curl use of PHP modes populate the Javascript DOM innerHTML property of the following web page&#8217;s H1 heading, to give context to whose profile is involved<\/li>\n<\/ul>\n<p>We tried an idea for the first time today.  Paring it down, the idea is the use of a PHP function &#8230;<\/p>\n<p><code><br \/>\nfunction get_line($inidea, $j) {<br \/>\n  $suffix=\"\";<br \/>\n  if ($j == 1) $suffix=\"&lt;script&gt; document.getElementById('myh1').innerHTML='Profile for ' + document.getElementById('t0').innerHTML + ' ' + document.getElementById('t1').innerHTML; &lt;\/script&gt;\";<br \/>\n  return \"\\n\" . '&lt;script&gt; document.write((\"&lt;td&gt;' . $inidea . '&lt;\/td&gt;&lt;td id=t' . $j . '&gt;\" + prompt(\"What is your ' . $inidea . '?  You can Cancel or OK nothing.\",\"\") + \"&lt;\/td&gt;\").replace(\"&lt;td&gt;' . $inidea . '&lt;\/td&gt;&lt;td id=t' . $j . '&gt;&lt;\/td&gt;\",\"&lt;td&gt;&lt;\/td&gt;&lt;td id=t' . $j . '&gt;&lt;\/td&gt;\").replace(\"&lt;td&gt;' . $inidea . '&lt;\/td&gt;&lt;td id=t' . $j . '&gt;null&lt;\/td&gt;\",\"&lt;td&gt;&lt;\/td&gt;&lt;td id=t' . $j . '&gt;&lt;\/td&gt;\")); &lt;\/script&gt;' . $suffix . \"\\n\";<br \/>\n}<br \/>\n<\/code><\/p>\n<p> &#8230; that embeds within a &lt;tr&gt;&lt;\/tr&gt; HTML table row, cell data information within those rows &#8220;on the fly&#8221;, by interactively asking for Profile (Report) information, at the client, via the Javascript <a target=_blank title='Javascript prompt() method information' href='http:\/\/www.w3schools.com\/jsref\/met_win_prompt.asp'>prompt()<\/a> method, encased within the Javascript DOM <a target=_blank title='Javascript DOM document.write() method information' href='http:\/\/www.w3schools.com\/jsref\/met_doc_write.asp'>document.write()<\/a> method.<\/p>\n<p>So please take a look at the PHP source code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/interactive_becomes_web.php_GETME\" title=\"interactive_becomes_web.php\">interactive_becomes_web.php<\/a> and for that first Surfing the Web mode we can give you a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/interactive_becomes_web.php\" title=\"Click picture\">live run<\/a> link to peruse, as well.  We hope this helps you with some ideas.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d18850' onclick='var dv=document.getElementById(\"d18850\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/php\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d18850' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Today we show three PHP modes of use with a Rudimentary Profile Report application, showing our usual (modes of use (ideas of)) &#8230; Surfing the Web &#8211; with a URL typed into web browser address bar and interactively piecing together &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/the-three-p-three-modes-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[352,405,707,916,932,997,1761,1012,1115,1319],"class_list":["post-18850","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-document-write","tag-exec","tag-linux","tag-perl","tag-php","tag-programming","tag-prompt","tag-python","tag-sed","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/18850"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=18850"}],"version-history":[{"count":9,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/18850\/revisions"}],"predecessor-version":[{"id":18869,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/18850\/revisions\/18869"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=18850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=18850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=18850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}