{"id":12220,"date":"2015-03-02T05:09:32","date_gmt":"2015-03-01T18:09:32","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=12220"},"modified":"2015-03-02T05:09:32","modified_gmt":"2015-03-01T18:09:32","slug":"wordpress-blog-context-help-mode-toggler-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-blog-context-help-mode-toggler-primer-tutorial\/","title":{"rendered":"WordPress Blog Context Help Mode Toggler Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/toggle_contexthelp_mode-0of.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Wordpress Blog Context Help Mode Toggler Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/toggle_contexthelp_mode-0of.jpg\" title=\"Wordpress Blog Context Help Mode Toggler Primer Tutorial\" id='xwbdm' onmouseover=\" this.src=this.src.replace('-0', '-x1').replace('-1', '-x2').replace('-2', '-x3').replace('-3', '-x4').replace('-4', '-x5').replace('-5', '-x6').replace('-6', '-x7').replace('-7', '-x8').replace('-8', '-x9').replace('-9', '-x0').replace('-x','-');   \"    \/><\/a><p class=\"wp-caption-text\">Wordpress Blog Context Help Mode Toggler Primer Tutorial<\/p><\/div>\n<p>On this WordPress Blog we&#8217;ve had a policy of providing default Ajax inspired contextual help as the default setting.   However it may be that you want to skip this contextual help if you &#8220;know the ropes&#8221; regarding navigating this blog, and so, we, today, offer the turning off of contextual help as an alternative, and if chosen, that mode of use stays for all visits (using that same Web Browser) for the computer you are using, until you reset the &#8220;toggler&#8221; to the other <i>context help mode<\/i> of use.<\/p>\n<p>So what facilitates this change in functionality?   Well, it is to do with whether the Javascript homegrown external file called wajax.js is loaded between &lt;head&gt; and &lt;\/head&gt; or not.  It is far easier to change &#8220;wajax.js&#8221; to &#8220;<a target=_blank style='text-decoration:none;' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/nothing.js_GETME' title='nothing.js'>nothing.js<\/a>&#8221; (our homegrown <i>&#8220;was going to be empty &#8230; but realized we need to keep a bit&#8221;<\/i> Javascript external file created to help with today&#8217;s tutorial) using PHP (a server side language) rather than Javascript (where using something like &#8220;document.head.innerHTML=document.head.innerHTML.replace(&#8216;waj&#8217; + &#8216;ax.js&#8217;, &#8216;noth&#8217; + &#8216;ing.js&#8217;);&#8221; does not appear to work nearly as well as you might, naively, imagine (but it may have been yet another bad hair day).<\/p>\n<p>And where might you add such functionality?   Well, we wanted it <i>above the <a target=_blank title='Above the fold information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Above_the_fold'>&#8220;fold&#8221;<\/a><\/i> somewhere, and we figured it affected lots of postings, so why not put it as a suboption or <a target=_blank title='WordPress Blog Submenu Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=11802'>submenu<\/a> of the <i>All Posts<\/i> menu.<\/p>\n<p>We make it effectively a single link to work, but give you the chance to refuse to do it with a Javascript <a target=_blank href='http:\/\/www.w3schools.com\/jsref\/met_win_prompt.asp' title='Javascript prompt window information from w3schools'><i>prompt<\/i><\/a> window, where we explain the implications in a little more detail than is applicable for a suboption submenu wording.<\/p>\n<p>So you can see the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/toggle_contexthelp_mode-0of.jpg\" title='Add Page'><i>Add Page<\/i><\/a> that that menu suboption required, and the piece of independent PHP programming source code required to make all this possible is <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/context_help.php_GETME\" title='context_help.php'>context_help.php<\/a>.  Go to another webpage on the blog and it should retain your last setting in a similar fashion &#8230; until you use the new submenu suboption to toggle it.<\/p>\n<p>If you want to see how good old header.php changed it is in three parts below (with <b>bold<\/b> bits of change) &#8230; up near the top (before anything significant happens in the code), then the decision about whether the homegrown external Javascript file should be &#8220;wajax.js&#8221; or &#8220;nothing.js&#8221;, and then around <i>courseCookies<\/i> (as per usual) versus, if you don&#8217;t have <i>course<\/i> functionality you can go <i>&lt;body onload=&#8221; ajaxcontexthelp_mode();  &#8220;&gt;<\/i> &#8230; just below, the nonbold bit is nonbold, because it first came into play with <a target=_blank title='WordPress Blog Download Mode Toggler Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=12156'>WordPress Blog Download Mode Toggler Primer Tutorial<\/a> &#8230;<\/p>\n<p><code><br \/>\nfunction my_t_d_server_remote_addr() {<br \/>\n    $rma = $_SERVER['REMOTE_ADDR'];<br \/>\n    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);<br \/>\n    \/\/ you can add different browsers with the same way ..<br \/>\n    if(preg_match('\/(chromium)[ \/]([w.]+)\/', $ua))<br \/>\n            $rma = '000000'.$rma;<br \/>\n    elseif(preg_match('\/(chrome)[ \/]([w.]+)\/', $ua))<br \/>\n            $rma = '00000'.$rma;<br \/>\n    elseif(preg_match('\/(safari)[ \/]([w.]+)\/', $ua))<br \/>\n            $rma = '0000'.$rma;<br \/>\n    elseif(preg_match('\/(opera)[ \/]([w.]+)\/', $ua))<br \/>\n            $rma = '000'.$rma;<br \/>\n    elseif(preg_match('\/(msie)[ \/]([w.]+)\/', $ua))<br \/>\n            $rma = '00'.$rma;<br \/>\n    elseif(preg_match('\/(mozilla)[ \/]([w.]+)\/', $ua))<br \/>\n            $rma = '0'.$rma;<br \/>\n    return $rma;<br \/>\n}<br \/>\n<b><br \/>\n$ajaxjs = \"wajax.js\";<br \/>\nif (file_exists(\"c_h_\" . my_t_d_server_remote_addr() . \"huh\")) {<br \/>\n  $ajaxjs = \"nothing.js\";<br \/>\n}<br \/>\n<\/b><br \/>\n<\/code><\/p>\n<p>&#8230; the bold bit below used to be &#8230; wajax.js &#8230;<\/p>\n<p><code><br \/>\n&lt;script type='text\/javascript' src='http:\/\/www.rjmprogramming.com.au\/wordpress\/wp-admin\/js\/<b>&lt;?php echo $ajaxjs; ?&gt;<\/b>'&gt;&lt;\/script&gt;<br \/>\n<\/code><\/p>\n<p>&#8230; and now the onload logic, in header.php &#8230;<\/p>\n<p><code><br \/>\n<b><br \/>\nfunction ajaxcontexthelp_mode() {<br \/>\n  var chdmjk=0;<br \/>\n&lt;?php<br \/>\nif (file_exists(\"c_h_\" . my_t_d_server_remote_addr() . \"huh\")) {<br \/>\n echo \"n\" . ' var choxli=document.getElementsByClassName(\"page-item-12212\");  if (choxli[0] != null) { var chns=choxli[0].innerHTML.replace(' . \"'Toggle Context Help Mode t' + 'o o' + 'ff', 'Toggle Context Help Mode t' + 'o o' + 'n'\" . ').replace(' . \"'Toggle Context Help Mode t' + 'o o' + 'ff', 'Toggle Context Help Mode t' + 'o o' + 'n'\" . ');  choxli[0].innerHTML=chns;  } ' . \"n\";<br \/>\n echo \"n\" . ' var chcoxli=document.getElementsByClassName(\"entry-title\");  if (chcoxli[0] != null) { chcoxli[0].innerHTML=chcoxli[0].innerHTML.replace(' . \"'Toggle Context Help Mode t' + 'o o' + 'ff', 'Toggle Context Help Mode t' + 'o o' + 'n'\" . ').replace(' . \"'Toggle Context Help Mode t' + 'o o' + 'ff', 'Toggle Context Help Mode t' + 'o o' + 'n'\" . ');  } ' . \"n\";<br \/>\n}<br \/>\n?&gt;<br \/>\n}<br \/>\n<\/b><br \/>\nfunction courseCookies() {<br \/>\n<b><br \/>\n  ajaxcontexthelp_mode();  \/\/ Check on Context Help mode<br \/>\n<\/b><br \/>\n  download_mode();  \/\/ Check on Download mode<br \/>\n  checkpt(); \/\/ category and tag \"oldest\"<br \/>\n  rptwo();  \/\/ Recent Post images<br \/>\n<\/code><\/p>\n<p>Our contextual help Javascript source code (all in the one place) can be downloaded by <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/wordpress\/wajax.js-------------GETME' title='wajax.js'>wajax.js<\/a> which changed as per <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/wordpress\/wajax.js-------------GETME' title='wajax.js'>wajax.js<\/a> for these modifications today.<\/p>\n<p>Hope you enjoy today&#8217;s tutorial and will leave you with a link to Wikipedia&#8217;s &#8220;take&#8221; on Ajax &#8230; lots of different interesting references <a target=_blank href='http:\/\/en.wikipedia.org\/wiki\/Ajax'>here<\/a>.<\/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='#d12220' onclick='var dv=document.getElementById(\"d12220\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=wordpress\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d12220' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>On this WordPress Blog we&#8217;ve had a policy of providing default Ajax inspired contextual help as the default setting. However it may be that you want to skip this contextual help if you &#8220;know the ropes&#8221; regarding navigating this blog, &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-blog-context-help-mode-toggler-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":[2,12,37],"tags":[69,151,216,259,576,653,932,1319,1456],"class_list":["post-12220","post","type-post","status-publish","format-standard","hentry","category-ajax","category-elearning","category-tutorials","tag-ajax","tag-blog","tag-cms","tag-contextual","tag-html","tag-javascript-programming","tag-php","tag-tutorial","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/12220"}],"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=12220"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/12220\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=12220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=12220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=12220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}