WordPress Blog Thread Story Background Gradients Tutorial

WordPress Blog Thread Story Background Gradients Tutorial

WordPress Blog Thread Story Background Gradients Tutorial

Today we’re nuancing the “storybook” styling we developed in yesterday’s WordPress Blog Thread Story Border SVG Image Tutorial where you may have been wondering about the papers part to codeline …


$atofind="\n atofind.className='storybook papers'; \n atofind.oncontextmenu=function(event){ event.target.style.zoom='' + eval(0.05 + eval('' + event.target.style.zoom)); }; \n";

? Well, that was to do with how we wanted to not only make …

  • the left hand border have that “ring binder” feel … but we also wanted …
  • some sort of effect applied to the “storybook” background as some sort of feel whereby we might think “paper”

We did not want to involve any images or CSS that was too complicated. We came across this excellent webpage and it gave us the inspiration for new such CSS styling

<style>

.storybook {
border-image: url('data:image/svg+xml,<svg style="font-size:26px;background-color:rgb(255,255,240,0.8);border-right:1px solid black;" width="20" height="20" viewBox="0 0 20 20" xmlns="//www.w3.org/2000/svg"><text style="opacity:0.5;" x="15%" y="80%">☌</text><rect x="18.5" y="0" width="1.5" height="20" stroke-width="1.5" stroke="black" fill="black"></rect></svg>');
border-image-slice: 0 0 0 100;
border-image-width: 20px;
border-image-outset: 1px;
border-image-repeat: repeat;
padding-left: 20px;
}

<?php
if (isset($_GET['putpaper']) || 1 == 1) { // thanks to https://www.30secondsofcode.org/css/s/10-css-background-patterns/
echo " .papers {
background-color: #fefefe;
background-image: linear-gradient(
30deg,
rgba(83,148,253,0.05) 12%,
transparent 12.5%,
transparent 87%,
rgba(83,148,253,0.05) 87.5%,
rgba(83,148,253,0.05)
),
linear-gradient(
150deg,
rgba(83,148,253,0.05) 12%,
transparent 12.5%,
transparent 87%,
rgba(83,148,253,0.05) 87.5%,
rgba(83,148,253,0.05)
),
linear-gradient(
30deg,
rgba(83,148,253,0.05) 12%,
transparent 12.5%,
transparent 87%,
rgba(83,148,253,0.05) 87.5%,
rgba(83,148,253,0.05)
),
linear-gradient(
150deg,
rgba(83,148,253,0.05) 12%,
transparent 12.5%,
transparent 87%,
rgba(83,148,253,0.05) 87.5%,
rgba(83,148,253,0.05)
),
linear-gradient(
60deg,
rgba(83,148,253,0.05) 25%,
transparent 25.5%,
transparent 75%,
rgba(83,148,253,0.05) 75%,
rgba(83,148,253,0.05)
),
linear-gradient(
60deg,
rgba(83,148,253,0.05) 25%,
transparent 25.5%,
transparent 75%,
rgba(83,148,253,0.05) 75%,
rgba(83,148,253,0.05)
);
background-size: 48px 84px;
background-position:
0 0,
0 0,
24px 42px,
24px 42px,
0 0,
24px 42px;
}

";
}
?>

</style>

… helped out by tweaked header.php Javascript code …

<?php echo ”

function storyizecollect() {
var divsall=document.getElementsByTagName('div');
for (var ivd=0; ivd<divsall.length; ivd++) {
if (divsall[ivd].outerHTML.split('>')[0].indexOf(' post type-post ') != -1) {
threaddivs.push('' + divsall[ivd].id);
}
}
}

function storyresize(atoo) {
atoo.style.width='' + atoo.getAttribute('data-w') + 'px';
//atoo.style.height='' + atoo.getAttribute('data-h') + 'px';
atoo.style.backgroundColor='rgba(255,155,55,0.3)';
atoo.style.overflow='hidden';
return atoo;
}

function storyreorder(atofind) {
var hrparts=[], hroh='', reorderedcontent='', hrih='', hrdone=false, hrplus='';
var atobr=atofind.getBoundingClientRect();
if (('' + atofind.getAttribute('data-w')) == '0') {
atofind.setAttribute('data-w',('' + atobr.width));
atofind.setAttribute('data-h',('' + atobr.height));
}
atofind.setAttribute('data-st',('' + document.body.scrollTop));
for (var ivd=0; ivd<threaddivs.length; ivd++) {
if (document.getElementById(threaddivs[ivd])) {
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf(atofind.outerHTML) != -1 && !hrdone) {
atofind.setAttribute('data-done', 'y');
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
var pwis=0;
if (navigator.userAgent.match(/iPad/i)) {
pwis=eval('' + document.getElementById('primary').getBoundingClientRect().width);
}
atofind.style.width='' + eval(-40 + eval('' + document.getElementById('container').getBoundingClientRect().width) - pwis) + 'px';
} else {
atofind.style.width='' + eval(-40 + eval('' + document.getElementById('container').getBoundingClientRect().width) - eval('' + document.getElementById('primary').getBoundingClientRect().width)) + 'px';
}
atofind.style.color='rgb(70,70,70)';
atofind.style.textShadow='-0.5px 0.5px 0.5px #952dff';
atofind.style.overflow='scroll';
atofind.style.borderLeft='1px dashed red';
atofind.style.WebkitOverflowScrolling='touch';
<?php echo $atofind; ?>
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf('<hr title=') != -1) { hrplus=' title='; }
hrparts=document.getElementById(threaddivs[ivd]).innerHTML.split('<hr' + hrplus);
if (eval('' + hrparts.length) > 1) {
hrih='<hr' + hrplus + hrparts[1].split('>')[0] + '>';
if (hrih.indexOf('/>') == -1 && document.getElementById(threaddivs[ivd]).innerHTML.indexOf('</hr>') != -1) {
hrih+='</hr>';
}
hroh='<hr' + hrplus + hrparts[1].split('>')[0].replace(/\//g,'') + '></hr>';
}
if (hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent='<div style=display:none;>' + hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent=hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'');
}
for (var iivd=eval(-2 + eval('' + hrparts.length)); iivd>=0; iivd--) {
if (hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent+=hroh.replace('<hr','<hr style="display:none;"');
reordercontent='<div style=display:none;>' + hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent+=hroh;
reordercontent+=reordercontent=hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'');
}
}
if (reordercontent != '') {
hrdone=true;
atofind.innerHTML+='<br><details title="Thread story ..." open><summary title="Thread story ..."></summary><br>' + reordercontent + '</details>';
reordercontent='';
}
}
}
}
}

function storymember(inoh) {
if (inoh.indexOf('<div data-w=') == 0) { return true; }
if (inoh.indexOf('<details') == 0) { return true; }
if (inoh.indexOf('<div class="entry-content"') == 0) { return true; }
return false;
}

“; ?>

… to create a more convincing effect for the user, we’re hoping!


Previous relevant WordPress Blog Thread Story Border SVG Image Tutorial is shown below.

WordPress Blog Thread Story Border SVG Image Tutorial

WordPress Blog Thread Story Border SVG Image Tutorial

The border-image CSS property, used well, can be a really powerful web design tool. We decided to show a user they were in, like, “storybook mode” reading our blog, further to yesterday’s WordPress Blog Thread Story Mode Tutorial, by applying a new …

  • border-image … ala “ring binder” (via use of ☌ &#9740; “conjunction” emoji symbol), only on the left … via (header.php, again) …
  • SVG …
  • text

… using new CSS styling …

<style>

.storybook {
border-image: url('data:image/svg+xml,<svg style="font-size:20px;" width="20" height="20" viewBox="0 0 20 20" xmlns="//www.w3.org/2000/svg"><text x="10%" y="80%">☌</text></svg>');
border-image-slice: 0 0 0 100;
border-image-width: 20px;
border-image-outset: 2px;
border-image-repeat: repeat;
padding-left: 20px;
}

</style>

… referenced in a newly introduced PHP variable …

<?php

$atofind="\n atofind.className='storybook papers'; \n atofind.oncontextmenu=function(event){ event.target.style.zoom='' + eval(0.05 + eval('' + event.target.style.zoom)); }; \n";

?>

… used in “storybook” class specific Javascript …

<?php echo ”

function storyizecollect() {
var divsall=document.getElementsByTagName('div');
for (var ivd=0; ivd<divsall.length; ivd++) {
if (divsall[ivd].outerHTML.split('>')[0].indexOf(' post type-post ') != -1) {
threaddivs.push('' + divsall[ivd].id);
}
}
}

function storyresize(atoo) {
atoo.style.width='' + atoo.getAttribute('data-w') + 'px';
//atoo.style.height='' + atoo.getAttribute('data-h') + 'px';
atoo.style.backgroundColor='rgba(255,155,55,0.3)';
atoo.style.overflow='hidden';
return atoo;
}

function storyreorder(atofind) {
var hrparts=[], hroh='', reorderedcontent='', hrih='', hrdone=false, hrplus='';
var atobr=atofind.getBoundingClientRect();
if (('' + atofind.getAttribute('data-w')) == '0') {
atofind.setAttribute('data-w',('' + atobr.width));
atofind.setAttribute('data-h',('' + atobr.height));
}
atofind.setAttribute('data-st',('' + document.body.scrollTop));
for (var ivd=0; ivd<threaddivs.length; ivd++) {
if (document.getElementById(threaddivs[ivd])) {
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf(atofind.outerHTML) != -1 && !hrdone) {
atofind.setAttribute('data-done', 'y');
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
var pwis=0;
if (navigator.userAgent.match(/iPad/i)) {
pwis=eval('' + document.getElementById('primary').getBoundingClientRect().width);
}
atofind.style.width='' + eval(-40 + eval('' + document.getElementById('container').getBoundingClientRect().width) - pwis) + 'px';
} else {
atofind.style.width='' + eval(-40 + eval('' + document.getElementById('container').getBoundingClientRect().width) - eval('' + document.getElementById('primary').getBoundingClientRect().width)) + 'px';
}
atofind.style.overflow='scroll';
atofind.style.borderLeft='1px dashed red';
atofind.style.WebkitOverflowScrolling='touch';
<?php echo $atofind; ?>
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf('<hr title=') != -1) { hrplus=' title='; }
hrparts=document.getElementById(threaddivs[ivd]).innerHTML.split('<hr' + hrplus);
if (eval('' + hrparts.length) > 1) {
hrih='<hr' + hrplus + hrparts[1].split('>')[0] + '>';
if (hrih.indexOf('/>') == -1 && document.getElementById(threaddivs[ivd]).innerHTML.indexOf('</hr>') != -1) {
hrih+='</hr>';
}
hroh='<hr' + hrplus + hrparts[1].split('>')[0].replace(/\//g,'') + '></hr>';
}
if (hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent='<div style=display:none;>' + hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent=hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'');
}
for (var iivd=eval(-2 + eval('' + hrparts.length)); iivd>=0; iivd--) {
if (hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent+=hroh.replace('<hr','<hr style="display:none;"');
reordercontent='<div style=display:none;>' + hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent+=hroh;
reordercontent+=reordercontent=hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'');
}
}
if (reordercontent != '') {
hrdone=true;
atofind.innerHTML+='<br><details title="Thread story ..." open><summary title="Thread story ..."></summary><br>' + reordercontent + '</details>';
reordercontent='';
}
}
}
}
}

function storymember(inoh) {
if (inoh.indexOf('<div data-w=') == 0) { return true; }
if (inoh.indexOf('<details') == 0) { return true; }
if (inoh.indexOf('<div class="entry-content"') == 0) { return true; }
return false;
}

“; ?>

… “retweaked” reworking of the “blog posting thread” order from oldest through to most recent, like a “story” view of the “blog posting thread” ideas and development. You might notice that we often start a “thread” involving the word “Primer” in the blog posting title.


Previous relevant WordPress Blog Thread Story Mode Tutorial is shown below.

WordPress Blog Thread Story Mode Tutorial

WordPress Blog Thread Story Mode Tutorial

We feel a “tweak” coming on. It’s been a while since the last such “tweak”. We’re talking about doing the frequent …

  • good ol’ “tweaking” of header.php … owned by our …
  • wordpress.org based WordPress Blog …
  • theme TwentyTen … means by which we …
  • can “tweak” in the morning, at supper time, and in small cubicles the look and feel and “way it works” aspects to the blog you are reading

Yes, it’s mainly header.php we use, though do remember functions.php, footer.php, 404.php and some plugins as well, but the “tweaking” of header.php is the easiest, for most jobs.

Picking up from the, largely, document.body onload event interventions we make happen this way, we latch onto a previous intervention, and “retweak” that (past work related to WordPress Is Mentioned By Less Recently Modified Tutorial), today, to add …


New "Story Mode" display of a thread of WordPress blog postings

… this use of “thread” not being a technical term, rather how we describe how we string together related blog postings (that usually follow each other reverse chronologically (ie. latest blog posting first)) into, what we term, a “blog posting thread”.

But yesterday, suddenly, it dawned on us, that this “blog posting thread” can be confusing for readers coming in to the discussion half way through, or near the end, so why not offer them a new 📖 (&#128214; … ie. story) based (adding to a global var threaddivs=[]; statement part) …

<?php echo ”

function storyizecollect() {
var divsall=document.getElementsByTagName('div');
for (var ivd=0; ivd<divsall.length; ivd++) {
if (divsall[ivd].outerHTML.split('>')[0].indexOf(' post type-post ') != -1) {
threaddivs.push('' + divsall[ivd].id);
}
}
}

function storyresize(atoo) {
//atoo.style.width='' + atoo.getAttribute('data-w') + 'px';
//atoo.style.height='' + atoo.getAttribute('data-h') + 'px';
atoo.style.backgroundColor='rgba(255,155,55,0.3)';
atoo.style.overflow='hidden';
return atoo;
}

function storyreorder(atofind) {
var hrparts=[], hroh='', reorderedcontent='', hrih='', hrdone=false, hrplus='';
var atobr=atofind.getBoundingClientRect();
atofind.setAttribute('data-w',('' + atobr.width));
atofind.setAttribute('data-h',('' + atobr.height));
atofind.setAttribute('data-st',('' + document.body.scrollTop));
for (var ivd=0; ivd<threaddivs.length; ivd++) {
if (document.getElementById(threaddivs[ivd])) {
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf(atofind.outerHTML) != -1 && !hrdone) {
atofind.setAttribute('data-done', 'y');
atofind.style.overflow='scroll';
atofind.style.borderLeft='1px dashed red';
atofind.style.WebkitOverflowScrolling='touch';
atofind.style.zoom='0.4';
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf('<hr title=') != -1) { hrplus=' title='; }
hrparts=document.getElementById(threaddivs[ivd]).innerHTML.split('<hr' + hrplus);
if (eval('' + hrparts.length) > 1) {
hrih='<hr' + hrplus + hrparts[1].split('>')[0] + '>';
if (hrih.indexOf('/>') == -1 && document.getElementById(threaddivs[ivd]).innerHTML.indexOf('</hr>') != -1) {
hrih+='</hr>';
}
hroh='<hr' + hrplus + hrparts[1].split('>')[0].replace(/\//g,'') + '></hr>';
}
if (hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent='<div style=display:none;>' + hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent=hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'');
}
for (var iivd=eval(-2 + eval('' + hrparts.length)); iivd>=0; iivd--) {
if (hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent+=hroh.replace('<hr','<hr style="display:none;"');
reordercontent='<div style=display:none;>' + hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent+=hroh;
reordercontent+=reordercontent=hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'');
}
}
if (reordercontent != '') {
hrdone=true;
atofind.innerHTML+='<br><details title="Thread story ..." open><summary title="Thread story ..."></summary><br>' + reordercontent + '</details>';
reordercontent='';
}
}
}
}
}


function storymember(inoh) {
if (inoh.indexOf('<div data-w=') == 0) { return true; }
if (inoh.indexOf('<details') == 0) { return true; }
return false;
}


function is_mentioned_by() {
//rppspana=docgetclass("widget-title", "h3");
var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2"); // search URL returns
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>&#9986;</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>&#127939;&#127998;&#8205;&#9792;&#65039;&#127939;&#127996;&#8205;&#9794;&#65039;</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; setTimeout(precheckclass,3000); " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div data-w="0" data-h="0" data-st="0" data-style="-webkit-overflow-scrolling:touch;overflow:scroll;" data-done="" onclick=" if (' + "('' + " + 'event.target.id) == this.id || 1 == 1) { if (this.getAttribute(' + "'data-done'" + ').length == 0) { storyreorder(this); } else if (storymember(event.target.outerHTML)) { this.style.zoom=1.0; storyresize(this).innerHTML=' + "'&#128214;'" + '; this.setAttribute(' + "'data-done',''" + '); window.scrollTo(0,this.getAttribute(' + "'data-st'" + ')); } } " title="Reorder thread blog postings to read like a story ..." style="display:inline-block; text-decoration:none; cursor:pointer; background-color:rgba(255,155,55,0.3);" id=r' + zspare + '>&#128214;</div>';
}
}
xpspana=docgetclass("entry-title", "h1"); // real blog postings
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>&#9986;</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>&#127939;&#127998;&#8205;&#9792;&#65039;&#127939;&#127996;&#8205;&#9794;&#65039;</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " setTimeout(precheckclass,3000); title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div data-w="0" data-h="0" data-st="0" data-style="-webkit-overflow-scrolling:touch;overflow:scroll;" data-done="" onclick=" if (' + "('' + " + 'event.target.id) == this.id || 1 == 1) { if (this.getAttribute(' + "'data-done'" + ').length == 0) { storyreorder(this); } else if (storymember(event.target.outerHTML)) { this.style.zoom=1.0; storyresize(this).innerHTML=' + "'&#128214;'" + '; this.setAttribute(' + "'data-done',''" + '); window.scrollTo(0,this.getAttribute(' + "'data-st'" + ')); } } " title="Reorder thread blog postings to read like a story ..." style="display:inline-block; text-decoration:none; cursor:pointer; background-color:rgba(255,155,55,0.3);" id=r' + zspare + '>&#128214;</div>';
}
}
storyizecollect();
}

“; ?>

… reworking of the “blog posting thread” order from oldest through to most recent, like a “story” view of the “blog posting thread” ideas and development. You might notice that we often start a “thread” involving the word “Primer” in the blog posting title.


Previous relevant WordPress Is Mentioned By Less Recently Modified Tutorial is shown below.

WordPress Is Mentioned By Less Recently Modified Tutorial

WordPress Is Mentioned By Less Recently Modified Tutorial

Supposing you came in here paying scant attention to the Blog Posting Title and its Animated GIF Tutorial picture I’d like to set you the challenge to look at the build up to organizing the use of the theme for today’s tutorial, and you try to anticipate what that may be? Up to the challenge? We hope so, because, with respect to the recent WordPress Is Mentioned By Recently Modified Tutorial‘s …

  • MySql SQL …
    <?php

    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, -1 as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 WEEK " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

    ?>
    … we changed it to be
    <?php

    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, (-480 + TIMESTAMPDIFF(MINUTE,NOW()," . $tname . ".post_modified)) as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 MONTH " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

    ?>
    … to fit in with …
  • we changed the modified is_mentioned_by.php‘s SQL result set logic “if logic framework” … from
    <?php

    while (($r_array = mysql_fetch_row($res))) {
    if ($r_array[3] == "-1" && strtolower($r_array[3]) == strtolower($r_array[4])) {
    // this is a member of the modified list (via middle UNION SELECT) of the MySQL SQL query result set
    } else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
    // matches current post logic goes here
    } else {
    // does not match current post logic goes here
    }
    }

    ?>
    to
    <?php

    while (($r_array = mysql_fetch_row($res))) {
    if ($r_array[3] == "-1" && strpos(("" . $r_array[4]), "-") !== false) {
    // this is a member of the modified (and less recently modified) list (via middle UNION SELECT) of the MySQL SQL query result set
    } else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
    // matches current post logic goes here
    } else {
    // does not match current post logic goes here
    }
    }

    ?>
    … turning a “binary” piece of logic into a “ternary” (and above) one … as well as, for good ol’ header.php we add some global Javascript variables

    var coption='option';
    var cdisabled='disabled';
    var chidden='hidden';
    var cblank='_blank';

Is it apparent to you now what we are using to achieve some new “Less Recently Modified Tutorial” list data onto the “Recently Modified Tutorial” list data of below? But how do we go about doing that, that has been an enthusiasm around here, of recent times? What if we could say …

  • we changed the modified is_mentioned_by.php‘s SQL result set logic “within that top if logic” … from
    <?php

    if ($secresult == "") {
    $secresult=" <span id=xdrpl><select style=\"background-color:orange;display:inline-block;width:80px;\" id=mr" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Modified recently (over last week)\"><option value=\"\">Modified</option></select></span> ";
    }
    $secresult=str_replace('>Modified</option>','>Modified</option><option value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . '>' . $r_array[0] . '</option>', $secresult);

    ?>
    to
    <?php

    if ($secresult == "") {
    $secresult=" <span id=xdrpl><select style=\"background-color:orange;display:inline-block;width:80px;\" id=mr" . permalinkit($ourtitle) . " onchange=\"if (this.value.trim().length == 0) { var optslst=document.getElementsByTagName(coption); for (var ioptslst=0; ioptslst<optslst.length; ioptslst++) { if (optslst[ioptslst].outerHTML.indexOf(this.value) != -1) { if (optslst[ioptslst].outerHTML.indexOf(cdisabled) != -1) { optslst[ioptslst].removeAttribute(cdisabled); } if (optslst[ioptslst].outerHTML.indexOf(chidden) != -1) { optslst[ioptslst].removeAttribute(chidden); } } } } else { window.open(this.value,cblank); }\" title=\"Modified recently (over last week)\"><option value=\"\">Modified</option></select></span> ";
    }
    if ($r_array[4] <= -11520) {
    $blks=(40 - floor((0 - $r_array[4]) / (24 * 60)));
    $optv='<option value="">Enable and show through to ' . (40 - $blks) . ' days';
    $altv=' title=""';
    for ($iblks=0; $iblks<$blks; $iblks++) {
    $altv=str_replace(' title="', ' title=" ', $altv);
    $optv=str_replace(' value="', ' value=" ', $optv);
    }
    if (strpos($secresult, $optv) !== false) { $secresult=str_replace($optv . " ... ",$optv . " ... " . $r_array[0] . " and ",$secresult); $optv=""; } else { $optv .= " ... " . $r_array[0] . "</option>"; }
    $secresult=str_replace('>Modified</option>','>Modified</option>' . $optv . '<option' . $altv . ' value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . ' disabled hidden>' . $r_array[0] . '</option>', $secresult);
    } else {

    $secresult=str_replace('>Modified</option>','>Modified</option><option value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . '>' . $r_array[0] . '</option>', $secresult);
    }

    ?>
  • and does the disabled hidden above tell you more?

Yes, back with the recent Emoji Circuit Quiz Animated Emoji Tutorial you might recall …

We’ve also long been interested in HTML select (dropdown) element option (subelement) disabling and/or hiding (statically or dynamically (as with today’s Javascript work)), and today, for the first time for us, we put this into action

… and we’ve found a new (probably you’d say, “more apt”) use of this idea. We differentiate the …

  • arguably more potent “week’s worth” of modified postings list (as per WordPress Is Mentioned By Recently Modified Tutorial‘s situation) … still as is, and “singly selectable” … with …
  • new less potent (you could argue) “older than one week and up to one month” of modified postings list that can be made “singly selectable” by the user (but don’t start that way, because they initially have “hidden” and “disabled” option element attributes set) … and …
  • in order to save space and honour those platforms that really render the “hidden” option tags we add “older than one week and up to one month” blog posting titles onto the “selectable day age” ones (all causing a select (dropdown) element value property of blank (if trimmed … ie. their length matches (40 – number of days age)) so that that new Javascript onchange logic can just look for a select element value existing in an option (list) member outerHTML property in order to decide whether to remove the “disabled” and “hidden” properties initially populated into those option “older than one week and up to one month” elements

Now can we recommend turning off the “scant attention” and having a look at today’s animated GIF tutorial picture showing a bit of how this new functionality works in practice here at the WordPress TwentyTen themed blog you are reading up with the emoji button (you click) above.

For biassed moi, just another reason to keep on admiring and using the ever useful HTML select (dropdown) element in our web applications.


Previous relevant WordPress Is Mentioned By Recently Modified Tutorial is shown below.

WordPress Is Mentioned By Recently Modified Tutorial

WordPress Is Mentioned By Recently Modified Tutorial

Administering this blog there are two major criteria that would cause a blog posting’s modified date to change, that being …

  1. at this blog we schedule one new blog post per day … and …
  2. as we see things, on an ad hoc basis, we’ll make changes

… but that “Recent Posts” widget you see at this blog only reflects blog post criteria 1 above. Supposing you are following a thread of blog posts or an old blog post, try out the code and see that there is something amiss. How could this possibly be so! Yes, humanity rainsreigns, and we are scouring the postings you might visit to see what you might see, as a basis for revisits to code of the past.

And pretty naturally, if we find an issue, and can do something about it, with that category 2 blog posting type above, we may change one or other or both of …

  • the underlying code of said category 2 blog posting … and/or, as applicable …
  • the blog posting content of said category 2 blog posting

… the latter of which will cause that blog posting’s modified date to change, and as of today, adding onto yesterday’s WordPress Is Mentioned By Posting Order Tutorial, your clicking of “Is Mentioned By” “emoji button” above to change the “Recent Posts” widget title to “Recent Posts”, that (select element) dropdown populated in chronological order by a week’s worth of modified date changes at this blog. Using this, you may get an update to something you cannot figure, else drop us a line.

What needed to change for this? Well, first off, we’d like to thank the inspiration of 27 Handy SQL Query Hacks for WordPress for the means by which we changed is_mentioned_by.php‘s central SQL SELECT (DML) statement should receive a new UNION clause as per

<?php

$res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, -1 as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 WEEK " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

?>

… that -1 as tfind, -1 as tother an intentional ploy to fit in with a new “if” clause in the PHP (that loops through database record reads of the MySql SQL query above) as per

<?php

$secresult="";
if ($res == 0) {
if (1 == 2) echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");
} else if (mysql_num_rows($res) == 0) {
if (1 == 2) echo("<b>Query executed successfully</b>");
$retval=$delim;
$retval = str_replace(" }", " parent.document.getElementById('d" . permalinkit($ourtitle) . "').innerHTML='<select style=background-color:yellow; id=" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Is mentioned by\"><option value=\"\">Sadly, this tutorial is not mentioned by any others, yet</option></select>'; }", $retval);
} else {
while (($r_array = mysql_fetch_row($res))) {
if ($r_array[3] == "-1" && strtolower($r_array[3]) == strtolower($r_array[4])) {
if ($secresult == "") {
$secresult=" <span id=xdrpl><select style=\"background-color:orange;display:inline-block;width:80px;\" id=mr" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Modified recently (over last week)\"><option value=\"\">Modified</option></select></span> ";
}
$secresult=str_replace('>Modified</option>','>Modified</option><option value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . '>' . $r_array[0] . '</option>', $secresult);
}
else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
$isize++;
$retval = str_replace(" }", " isize++; theseopts=theseopts.replace(' size=' + eval(-1 + isize) + ' ', ' size=' + isize + ' ').replace('>','><option value=HTTP://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . " selected>" . $r_array[0] . pluckfirstreal($r_array[2]) . "</option>'); }", $retval);
} else {
$pdate = $r_array[1];
if ($retval == "") {
$retval=$delim;
$retval = str_replace(" }", " var theseoptions='<select style=background-color:yellow; id=" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Is mentioned by\"><option value=\"\">This tutorial is mentioned by ...</option></select>'; }", $retval);
$retval = str_replace(" }", " var theseopts='<select si' + 'ze=0 style=width:100%;background-color:#f0f0f0; class=select_ms id=z" . permalinkit($ourtitle) . " onchange=changed(this.value,ocb); title=\"Is part of a blog posting thread ... and you can select multiple tutorials to show\"></selec' + 't>'; }", $retval);
}
if ($r_array[3] != "0") $retval = str_replace(" }", " theseoptions=theseoptions.replace('</select>','<option value=HTTP://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . ">" . $r_array[0] . "</option></select>'); }", $retval);
if ($criteria != "") {
if (str_replace($criteria, "", $r_array[0]) != $r_array[0] && $r_array[4] != "0") {
$found = true;
$isize++;
$retval = str_replace(" }", " isize++; theseopts=theseopts.replace(' size=' + eval(-1 + isize) + ' ', ' size=' + isize + ' ').replace('>','><option value=HTTP://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . ">" . $r_array[0] . pluckfirstreal($r_array[2]) . "</option>'); }", $retval);
}
}
}
}
if ($retval != "") {
if (!$found) {
$retval = str_replace(" }", " theseopts=''; }", $retval);
} else {
$retval = str_replace(" }", " theseoptions+=(' ' + theseopts); }", $retval);
}
$retval = str_replace(" }", " parent.document.getElementById('d" . permalinkit($ourtitle) . "').innerHTML=theseoptions; parent.checkclass(\"\"); }", $retval);
}
}
mysql_close($link); // close the MySql database connection
if ($retval != "") {
if ($secresult != "") {
$retval=str_replace("></selec' + 't>';", "></selec' + 't>' + '" . $secresult . "'; ", $retval);
}

echo $retval; // this get communicated back to TwentyTen theme's header.php changes as explained below ...
}

?>

… teaming up with this blog’s TwentyTen theme’s (good ol’) header.php changes (to suit above) that go

<?php

var rppspana=null;

function rpcheck() {
if (rppspana == null) {
var h3sare=document.getElementsByTagName('h3');
for (var ih3sare=0; ih3sare<h3sare.length; ih3sare++) {
if (('' + h3sare[ih3sare].innerHTML).indexOf('cent Post') != -1) { rppspana=h3sare[ih3sare]; }
}
}
if (rppspana != null && document.getElementById('xdrpl')) {
if (rppspana.innerHTML.indexOf('cent Post') != -1 && document.getElementById('xdrpl').innerHTML != '') {
var dx=document.getElementById('xdrpl').innerHTML;
document.getElementById('xdrpl').innerHTML='';
rppspana.innerHTML=rppspana.innerHTML.replace('cent Post', 'cent ' + dx + ' Post');
} else {
setTimeout(rpcheck, 4000);
}
} else if (document.getElementById('xdrpl')) {
setTimeout(rpcheck, 4000);
} else if (rppspana != null) {
setTimeout(rpcheck, 4000);
}
}


function preresize_font(aois) {
setTimeout(rpcheck, 3000);
zzzspare=aois.id.replace('t','d');
resize_font();
}

function is_mentioned_by() {
var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2"); // search URL returns
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>✂</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>🏃🏾‍♀️🏃🏼‍♂️</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; setTimeout(precheckclass,3000); " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
}
}
xpspana=docgetclass("entry-title", "h1"); // real blog postings
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>✂</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>🏃🏾‍♀️🏃🏼‍♂️</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " setTimeout(precheckclass,3000); title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
}
}
}

?>

… to move this newly created “Modified” (select element) dropdown from the Blog Posting content area over to the title of the Recent Posts widget to become that “Recent Posts” dropdown populated with a week’s worth of modified date changed blog posting titles that if selected navigate the user onto that blog posting.


Previous relevant WordPress Is Mentioned By Posting Order Tutorial is shown below.

WordPress Is Mentioned By Posting Order Tutorial

WordPress Is Mentioned By Posting Order Tutorial

We are revisiting the WordPress Blog “Is Mentioned By” functionality talked about at WordPress Is Mentioned By Posting Thread Tutorial for a few reasons …

  1. the order of blog postings that could end up on dropdowns as a result of this PHP code was not always chronological … and …
  2. the … “glimpse into” wording on the dropdown options told us (the users) nothing … and …
  3. the navigation off a user selected dropdown option was flaky and sporadic

… so let’s talk about these in more depth below …

  1. the order of blog postings that could end up on dropdowns as a result of this PHP code was not always chronological … so … we changed is_mentioned_by.php‘s central bit of SELECT (DML) SQL as per
    <?php

    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

    ?>
    … noting that ORDER BY clause fields should appear in the (SELECT) column list, and we chose to put it at the end (of that list) to avoid any array indexing code changes
  2. the … “glimpse into” wording on the dropdown options told us (the users) nothing … so … we changed is_mentioned_by.php‘s “function pluckfirstreal” as per
    <?php

    function pluckfirstreal($pcont) {
    $xpcont=$pcont;
    if (strpos($xpcont, "[/caption]</p>") !== false) {
    $xpcont=explode("[/caption]</p>", $pcont)[1];
    } else if (strpos($xpcont, "[/caption]") !== false) {
    $xpcont=explode("[/caption]", $pcont)[1];
    }

    $paras = explode("</p", str_replace("<p", "</p", $xpcont));
    if (sizeof($paras) > 2) {
    $oth = explode("<", $paras[1]);
    $retval = " ... ";
    for ($i=0; $i<sizeof($oth); $i++) {
    $huh = explode(">", $oth[$i]);
    $retval .= str_replace("'", "`", str_replace("}", " ", str_replace("{", " ", $huh[-1 + sizeof($huh)])));
    }
    return substr($retval,0,200);
    }
    return "";
    }

    ?>
  3. the navigation off a user selected dropdown option was flaky and sporadic … so … in (good ol’) header.php of the WordPress Blog TwentyTen theme folder we changed
    <?php

    function changed(inval,intxt) {
    if (1 == 1 || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    if (callwhat.length == 0) {
    parentwino(inval,intxt.toLowerCase(),'');
    }
    }

    if (callwhat.length > 1) {
    if (prevxcmd != "") {
    eval(prevxcmd);
    } else if (prevcmd != "") {
    eval(prevcmd.replace("''","'top=50,left=50,width=600,height=600'"));
    }
    prevxcmd="parentwino('" + inval + "','" + intxt.toLowerCase() + "','top=50,left=50,width=600,height=600')";
    prevcmd="";
    } else if (callwhat.length == 1) {
    if (sitlist.indexOf(',') != -1) {
    prevcmd="";
    prevxcmd="";
    var invala=sitlist.split(',');
    for (var ip=0; ip<invala.length; ip++) {
    if (prevxcmd != "") {
    eval(prevxcmd);
    } else if (prevcmd != "") {
    eval(prevcmd.replace("''","'top=50,left=50,width=600,height=600'"));
    }
    prevxcmd="parentwino('" + invala[ip] + "','" + intxt.toLowerCase() + "','top=50,left=50,width=600,height=600')";
    prevcmd="";
    }
    } else if (1 == 1) {
    parentwino(inval,intxt.toLowerCase(),'');
    } else {
    if (prevcmd != "") {
    eval(prevcmd);
    } else if (prevxcmd != "") {
    eval(prevxcmd.replace("'top=50,left=50,width=600,height=600'", "''"));
    }
    prevcmd="parentwino('" + inval + "','" + intxt.toLowerCase() + "','')";
    prevxcmd="";
    }
    }
    }

    function antiaway() {
    if (document.getElementById('hfloater') && document.getElementById('aaway')) {
    document.getElementById('hfloater').innerHTML=document.getElementById('hfloater').innerHTML.replace(' ' + document.getElementById('aaway').outerHTML, '');
    }
    }


    function parentwino(a, b, c) {
    var woisp=null, eqas=null;
    if (c == "") {
    try {
    if (woisp == null && document.getElementById('hfloater')) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    document.getElementById('hfloater').innerHTML+=' <a id="aaway" target="_blank" href="' + a + '" style="display:none;">WOpen</a>';
    document.getElementById('aaway').click();
    setTimeout(antiaway, 4300);
    } else {
    woisp=window.open(a,b);
    }
    } catch(eqas) {
    woisp=null;
    }

    return woisp; //window.open(a,b);

    } else {
    try {
    if (woisp == null && document.getElementById('hfloater')) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    document.getElementById('hfloater').innerHTML+=' <a id="aaway" target="_blank" href="' + a + '" style="display:none;">WOpen</a>';
    document.getElementById('aaway').click();
    setTimeout(antiaway, 4300);
    } else {
    woisp=window.open(a,b,c);
    }
    } catch(eqas) {
    woisp=null;
    }
    }

    return woisp; //window.open(a,b,c);
    }

    ?>
    … helping reduce the amount of Javascript window.open we call (and use)
  4. To try this, try the “emoji button” above.


    Previous relevant WordPress Is Mentioned By Posting Thread Tutorial is shown below.

    WordPress Is Mentioned By Posting Thread Tutorial

    WordPress Is Mentioned By Posting Thread Tutorial

    At this blog we are keen for users to learn one off ideas and on occasions linked “threaded” (or blog postings of a theme) ones.

    The last WordPress Blog (TwentyTen theme) “Is Mentioned by” functionality is good for certain scenarios, but what if you arrive at a blog posting that is part of a “threaded” series of blog postings? We normally show you older ones and that’s fine. But I’m not so much talking about the avid reader here who follows it “hot off the press” but more the users finding things off search engines, coming to this blog, and the posting they get to may not be the last in the “thread”. Below the blog posting they log in at, the reader can read all the information of the past to do with the thread, but what of getting it into context, relative to the entire “thread” up to that point, or out more recently “beyond” it? Well, that is the purpose of today’s extension of functionality to the WordPress Blog “Is Mentioned by” functionality we last finished up discussing with WordPress Is Mentioned By Code Download Progress Tutorial as shown below.

    Surprisingly the WordPress Blog TwentyTen theme’s header.php does not need to change to make this happen. The PHP that queries the WordPress MySql database can handle all the change today, and ended up looking like is_mentioned_by.php changing this way.

    The method is to …

    • query the MySql database with a more complex query that results in data for …
    • “is mentioned by” and “is part of a blog posting thread” are represented by two separate dropdowns … and …
    • in order to show you the context of the current blog posting in a blog posting “thread” we have an HTML select size property set to the number of dropdown records … alas, mobile platforms do not honour the size property regarding their display of dropdowns … display and set the selected property to the current blog posting’s entry, with this entry consisting of …
    • a blog posting title and the first paragraph of content are put into the “is part of a blog posting thread” dropdown option text to enhance the context for the user, shown this list with the most recent posting first down in reverse chronological order to the older blog posting of the “thread” down the bottom

    Below in bold is how the MySql query got more complex …


    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%'");

    where the (new) variable $ourother is set to being the first few words of the blog posting title.

    In order to “pluck out” one paragraph from the content (of variable $pcont) we use …


    function pluckfirstreal($pcont) {
    $paras = explode("</p", str_replace("<p", "</p", $pcont));
    if (sizeof($paras) > 2) {
    $oth = explode("<", $paras[1]);
    $retval = " ... ";
    for ($i=0; $i<sizeof($oth); $i++) {
    $huh = explode(">", $oth[$i]);
    $retval .= str_replace("'", "`", str_replace("}", " ", str_replace("{", " ", $huh[-1 + sizeof($huh)])));
    }
    return substr($retval,0,200);
    }
    return "";
    }

    … to append to the blog posting title as the user’s dropdown text for contextual purposes.

    Stop Press

    Was this a Bad Day at Black Rock? We revisit this work with WordPress Is Mentioned By Posting Order Tutorial.


    Previous relevant WordPress Is Mentioned By Code Download Progress Tutorial is shown below.

    WordPress Is Mentioned By Code Download Progress Tutorial

    WordPress Is Mentioned By Code Download Progress Tutorial

    There are various approaches with user experience (UX) considerations regarding putting a web application user at their ease as they wait for a response. I’m talking about where the response is coming from a separate serverside script doing something that may take a while, such as querying a database for instance, and that responder will do the work back at its parent to say it has finished its job. Given all this, you may be asking “What is there left to worry about, with the user, if the responder is doing this?”. Well, there is that amount of time between …

    • clicking the action item of HTML at the parent … all the way through to …
    • the responder “child”, often serverside code (for us, PHP), finishing its work and fixing the parent webpage to indicate that it has finished its work

    Now, we all hope this time period is short, and, hopefully, most of the time, it is short, and perhaps it is “overkill” to worry about doing anything here. However there are some things to consider …

    • if you are writing commercial software code there could well be an UX expectation that you would code for this, to keep the user informed at all times … and …
    • it could be the case that the database crashes at that very “clicking” moment, and though your responder may not get back to the parent with information, at least if you’ve coded for the scenario back at the client, at least the user will know something is being attempted, even if it doesn’t appear to be succeeding, which is less frustrating than getting no information at all, which could be mistaken for software code “hanging” … definitely not a great UX feel, or look

    Now there are a variety of client code approaches for showing “progress”, such as …

    • additional progress bar … like
    • additional meter … like
    • something you just clicked, changing appearance cyclically over time

    That last one appeals to us for a recent bit of functionality we added to this WordPress Blog you are reading, as well as for the fact that what we show “progress” on is difficult to numerically quantify as far as completion time is concerned, and so the first two above are not as suitable. We actually change the HTML div element font size to make an emoji “button” pressed “throb” while the user waits for the PHP and MySql query to respond back. Do you remember our thread of blog posting that used to end with WordPress Is Mentioned By Code Download CSS Tutorial? That’s the functionality we’re talking about today, as we do at WordPress 4.1.1’s WordPress Is Mentioned By Code Download Progress Tutorial.

    Now reading that previous link’s content below, you may see that we have considered the scenario of the child responder not finding any mentions and responding with …

    Sadly, this tutorial is not mentioned by any others, yet

    … which is good, but it may either take a long time for the responder to work this out, or, as we’ve indicated above, the responder’s mechanism for finding out may fail, and we’re dealing with that, from the perspective of the user looking at the client webpage, and waiting for information after clicking that emoji link we introduced when we did that work in that tutorial.

    We decided to prove our method with a “proof of concept” local MAMP web server HTML and Javascript and CSS parent taking …

    1. one blog posting bit of HTML body HTML …
    2. the is_mentioned_by function renamed to was_is_mentioned_by and a new is_mentioned_by worked until it works, tested via the Safari web browser’s Develop menu’s Web Inspector (similar to the Firefox Firebug web inspector we tend to go on and on and on and on and on and on about at this blog)

    … that took the form of this imb_poc.html … supervising the reworked PHP serverside code is_mentioned_by.php on MAMP that is, deliberately, made to …

    • wreck the connection to MySql … and then intervene to …
    • change the die message to instead sleep(18) before showing “Sadly, this tutorial is not mentioned by any others, yet” … at which time our changes should look good UX wise for the user

    We must stress this about “proof of concept”. Don’t waste time on “proof of concept” with too much fine grain simulation of the original scenario, if it is not involved in what you are proving, that is different, and is what is being tested here. See how it can even be that it suits the purposes of some “proof of concept” scenarios, like today’s, that you wreck the MySql connection in a progress “proof of concept” scenario, for example?

    We made these WordPress Blog changes in good ol’ TwentyTen themed header.php, as we so often do, and show changed code bold below …


    <script>
    var ourfs=21, zzzspare='';
    // ...
    // lots of other Javascript code
    // ...
    // down to ...

    function preresize_font(aois) {
    zzzspare=aois.id.replace('t','d');
    resize_font();
    }

    function resize_font() {
    ourfs=eval((ourfs + 5) % 45);
    if (document.getElementById(zzzspare).innerHTML.indexOf('<select ') != -1) {
    ourfs=21;
    } else {
    setTimeout(resize_font, 500);
    }
    document.getElementById(zzzspare).style.fontSize='' + ourfs + 'px';
    }

    function is_mentioned_by() {
    var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    xpspana=docgetclass("entry-title", "h1");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    }

    … where is_mentioned_by function is called by the document.body onload event, to trigger all this. You can see some of all this with today’s tutorial picture, and by trying to click some of the right pointing emoji “is mentioned by” functionality “buttons” you see next to Blog Posting Titles around you here at this WordPress TwentyTen themed blog, but here’s hoping you don’t see too many throbbing emojis … heaven forbid?!

    Stop Press

    More regarding this CSS cursor property tomorrow.


    Previous relevant WordPress Is Mentioned By Code Download CSS Tutorial is shown below.

    WordPress Is Mentioned By Code Download CSS Tutorial

    WordPress Is Mentioned By Code Download CSS Tutorial

    A few things come together for today’s user experience (UX) inspired tutorial whereby …

    … to make what we are doing stand out more for the user, who may “swim” in a large table devoid of any styling to focus their attention.

    We’ll leave you with modified PHP, that writes out the HTML Code Download Table manipulator, you could call getmelist.php and which changed in this way to make the Code Download Table be more usercentric with its presentation of hashtagged calls linking a WordPress Blog Posting at this blog with a particular piece of software code of interest in our Code Download Table.

    Hope you try this functionality out for yourself.


    Previous relevant WordPress Is Mentioned By Code Download Navigation Tutorial is shown below.

    WordPress Is Mentioned By Code Download Navigation Tutorial

    WordPress Is Mentioned By Code Download Navigation Tutorial

    We’re following up on some recent WordPress navigation logic today, that we started with WordPress Is Mentioned By Navigation Primer Tutorial as shown below, for blog posting relationships between …

    • A blog posting being referred to … back, optionally, as a link, to …
    • A blog posting that mentioned that blog posting currently being viewed

    … and looking at this premise, it stands to reason that as helpful as this concept looks on paper, if a regular reader expects a recent posting be referred to by others “hot off the press” they’d be expecting quite a lot, and though what they get in this scenario …

    Sadly, this tutorial is not mentioned by any others, yet

    … probably does a good job tweaking them to the dilemma of “hot off the press” being “too recent to be referred to” it still remains a disappointment, perhaps. So, thinking a tad laterally on this, what is going to help out here will be to particularize the scenario for what we do around here … and am sorry if this annoys, but we are showing a line of thinking here … and allow for Blog Posts that contain the word “GETME” … our favourite code download mechanism around here … to add a “Code Download Table” dropdown option, that if selected will lob the user directly onto the RJM Programming Code Download Table entry for the first “GETME” file link found in that blog posting. This additional scouring of the MySql database, that utilizes the SQL UNION operator (the “adding an extra clause or paragraph” SQL operator, we like to think of it as) with its query, will not be relevant to all unmentioned blog postings, but it will help those that talk about software coding, which is quite a few.

    That functionality had us looking back at how the Code Download Table was constructed in terms of its hashtagging when we discussed PHP Blog Summary Follow Up Tutorial. In this way, we had a first try at …

    • … using the hashtagging for a date … as you see with these changes to is_mentioned_by.php at the left hand column of the Code Download Table … did a couple of unit tests seeing the first one work, the second one work if you take it a day back, and the third one not work at all, at which point it tweaked with us that the date in the Code Download Table is a date reflected by the software code file’s modified date, not the WordPress Blog Posting publication date, that we can derive off our amended query … so that being less friendly than we envisaged we end up …
    • … using the very interesting hashtagging that particularizes the filename, where the read file extension (minus all the “GETME” and “-“‘s and “_”‘s that is) is taken out of the prefix to the hashtag, and made into a suffix … like “analogue_clock.-GETMEhtml” for Analogue Clock Timezone Tutorial that is exemplified in today’s tutorial picture and as you can see the changes for at this is_mentioned_by.php link

    So it panned out to make this happen the original Code Download Table code did not need any tweaking, not good ol’ WordPress TwentyTen theme header.php … just is_mentioned_by.php … but we hope you try out clicking some “White Right Pointing Index” emoji …

    … at this WordPress blog sometime soon.

    Did you know?

    What gives with the &tsp=[someBigNumber] GET parameter … like is yellow highlighted in today’s tutorial picture … in the “Code Download Table” lookup URLs? This is so that we end up with different URLs each time a user accesses this functionality. This is because web browsers often try to help you out with speeding up your browsing, and use the web browser cache to “regurgitate” a previously visited URL should that have happened since the last clearing of any web browser cache, to “slap” the cache version quickly on the screen. But we don’t want any “slapping” to go on around our functionality today, and a way to force the web browser to reconsider the real lookup, and go back to the real web server again for data, is to make your URL be unique. A curiosity here you can try is to use something like a local MAMP (for Mac or EasyPHP for Windows) local web server to, for an image file called image.jpg that is put into the Apache web server’s Document Root

    1. see the image in your favoured web browser with the URL HTTP://localhost:8888/image.jpg … then …
    2. change that image somehow with an image editor … and …
    3. refresh, or revisit the image with the URL HTTP://localhost:8888/image.jpg … and you’ll probably see the cached web server version … unless you haven’t got web browser caching going … so amend this to …
    4. revisit the image with the URL HTTP://localhost:8888/image.jpg?random=7456536 … and this time we think you’ll see the amended image that happened with your image editing … and yes, you can add GET parameters to your URLs even for image URLs (often, most helpfully with image URLs, actually)

    Previous relevant WordPress Is Mentioned By Navigation Primer Tutorial is shown below.

    WordPress Is Mentioned By Navigation Primer Tutorial

    WordPress Is Mentioned By Navigation Primer Tutorial

    We’ve written some new WordPress navigation logic today, for blog posting relationships between …

    • A blog posting being referred to … back, optionally, as a link, to …
    • A blog posting that mentioned that blog posting currently being viewed

    … done, because we see that it is not only the “vertical” type linking of blog postings into a “thread” that helps understanding … we hope … but also to jump around among commonalities between concepts (like “horizontal” “degrees of separation”), perhaps. This functionality involves MySql database queries, and is best suited to a user clicks something (rather than pre-emptive content loading) to reach the functionality so that our database query has a post title to work with, and also so that every blog post does not overload the web server with a query ahead of time whose work may not be accessed anyway. The something that is clicked is an HTML a tag whose “look” is an Emoji.

    We also wrote a proof of concept, before applying that proof of concept live. To us, a “proof of concept” is not much use if it is as involved as what it is trying to prove, and in today’s scenario we did a proof of concept for two scenarios, that being …

    • a blog posting that was referred to by others … and …
    • a blog posting that wasn’t … doh! … but if you don’t change something about the “look of things” you’ll confuse the user as to whether the web application just took notice of their click (via the onclick event) … so this is of mild importance, but we grant you that it is not as important as the first scenario’s workings

    We quite often adopt a proof of concept scenario which tests the workings of a child (often in an HTML iframe element), in this case, PHP server side, piece of code, by introducing a simplified and pared down parent, in this case HTML piece of code. At the end of successful testing you are left with a good, and close to totally suitable child piece of code, to slot into the functionality of the real and live parent code.

    That proof of concept was definitely a good “unit testing” thing to do, but nevertheless, don’t feel overconfident as you go live … living with other real “goings on” on the live website are things to consider, and test … it took us half an hour to iron out these types of issues.

    The other good thing to have on your side is a Web Inspector like on Safari, similar to the Firefox Firebug web inspector we tend to go on and on and on and on and on and on about at this blog. We’re giving you a Safari rest on that today, and we want to show you an “early days” view …

    … in the proof of concept help that the Safari Web Inspector gave us, delving in under the called (by HTML parent) PHP’s actions. This type of information makes server side programming, like you do with PHP, that much easier … much easier than ideas where you write out web server files, with information, for your own benefit, or the other one we often like, during testing, is to write information out to top.document.title or perhaps to an alert box or to use console.log (on the debugging window, down the bottom).

    You’ll never guess where we made this change to our WordPress TwentyTen themed blog? Give up … yes, good ol’ header.php changed in the bold Javascript new function way below …



    function is_mentioned_by() {
    var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="display:inline;text-decoration:none; border:2px solid yellow;" onclick=" document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    xpspana=docgetclass("entry-title", "h1");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="display:inline;text-decoration:none; border:2px solid yellow;" onclick=" document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    }

    … called by …


    <body onload=" checkonl(); setTimeout(initpostedoncc, 3000); widgetcon(); precc(); courseCookies(); cookie_fonts(); is_mentioned_by(); " <?php body_class(); ?>>

    Team that with some new PHP source code you could call is_mentioned_by.php and you have today’s new WordPress blog TwentyTen theme “Is Mentioned By” functionality.

    The proof of concept parent HTML was is_mentioned_by.html for your perusal.

    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

WordPress Blog Thread Story Border SVG Image Tutorial

WordPress Blog Thread Story Border SVG Image Tutorial

WordPress Blog Thread Story Border SVG Image Tutorial

The border-image CSS property, used well, can be a really powerful web design tool. We decided to show a user they were in, like, “storybook mode” reading our blog, further to yesterday’s WordPress Blog Thread Story Mode Tutorial, by applying a new …

  • border-image … ala “ring binder” (via use of ☌ &#9740; “conjunction” emoji symbol), only on the left … via (header.php, again) …
  • SVG …
  • text

… using new CSS styling …

<style>

.storybook {
border-image: url('data:image/svg+xml,<svg style="font-size:20px;" width="20" height="20" viewBox="0 0 20 20" xmlns="//www.w3.org/2000/svg"><text x="10%" y="80%">☌</text></svg>');
border-image-slice: 0 0 0 100;
border-image-width: 20px;
border-image-outset: 2px;
border-image-repeat: repeat;
padding-left: 20px;
}

</style>

… referenced in a newly introduced PHP variable …

<?php

$atofind="\n atofind.className='storybook papers'; \n atofind.oncontextmenu=function(event){ event.target.style.zoom='' + eval(0.05 + eval('' + event.target.style.zoom)); }; \n";

?>

… used in “storybook” class specific Javascript …

<?php echo ”

function storyizecollect() {
var divsall=document.getElementsByTagName('div');
for (var ivd=0; ivd<divsall.length; ivd++) {
if (divsall[ivd].outerHTML.split('>')[0].indexOf(' post type-post ') != -1) {
threaddivs.push('' + divsall[ivd].id);
}
}
}

function storyresize(atoo) {
atoo.style.width='' + atoo.getAttribute('data-w') + 'px';
//atoo.style.height='' + atoo.getAttribute('data-h') + 'px';
atoo.style.backgroundColor='rgba(255,155,55,0.3)';
atoo.style.overflow='hidden';
return atoo;
}

function storyreorder(atofind) {
var hrparts=[], hroh='', reorderedcontent='', hrih='', hrdone=false, hrplus='';
var atobr=atofind.getBoundingClientRect();
if (('' + atofind.getAttribute('data-w')) == '0') {
atofind.setAttribute('data-w',('' + atobr.width));
atofind.setAttribute('data-h',('' + atobr.height));
}
atofind.setAttribute('data-st',('' + document.body.scrollTop));
for (var ivd=0; ivd<threaddivs.length; ivd++) {
if (document.getElementById(threaddivs[ivd])) {
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf(atofind.outerHTML) != -1 && !hrdone) {
atofind.setAttribute('data-done', 'y');
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
var pwis=0;
if (navigator.userAgent.match(/iPad/i)) {
pwis=eval('' + document.getElementById('primary').getBoundingClientRect().width);
}
atofind.style.width='' + eval(-40 + eval('' + document.getElementById('container').getBoundingClientRect().width) - pwis) + 'px';
} else {
atofind.style.width='' + eval(-40 + eval('' + document.getElementById('container').getBoundingClientRect().width) - eval('' + document.getElementById('primary').getBoundingClientRect().width)) + 'px';
}
atofind.style.overflow='scroll';
atofind.style.borderLeft='1px dashed red';
atofind.style.WebkitOverflowScrolling='touch';
<?php echo $atofind; ?>
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf('<hr title=') != -1) { hrplus=' title='; }
hrparts=document.getElementById(threaddivs[ivd]).innerHTML.split('<hr' + hrplus);
if (eval('' + hrparts.length) > 1) {
hrih='<hr' + hrplus + hrparts[1].split('>')[0] + '>';
if (hrih.indexOf('/>') == -1 && document.getElementById(threaddivs[ivd]).innerHTML.indexOf('</hr>') != -1) {
hrih+='</hr>';
}
hroh='<hr' + hrplus + hrparts[1].split('>')[0].replace(/\//g,'') + '></hr>';
}
if (hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent='<div style=display:none;>' + hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent=hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'');
}
for (var iivd=eval(-2 + eval('' + hrparts.length)); iivd>=0; iivd--) {
if (hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent+=hroh.replace('<hr','<hr style="display:none;"');
reordercontent='<div style=display:none;>' + hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent+=hroh;
reordercontent+=reordercontent=hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'');
}
}
if (reordercontent != '') {
hrdone=true;
atofind.innerHTML+='<br><details title="Thread story ..." open><summary title="Thread story ..."></summary><br>' + reordercontent + '</details>';
reordercontent='';
}
}
}
}
}

function storymember(inoh) {
if (inoh.indexOf('<div data-w=') == 0) { return true; }
if (inoh.indexOf('<details') == 0) { return true; }
if (inoh.indexOf('<div class="entry-content"') == 0) { return true; }
return false;
}

“; ?>

… “retweaked” reworking of the “blog posting thread” order from oldest through to most recent, like a “story” view of the “blog posting thread” ideas and development. You might notice that we often start a “thread” involving the word “Primer” in the blog posting title.


Previous relevant WordPress Blog Thread Story Mode Tutorial is shown below.

WordPress Blog Thread Story Mode Tutorial

WordPress Blog Thread Story Mode Tutorial

We feel a “tweak” coming on. It’s been a while since the last such “tweak”. We’re talking about doing the frequent …

  • good ol’ “tweaking” of header.php … owned by our …
  • wordpress.org based WordPress Blog …
  • theme TwentyTen … means by which we …
  • can “tweak” in the morning, at supper time, and in small cubicles the look and feel and “way it works” aspects to the blog you are reading

Yes, it’s mainly header.php we use, though do remember functions.php, footer.php, 404.php and some plugins as well, but the “tweaking” of header.php is the easiest, for most jobs.

Picking up from the, largely, document.body onload event interventions we make happen this way, we latch onto a previous intervention, and “retweak” that (past work related to WordPress Is Mentioned By Less Recently Modified Tutorial), today, to add …


New "Story Mode" display of a thread of WordPress blog postings

… this use of “thread” not being a technical term, rather how we describe how we string together related blog postings (that usually follow each other reverse chronologically (ie. latest blog posting first)) into, what we term, a “blog posting thread”.

But yesterday, suddenly, it dawned on us, that this “blog posting thread” can be confusing for readers coming in to the discussion half way through, or near the end, so why not offer them a new 📖 (&#128214; … ie. story) based (adding to a global var threaddivs=[]; statement part) …

<?php echo ”

function storyizecollect() {
var divsall=document.getElementsByTagName('div');
for (var ivd=0; ivd<divsall.length; ivd++) {
if (divsall[ivd].outerHTML.split('>')[0].indexOf(' post type-post ') != -1) {
threaddivs.push('' + divsall[ivd].id);
}
}
}

function storyresize(atoo) {
//atoo.style.width='' + atoo.getAttribute('data-w') + 'px';
//atoo.style.height='' + atoo.getAttribute('data-h') + 'px';
atoo.style.backgroundColor='rgba(255,155,55,0.3)';
atoo.style.overflow='hidden';
return atoo;
}

function storyreorder(atofind) {
var hrparts=[], hroh='', reorderedcontent='', hrih='', hrdone=false, hrplus='';
var atobr=atofind.getBoundingClientRect();
atofind.setAttribute('data-w',('' + atobr.width));
atofind.setAttribute('data-h',('' + atobr.height));
atofind.setAttribute('data-st',('' + document.body.scrollTop));
for (var ivd=0; ivd<threaddivs.length; ivd++) {
if (document.getElementById(threaddivs[ivd])) {
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf(atofind.outerHTML) != -1 && !hrdone) {
atofind.setAttribute('data-done', 'y');
atofind.style.overflow='scroll';
atofind.style.borderLeft='1px dashed red';
atofind.style.WebkitOverflowScrolling='touch';
atofind.style.zoom='0.4';
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf('<hr title=') != -1) { hrplus=' title='; }
hrparts=document.getElementById(threaddivs[ivd]).innerHTML.split('<hr' + hrplus);
if (eval('' + hrparts.length) > 1) {
hrih='<hr' + hrplus + hrparts[1].split('>')[0] + '>';
if (hrih.indexOf('/>') == -1 && document.getElementById(threaddivs[ivd]).innerHTML.indexOf('</hr>') != -1) {
hrih+='</hr>';
}
hroh='<hr' + hrplus + hrparts[1].split('>')[0].replace(/\//g,'') + '></hr>';
}
if (hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent='<div style=display:none;>' + hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent=hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'');
}
for (var iivd=eval(-2 + eval('' + hrparts.length)); iivd>=0; iivd--) {
if (hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent+=hroh.replace('<hr','<hr style="display:none;"');
reordercontent='<div style=display:none;>' + hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent+=hroh;
reordercontent+=reordercontent=hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'');
}
}
if (reordercontent != '') {
hrdone=true;
atofind.innerHTML+='<br><details title="Thread story ..." open><summary title="Thread story ..."></summary><br>' + reordercontent + '</details>';
reordercontent='';
}
}
}
}
}


function storymember(inoh) {
if (inoh.indexOf('<div data-w=') == 0) { return true; }
if (inoh.indexOf('<details') == 0) { return true; }
return false;
}


function is_mentioned_by() {
//rppspana=docgetclass("widget-title", "h3");
var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2"); // search URL returns
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>&#9986;</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>&#127939;&#127998;&#8205;&#9792;&#65039;&#127939;&#127996;&#8205;&#9794;&#65039;</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; setTimeout(precheckclass,3000); " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div data-w="0" data-h="0" data-st="0" data-style="-webkit-overflow-scrolling:touch;overflow:scroll;" data-done="" onclick=" if (' + "('' + " + 'event.target.id) == this.id || 1 == 1) { if (this.getAttribute(' + "'data-done'" + ').length == 0) { storyreorder(this); } else if (storymember(event.target.outerHTML)) { this.style.zoom=1.0; storyresize(this).innerHTML=' + "'&#128214;'" + '; this.setAttribute(' + "'data-done',''" + '); window.scrollTo(0,this.getAttribute(' + "'data-st'" + ')); } } " title="Reorder thread blog postings to read like a story ..." style="display:inline-block; text-decoration:none; cursor:pointer; background-color:rgba(255,155,55,0.3);" id=r' + zspare + '>&#128214;</div>';
}
}
xpspana=docgetclass("entry-title", "h1"); // real blog postings
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>&#9986;</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>&#127939;&#127998;&#8205;&#9792;&#65039;&#127939;&#127996;&#8205;&#9794;&#65039;</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " setTimeout(precheckclass,3000); title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div data-w="0" data-h="0" data-st="0" data-style="-webkit-overflow-scrolling:touch;overflow:scroll;" data-done="" onclick=" if (' + "('' + " + 'event.target.id) == this.id || 1 == 1) { if (this.getAttribute(' + "'data-done'" + ').length == 0) { storyreorder(this); } else if (storymember(event.target.outerHTML)) { this.style.zoom=1.0; storyresize(this).innerHTML=' + "'&#128214;'" + '; this.setAttribute(' + "'data-done',''" + '); window.scrollTo(0,this.getAttribute(' + "'data-st'" + ')); } } " title="Reorder thread blog postings to read like a story ..." style="display:inline-block; text-decoration:none; cursor:pointer; background-color:rgba(255,155,55,0.3);" id=r' + zspare + '>&#128214;</div>';
}
}
storyizecollect();
}

“; ?>

… reworking of the “blog posting thread” order from oldest through to most recent, like a “story” view of the “blog posting thread” ideas and development. You might notice that we often start a “thread” involving the word “Primer” in the blog posting title.


Previous relevant WordPress Is Mentioned By Less Recently Modified Tutorial is shown below.

WordPress Is Mentioned By Less Recently Modified Tutorial

WordPress Is Mentioned By Less Recently Modified Tutorial

Supposing you came in here paying scant attention to the Blog Posting Title and its Animated GIF Tutorial picture I’d like to set you the challenge to look at the build up to organizing the use of the theme for today’s tutorial, and you try to anticipate what that may be? Up to the challenge? We hope so, because, with respect to the recent WordPress Is Mentioned By Recently Modified Tutorial‘s …

  • MySql SQL …
    <?php

    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, -1 as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 WEEK " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

    ?>
    … we changed it to be
    <?php

    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, (-480 + TIMESTAMPDIFF(MINUTE,NOW()," . $tname . ".post_modified)) as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 MONTH " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

    ?>
    … to fit in with …
  • we changed the modified is_mentioned_by.php‘s SQL result set logic “if logic framework” … from
    <?php

    while (($r_array = mysql_fetch_row($res))) {
    if ($r_array[3] == "-1" && strtolower($r_array[3]) == strtolower($r_array[4])) {
    // this is a member of the modified list (via middle UNION SELECT) of the MySQL SQL query result set
    } else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
    // matches current post logic goes here
    } else {
    // does not match current post logic goes here
    }
    }

    ?>
    to
    <?php

    while (($r_array = mysql_fetch_row($res))) {
    if ($r_array[3] == "-1" && strpos(("" . $r_array[4]), "-") !== false) {
    // this is a member of the modified (and less recently modified) list (via middle UNION SELECT) of the MySQL SQL query result set
    } else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
    // matches current post logic goes here
    } else {
    // does not match current post logic goes here
    }
    }

    ?>
    … turning a “binary” piece of logic into a “ternary” (and above) one … as well as, for good ol’ header.php we add some global Javascript variables

    var coption='option';
    var cdisabled='disabled';
    var chidden='hidden';
    var cblank='_blank';

Is it apparent to you now what we are using to achieve some new “Less Recently Modified Tutorial” list data onto the “Recently Modified Tutorial” list data of below? But how do we go about doing that, that has been an enthusiasm around here, of recent times? What if we could say …

  • we changed the modified is_mentioned_by.php‘s SQL result set logic “within that top if logic” … from
    <?php

    if ($secresult == "") {
    $secresult=" <span id=xdrpl><select style=\"background-color:orange;display:inline-block;width:80px;\" id=mr" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Modified recently (over last week)\"><option value=\"\">Modified</option></select></span> ";
    }
    $secresult=str_replace('>Modified</option>','>Modified</option><option value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . '>' . $r_array[0] . '</option>', $secresult);

    ?>
    to
    <?php

    if ($secresult == "") {
    $secresult=" <span id=xdrpl><select style=\"background-color:orange;display:inline-block;width:80px;\" id=mr" . permalinkit($ourtitle) . " onchange=\"if (this.value.trim().length == 0) { var optslst=document.getElementsByTagName(coption); for (var ioptslst=0; ioptslst<optslst.length; ioptslst++) { if (optslst[ioptslst].outerHTML.indexOf(this.value) != -1) { if (optslst[ioptslst].outerHTML.indexOf(cdisabled) != -1) { optslst[ioptslst].removeAttribute(cdisabled); } if (optslst[ioptslst].outerHTML.indexOf(chidden) != -1) { optslst[ioptslst].removeAttribute(chidden); } } } } else { window.open(this.value,cblank); }\" title=\"Modified recently (over last week)\"><option value=\"\">Modified</option></select></span> ";
    }
    if ($r_array[4] <= -11520) {
    $blks=(40 - floor((0 - $r_array[4]) / (24 * 60)));
    $optv='<option value="">Enable and show through to ' . (40 - $blks) . ' days';
    $altv=' title=""';
    for ($iblks=0; $iblks<$blks; $iblks++) {
    $altv=str_replace(' title="', ' title=" ', $altv);
    $optv=str_replace(' value="', ' value=" ', $optv);
    }
    if (strpos($secresult, $optv) !== false) { $secresult=str_replace($optv . " ... ",$optv . " ... " . $r_array[0] . " and ",$secresult); $optv=""; } else { $optv .= " ... " . $r_array[0] . "</option>"; }
    $secresult=str_replace('>Modified</option>','>Modified</option>' . $optv . '<option' . $altv . ' value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . ' disabled hidden>' . $r_array[0] . '</option>', $secresult);
    } else {

    $secresult=str_replace('>Modified</option>','>Modified</option><option value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . '>' . $r_array[0] . '</option>', $secresult);
    }

    ?>
  • and does the disabled hidden above tell you more?

Yes, back with the recent Emoji Circuit Quiz Animated Emoji Tutorial you might recall …

We’ve also long been interested in HTML select (dropdown) element option (subelement) disabling and/or hiding (statically or dynamically (as with today’s Javascript work)), and today, for the first time for us, we put this into action

… and we’ve found a new (probably you’d say, “more apt”) use of this idea. We differentiate the …

  • arguably more potent “week’s worth” of modified postings list (as per WordPress Is Mentioned By Recently Modified Tutorial‘s situation) … still as is, and “singly selectable” … with …
  • new less potent (you could argue) “older than one week and up to one month” of modified postings list that can be made “singly selectable” by the user (but don’t start that way, because they initially have “hidden” and “disabled” option element attributes set) … and …
  • in order to save space and honour those platforms that really render the “hidden” option tags we add “older than one week and up to one month” blog posting titles onto the “selectable day age” ones (all causing a select (dropdown) element value property of blank (if trimmed … ie. their length matches (40 – number of days age)) so that that new Javascript onchange logic can just look for a select element value existing in an option (list) member outerHTML property in order to decide whether to remove the “disabled” and “hidden” properties initially populated into those option “older than one week and up to one month” elements

Now can we recommend turning off the “scant attention” and having a look at today’s animated GIF tutorial picture showing a bit of how this new functionality works in practice here at the WordPress TwentyTen themed blog you are reading up with the emoji button (you click) above.

For biassed moi, just another reason to keep on admiring and using the ever useful HTML select (dropdown) element in our web applications.


Previous relevant WordPress Is Mentioned By Recently Modified Tutorial is shown below.

WordPress Is Mentioned By Recently Modified Tutorial

WordPress Is Mentioned By Recently Modified Tutorial

Administering this blog there are two major criteria that would cause a blog posting’s modified date to change, that being …

  1. at this blog we schedule one new blog post per day … and …
  2. as we see things, on an ad hoc basis, we’ll make changes

… but that “Recent Posts” widget you see at this blog only reflects blog post criteria 1 above. Supposing you are following a thread of blog posts or an old blog post, try out the code and see that there is something amiss. How could this possibly be so! Yes, humanity rainsreigns, and we are scouring the postings you might visit to see what you might see, as a basis for revisits to code of the past.

And pretty naturally, if we find an issue, and can do something about it, with that category 2 blog posting type above, we may change one or other or both of …

  • the underlying code of said category 2 blog posting … and/or, as applicable …
  • the blog posting content of said category 2 blog posting

… the latter of which will cause that blog posting’s modified date to change, and as of today, adding onto yesterday’s WordPress Is Mentioned By Posting Order Tutorial, your clicking of “Is Mentioned By” “emoji button” above to change the “Recent Posts” widget title to “Recent Posts”, that (select element) dropdown populated in chronological order by a week’s worth of modified date changes at this blog. Using this, you may get an update to something you cannot figure, else drop us a line.

What needed to change for this? Well, first off, we’d like to thank the inspiration of 27 Handy SQL Query Hacks for WordPress for the means by which we changed is_mentioned_by.php‘s central SQL SELECT (DML) statement should receive a new UNION clause as per

<?php

$res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, -1 as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 WEEK " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

?>

… that -1 as tfind, -1 as tother an intentional ploy to fit in with a new “if” clause in the PHP (that loops through database record reads of the MySql SQL query above) as per

<?php

$secresult="";
if ($res == 0) {
if (1 == 2) echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");
} else if (mysql_num_rows($res) == 0) {
if (1 == 2) echo("<b>Query executed successfully</b>");
$retval=$delim;
$retval = str_replace(" }", " parent.document.getElementById('d" . permalinkit($ourtitle) . "').innerHTML='<select style=background-color:yellow; id=" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Is mentioned by\"><option value=\"\">Sadly, this tutorial is not mentioned by any others, yet</option></select>'; }", $retval);
} else {
while (($r_array = mysql_fetch_row($res))) {
if ($r_array[3] == "-1" && strtolower($r_array[3]) == strtolower($r_array[4])) {
if ($secresult == "") {
$secresult=" <span id=xdrpl><select style=\"background-color:orange;display:inline-block;width:80px;\" id=mr" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Modified recently (over last week)\"><option value=\"\">Modified</option></select></span> ";
}
$secresult=str_replace('>Modified</option>','>Modified</option><option value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . '>' . $r_array[0] . '</option>', $secresult);
}
else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
$isize++;
$retval = str_replace(" }", " isize++; theseopts=theseopts.replace(' size=' + eval(-1 + isize) + ' ', ' size=' + isize + ' ').replace('>','><option value=HTTP://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . " selected>" . $r_array[0] . pluckfirstreal($r_array[2]) . "</option>'); }", $retval);
} else {
$pdate = $r_array[1];
if ($retval == "") {
$retval=$delim;
$retval = str_replace(" }", " var theseoptions='<select style=background-color:yellow; id=" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Is mentioned by\"><option value=\"\">This tutorial is mentioned by ...</option></select>'; }", $retval);
$retval = str_replace(" }", " var theseopts='<select si' + 'ze=0 style=width:100%;background-color:#f0f0f0; class=select_ms id=z" . permalinkit($ourtitle) . " onchange=changed(this.value,ocb); title=\"Is part of a blog posting thread ... and you can select multiple tutorials to show\"></selec' + 't>'; }", $retval);
}
if ($r_array[3] != "0") $retval = str_replace(" }", " theseoptions=theseoptions.replace('</select>','<option value=HTTP://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . ">" . $r_array[0] . "</option></select>'); }", $retval);
if ($criteria != "") {
if (str_replace($criteria, "", $r_array[0]) != $r_array[0] && $r_array[4] != "0") {
$found = true;
$isize++;
$retval = str_replace(" }", " isize++; theseopts=theseopts.replace(' size=' + eval(-1 + isize) + ' ', ' size=' + isize + ' ').replace('>','><option value=HTTP://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . ">" . $r_array[0] . pluckfirstreal($r_array[2]) . "</option>'); }", $retval);
}
}
}
}
if ($retval != "") {
if (!$found) {
$retval = str_replace(" }", " theseopts=''; }", $retval);
} else {
$retval = str_replace(" }", " theseoptions+=(' ' + theseopts); }", $retval);
}
$retval = str_replace(" }", " parent.document.getElementById('d" . permalinkit($ourtitle) . "').innerHTML=theseoptions; parent.checkclass(\"\"); }", $retval);
}
}
mysql_close($link); // close the MySql database connection
if ($retval != "") {
if ($secresult != "") {
$retval=str_replace("></selec' + 't>';", "></selec' + 't>' + '" . $secresult . "'; ", $retval);
}

echo $retval; // this get communicated back to TwentyTen theme's header.php changes as explained below ...
}

?>

… teaming up with this blog’s TwentyTen theme’s (good ol’) header.php changes (to suit above) that go

<?php

var rppspana=null;

function rpcheck() {
if (rppspana == null) {
var h3sare=document.getElementsByTagName('h3');
for (var ih3sare=0; ih3sare<h3sare.length; ih3sare++) {
if (('' + h3sare[ih3sare].innerHTML).indexOf('cent Post') != -1) { rppspana=h3sare[ih3sare]; }
}
}
if (rppspana != null && document.getElementById('xdrpl')) {
if (rppspana.innerHTML.indexOf('cent Post') != -1 && document.getElementById('xdrpl').innerHTML != '') {
var dx=document.getElementById('xdrpl').innerHTML;
document.getElementById('xdrpl').innerHTML='';
rppspana.innerHTML=rppspana.innerHTML.replace('cent Post', 'cent ' + dx + ' Post');
} else {
setTimeout(rpcheck, 4000);
}
} else if (document.getElementById('xdrpl')) {
setTimeout(rpcheck, 4000);
} else if (rppspana != null) {
setTimeout(rpcheck, 4000);
}
}


function preresize_font(aois) {
setTimeout(rpcheck, 3000);
zzzspare=aois.id.replace('t','d');
resize_font();
}

function is_mentioned_by() {
var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2"); // search URL returns
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>✂</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>🏃🏾‍♀️🏃🏼‍♂️</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; setTimeout(precheckclass,3000); " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
}
}
xpspana=docgetclass("entry-title", "h1"); // real blog postings
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>✂</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>🏃🏾‍♀️🏃🏼‍♂️</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " setTimeout(precheckclass,3000); title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
}
}
}

?>

… to move this newly created “Modified” (select element) dropdown from the Blog Posting content area over to the title of the Recent Posts widget to become that “Recent Posts” dropdown populated with a week’s worth of modified date changed blog posting titles that if selected navigate the user onto that blog posting.


Previous relevant WordPress Is Mentioned By Posting Order Tutorial is shown below.

WordPress Is Mentioned By Posting Order Tutorial

WordPress Is Mentioned By Posting Order Tutorial

We are revisiting the WordPress Blog “Is Mentioned By” functionality talked about at WordPress Is Mentioned By Posting Thread Tutorial for a few reasons …

  1. the order of blog postings that could end up on dropdowns as a result of this PHP code was not always chronological … and …
  2. the … “glimpse into” wording on the dropdown options told us (the users) nothing … and …
  3. the navigation off a user selected dropdown option was flaky and sporadic

… so let’s talk about these in more depth below …

  1. the order of blog postings that could end up on dropdowns as a result of this PHP code was not always chronological … so … we changed is_mentioned_by.php‘s central bit of SELECT (DML) SQL as per
    <?php

    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

    ?>
    … noting that ORDER BY clause fields should appear in the (SELECT) column list, and we chose to put it at the end (of that list) to avoid any array indexing code changes
  2. the … “glimpse into” wording on the dropdown options told us (the users) nothing … so … we changed is_mentioned_by.php‘s “function pluckfirstreal” as per
    <?php

    function pluckfirstreal($pcont) {
    $xpcont=$pcont;
    if (strpos($xpcont, "[/caption]</p>") !== false) {
    $xpcont=explode("[/caption]</p>", $pcont)[1];
    } else if (strpos($xpcont, "[/caption]") !== false) {
    $xpcont=explode("[/caption]", $pcont)[1];
    }

    $paras = explode("</p", str_replace("<p", "</p", $xpcont));
    if (sizeof($paras) > 2) {
    $oth = explode("<", $paras[1]);
    $retval = " ... ";
    for ($i=0; $i<sizeof($oth); $i++) {
    $huh = explode(">", $oth[$i]);
    $retval .= str_replace("'", "`", str_replace("}", " ", str_replace("{", " ", $huh[-1 + sizeof($huh)])));
    }
    return substr($retval,0,200);
    }
    return "";
    }

    ?>
  3. the navigation off a user selected dropdown option was flaky and sporadic … so … in (good ol’) header.php of the WordPress Blog TwentyTen theme folder we changed
    <?php

    function changed(inval,intxt) {
    if (1 == 1 || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    if (callwhat.length == 0) {
    parentwino(inval,intxt.toLowerCase(),'');
    }
    }

    if (callwhat.length > 1) {
    if (prevxcmd != "") {
    eval(prevxcmd);
    } else if (prevcmd != "") {
    eval(prevcmd.replace("''","'top=50,left=50,width=600,height=600'"));
    }
    prevxcmd="parentwino('" + inval + "','" + intxt.toLowerCase() + "','top=50,left=50,width=600,height=600')";
    prevcmd="";
    } else if (callwhat.length == 1) {
    if (sitlist.indexOf(',') != -1) {
    prevcmd="";
    prevxcmd="";
    var invala=sitlist.split(',');
    for (var ip=0; ip<invala.length; ip++) {
    if (prevxcmd != "") {
    eval(prevxcmd);
    } else if (prevcmd != "") {
    eval(prevcmd.replace("''","'top=50,left=50,width=600,height=600'"));
    }
    prevxcmd="parentwino('" + invala[ip] + "','" + intxt.toLowerCase() + "','top=50,left=50,width=600,height=600')";
    prevcmd="";
    }
    } else if (1 == 1) {
    parentwino(inval,intxt.toLowerCase(),'');
    } else {
    if (prevcmd != "") {
    eval(prevcmd);
    } else if (prevxcmd != "") {
    eval(prevxcmd.replace("'top=50,left=50,width=600,height=600'", "''"));
    }
    prevcmd="parentwino('" + inval + "','" + intxt.toLowerCase() + "','')";
    prevxcmd="";
    }
    }
    }

    function antiaway() {
    if (document.getElementById('hfloater') && document.getElementById('aaway')) {
    document.getElementById('hfloater').innerHTML=document.getElementById('hfloater').innerHTML.replace(' ' + document.getElementById('aaway').outerHTML, '');
    }
    }


    function parentwino(a, b, c) {
    var woisp=null, eqas=null;
    if (c == "") {
    try {
    if (woisp == null && document.getElementById('hfloater')) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    document.getElementById('hfloater').innerHTML+=' <a id="aaway" target="_blank" href="' + a + '" style="display:none;">WOpen</a>';
    document.getElementById('aaway').click();
    setTimeout(antiaway, 4300);
    } else {
    woisp=window.open(a,b);
    }
    } catch(eqas) {
    woisp=null;
    }

    return woisp; //window.open(a,b);

    } else {
    try {
    if (woisp == null && document.getElementById('hfloater')) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    document.getElementById('hfloater').innerHTML+=' <a id="aaway" target="_blank" href="' + a + '" style="display:none;">WOpen</a>';
    document.getElementById('aaway').click();
    setTimeout(antiaway, 4300);
    } else {
    woisp=window.open(a,b,c);
    }
    } catch(eqas) {
    woisp=null;
    }
    }

    return woisp; //window.open(a,b,c);
    }

    ?>
    … helping reduce the amount of Javascript window.open we call (and use)
  4. To try this, try the “emoji button” above.


    Previous relevant WordPress Is Mentioned By Posting Thread Tutorial is shown below.

    WordPress Is Mentioned By Posting Thread Tutorial

    WordPress Is Mentioned By Posting Thread Tutorial

    At this blog we are keen for users to learn one off ideas and on occasions linked “threaded” (or blog postings of a theme) ones.

    The last WordPress Blog (TwentyTen theme) “Is Mentioned by” functionality is good for certain scenarios, but what if you arrive at a blog posting that is part of a “threaded” series of blog postings? We normally show you older ones and that’s fine. But I’m not so much talking about the avid reader here who follows it “hot off the press” but more the users finding things off search engines, coming to this blog, and the posting they get to may not be the last in the “thread”. Below the blog posting they log in at, the reader can read all the information of the past to do with the thread, but what of getting it into context, relative to the entire “thread” up to that point, or out more recently “beyond” it? Well, that is the purpose of today’s extension of functionality to the WordPress Blog “Is Mentioned by” functionality we last finished up discussing with WordPress Is Mentioned By Code Download Progress Tutorial as shown below.

    Surprisingly the WordPress Blog TwentyTen theme’s header.php does not need to change to make this happen. The PHP that queries the WordPress MySql database can handle all the change today, and ended up looking like is_mentioned_by.php changing this way.

    The method is to …

    • query the MySql database with a more complex query that results in data for …
    • “is mentioned by” and “is part of a blog posting thread” are represented by two separate dropdowns … and …
    • in order to show you the context of the current blog posting in a blog posting “thread” we have an HTML select size property set to the number of dropdown records … alas, mobile platforms do not honour the size property regarding their display of dropdowns … display and set the selected property to the current blog posting’s entry, with this entry consisting of …
    • a blog posting title and the first paragraph of content are put into the “is part of a blog posting thread” dropdown option text to enhance the context for the user, shown this list with the most recent posting first down in reverse chronological order to the older blog posting of the “thread” down the bottom

    Below in bold is how the MySql query got more complex …


    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%'");

    where the (new) variable $ourother is set to being the first few words of the blog posting title.

    In order to “pluck out” one paragraph from the content (of variable $pcont) we use …


    function pluckfirstreal($pcont) {
    $paras = explode("</p", str_replace("<p", "</p", $pcont));
    if (sizeof($paras) > 2) {
    $oth = explode("<", $paras[1]);
    $retval = " ... ";
    for ($i=0; $i<sizeof($oth); $i++) {
    $huh = explode(">", $oth[$i]);
    $retval .= str_replace("'", "`", str_replace("}", " ", str_replace("{", " ", $huh[-1 + sizeof($huh)])));
    }
    return substr($retval,0,200);
    }
    return "";
    }

    … to append to the blog posting title as the user’s dropdown text for contextual purposes.

    Stop Press

    Was this a Bad Day at Black Rock? We revisit this work with WordPress Is Mentioned By Posting Order Tutorial.


    Previous relevant WordPress Is Mentioned By Code Download Progress Tutorial is shown below.

    WordPress Is Mentioned By Code Download Progress Tutorial

    WordPress Is Mentioned By Code Download Progress Tutorial

    There are various approaches with user experience (UX) considerations regarding putting a web application user at their ease as they wait for a response. I’m talking about where the response is coming from a separate serverside script doing something that may take a while, such as querying a database for instance, and that responder will do the work back at its parent to say it has finished its job. Given all this, you may be asking “What is there left to worry about, with the user, if the responder is doing this?”. Well, there is that amount of time between …

    • clicking the action item of HTML at the parent … all the way through to …
    • the responder “child”, often serverside code (for us, PHP), finishing its work and fixing the parent webpage to indicate that it has finished its work

    Now, we all hope this time period is short, and, hopefully, most of the time, it is short, and perhaps it is “overkill” to worry about doing anything here. However there are some things to consider …

    • if you are writing commercial software code there could well be an UX expectation that you would code for this, to keep the user informed at all times … and …
    • it could be the case that the database crashes at that very “clicking” moment, and though your responder may not get back to the parent with information, at least if you’ve coded for the scenario back at the client, at least the user will know something is being attempted, even if it doesn’t appear to be succeeding, which is less frustrating than getting no information at all, which could be mistaken for software code “hanging” … definitely not a great UX feel, or look

    Now there are a variety of client code approaches for showing “progress”, such as …

    • additional progress bar … like
    • additional meter … like
    • something you just clicked, changing appearance cyclically over time

    That last one appeals to us for a recent bit of functionality we added to this WordPress Blog you are reading, as well as for the fact that what we show “progress” on is difficult to numerically quantify as far as completion time is concerned, and so the first two above are not as suitable. We actually change the HTML div element font size to make an emoji “button” pressed “throb” while the user waits for the PHP and MySql query to respond back. Do you remember our thread of blog posting that used to end with WordPress Is Mentioned By Code Download CSS Tutorial? That’s the functionality we’re talking about today, as we do at WordPress 4.1.1’s WordPress Is Mentioned By Code Download Progress Tutorial.

    Now reading that previous link’s content below, you may see that we have considered the scenario of the child responder not finding any mentions and responding with …

    Sadly, this tutorial is not mentioned by any others, yet

    … which is good, but it may either take a long time for the responder to work this out, or, as we’ve indicated above, the responder’s mechanism for finding out may fail, and we’re dealing with that, from the perspective of the user looking at the client webpage, and waiting for information after clicking that emoji link we introduced when we did that work in that tutorial.

    We decided to prove our method with a “proof of concept” local MAMP web server HTML and Javascript and CSS parent taking …

    1. one blog posting bit of HTML body HTML …
    2. the is_mentioned_by function renamed to was_is_mentioned_by and a new is_mentioned_by worked until it works, tested via the Safari web browser’s Develop menu’s Web Inspector (similar to the Firefox Firebug web inspector we tend to go on and on and on and on and on and on about at this blog)

    … that took the form of this imb_poc.html … supervising the reworked PHP serverside code is_mentioned_by.php on MAMP that is, deliberately, made to …

    • wreck the connection to MySql … and then intervene to …
    • change the die message to instead sleep(18) before showing “Sadly, this tutorial is not mentioned by any others, yet” … at which time our changes should look good UX wise for the user

    We must stress this about “proof of concept”. Don’t waste time on “proof of concept” with too much fine grain simulation of the original scenario, if it is not involved in what you are proving, that is different, and is what is being tested here. See how it can even be that it suits the purposes of some “proof of concept” scenarios, like today’s, that you wreck the MySql connection in a progress “proof of concept” scenario, for example?

    We made these WordPress Blog changes in good ol’ TwentyTen themed header.php, as we so often do, and show changed code bold below …


    <script>
    var ourfs=21, zzzspare='';
    // ...
    // lots of other Javascript code
    // ...
    // down to ...

    function preresize_font(aois) {
    zzzspare=aois.id.replace('t','d');
    resize_font();
    }

    function resize_font() {
    ourfs=eval((ourfs + 5) % 45);
    if (document.getElementById(zzzspare).innerHTML.indexOf('<select ') != -1) {
    ourfs=21;
    } else {
    setTimeout(resize_font, 500);
    }
    document.getElementById(zzzspare).style.fontSize='' + ourfs + 'px';
    }

    function is_mentioned_by() {
    var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    xpspana=docgetclass("entry-title", "h1");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    }

    … where is_mentioned_by function is called by the document.body onload event, to trigger all this. You can see some of all this with today’s tutorial picture, and by trying to click some of the right pointing emoji “is mentioned by” functionality “buttons” you see next to Blog Posting Titles around you here at this WordPress TwentyTen themed blog, but here’s hoping you don’t see too many throbbing emojis … heaven forbid?!

    Stop Press

    More regarding this CSS cursor property tomorrow.


    Previous relevant WordPress Is Mentioned By Code Download CSS Tutorial is shown below.

    WordPress Is Mentioned By Code Download CSS Tutorial

    WordPress Is Mentioned By Code Download CSS Tutorial

    A few things come together for today’s user experience (UX) inspired tutorial whereby …

    … to make what we are doing stand out more for the user, who may “swim” in a large table devoid of any styling to focus their attention.

    We’ll leave you with modified PHP, that writes out the HTML Code Download Table manipulator, you could call getmelist.php and which changed in this way to make the Code Download Table be more usercentric with its presentation of hashtagged calls linking a WordPress Blog Posting at this blog with a particular piece of software code of interest in our Code Download Table.

    Hope you try this functionality out for yourself.


    Previous relevant WordPress Is Mentioned By Code Download Navigation Tutorial is shown below.

    WordPress Is Mentioned By Code Download Navigation Tutorial

    WordPress Is Mentioned By Code Download Navigation Tutorial

    We’re following up on some recent WordPress navigation logic today, that we started with WordPress Is Mentioned By Navigation Primer Tutorial as shown below, for blog posting relationships between …

    • A blog posting being referred to … back, optionally, as a link, to …
    • A blog posting that mentioned that blog posting currently being viewed

    … and looking at this premise, it stands to reason that as helpful as this concept looks on paper, if a regular reader expects a recent posting be referred to by others “hot off the press” they’d be expecting quite a lot, and though what they get in this scenario …

    Sadly, this tutorial is not mentioned by any others, yet

    … probably does a good job tweaking them to the dilemma of “hot off the press” being “too recent to be referred to” it still remains a disappointment, perhaps. So, thinking a tad laterally on this, what is going to help out here will be to particularize the scenario for what we do around here … and am sorry if this annoys, but we are showing a line of thinking here … and allow for Blog Posts that contain the word “GETME” … our favourite code download mechanism around here … to add a “Code Download Table” dropdown option, that if selected will lob the user directly onto the RJM Programming Code Download Table entry for the first “GETME” file link found in that blog posting. This additional scouring of the MySql database, that utilizes the SQL UNION operator (the “adding an extra clause or paragraph” SQL operator, we like to think of it as) with its query, will not be relevant to all unmentioned blog postings, but it will help those that talk about software coding, which is quite a few.

    That functionality had us looking back at how the Code Download Table was constructed in terms of its hashtagging when we discussed PHP Blog Summary Follow Up Tutorial. In this way, we had a first try at …

    • … using the hashtagging for a date … as you see with these changes to is_mentioned_by.php at the left hand column of the Code Download Table … did a couple of unit tests seeing the first one work, the second one work if you take it a day back, and the third one not work at all, at which point it tweaked with us that the date in the Code Download Table is a date reflected by the software code file’s modified date, not the WordPress Blog Posting publication date, that we can derive off our amended query … so that being less friendly than we envisaged we end up …
    • … using the very interesting hashtagging that particularizes the filename, where the read file extension (minus all the “GETME” and “-“‘s and “_”‘s that is) is taken out of the prefix to the hashtag, and made into a suffix … like “analogue_clock.-GETMEhtml” for Analogue Clock Timezone Tutorial that is exemplified in today’s tutorial picture and as you can see the changes for at this is_mentioned_by.php link

    So it panned out to make this happen the original Code Download Table code did not need any tweaking, not good ol’ WordPress TwentyTen theme header.php … just is_mentioned_by.php … but we hope you try out clicking some “White Right Pointing Index” emoji …

    … at this WordPress blog sometime soon.

    Did you know?

    What gives with the &tsp=[someBigNumber] GET parameter … like is yellow highlighted in today’s tutorial picture … in the “Code Download Table” lookup URLs? This is so that we end up with different URLs each time a user accesses this functionality. This is because web browsers often try to help you out with speeding up your browsing, and use the web browser cache to “regurgitate” a previously visited URL should that have happened since the last clearing of any web browser cache, to “slap” the cache version quickly on the screen. But we don’t want any “slapping” to go on around our functionality today, and a way to force the web browser to reconsider the real lookup, and go back to the real web server again for data, is to make your URL be unique. A curiosity here you can try is to use something like a local MAMP (for Mac or EasyPHP for Windows) local web server to, for an image file called image.jpg that is put into the Apache web server’s Document Root

    1. see the image in your favoured web browser with the URL HTTP://localhost:8888/image.jpg … then …
    2. change that image somehow with an image editor … and …
    3. refresh, or revisit the image with the URL HTTP://localhost:8888/image.jpg … and you’ll probably see the cached web server version … unless you haven’t got web browser caching going … so amend this to …
    4. revisit the image with the URL HTTP://localhost:8888/image.jpg?random=7456536 … and this time we think you’ll see the amended image that happened with your image editing … and yes, you can add GET parameters to your URLs even for image URLs (often, most helpfully with image URLs, actually)

    Previous relevant WordPress Is Mentioned By Navigation Primer Tutorial is shown below.

    WordPress Is Mentioned By Navigation Primer Tutorial

    WordPress Is Mentioned By Navigation Primer Tutorial

    We’ve written some new WordPress navigation logic today, for blog posting relationships between …

    • A blog posting being referred to … back, optionally, as a link, to …
    • A blog posting that mentioned that blog posting currently being viewed

    … done, because we see that it is not only the “vertical” type linking of blog postings into a “thread” that helps understanding … we hope … but also to jump around among commonalities between concepts (like “horizontal” “degrees of separation”), perhaps. This functionality involves MySql database queries, and is best suited to a user clicks something (rather than pre-emptive content loading) to reach the functionality so that our database query has a post title to work with, and also so that every blog post does not overload the web server with a query ahead of time whose work may not be accessed anyway. The something that is clicked is an HTML a tag whose “look” is an Emoji.

    We also wrote a proof of concept, before applying that proof of concept live. To us, a “proof of concept” is not much use if it is as involved as what it is trying to prove, and in today’s scenario we did a proof of concept for two scenarios, that being …

    • a blog posting that was referred to by others … and …
    • a blog posting that wasn’t … doh! … but if you don’t change something about the “look of things” you’ll confuse the user as to whether the web application just took notice of their click (via the onclick event) … so this is of mild importance, but we grant you that it is not as important as the first scenario’s workings

    We quite often adopt a proof of concept scenario which tests the workings of a child (often in an HTML iframe element), in this case, PHP server side, piece of code, by introducing a simplified and pared down parent, in this case HTML piece of code. At the end of successful testing you are left with a good, and close to totally suitable child piece of code, to slot into the functionality of the real and live parent code.

    That proof of concept was definitely a good “unit testing” thing to do, but nevertheless, don’t feel overconfident as you go live … living with other real “goings on” on the live website are things to consider, and test … it took us half an hour to iron out these types of issues.

    The other good thing to have on your side is a Web Inspector like on Safari, similar to the Firefox Firebug web inspector we tend to go on and on and on and on and on and on about at this blog. We’re giving you a Safari rest on that today, and we want to show you an “early days” view …

    … in the proof of concept help that the Safari Web Inspector gave us, delving in under the called (by HTML parent) PHP’s actions. This type of information makes server side programming, like you do with PHP, that much easier … much easier than ideas where you write out web server files, with information, for your own benefit, or the other one we often like, during testing, is to write information out to top.document.title or perhaps to an alert box or to use console.log (on the debugging window, down the bottom).

    You’ll never guess where we made this change to our WordPress TwentyTen themed blog? Give up … yes, good ol’ header.php changed in the bold Javascript new function way below …



    function is_mentioned_by() {
    var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="display:inline;text-decoration:none; border:2px solid yellow;" onclick=" document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    xpspana=docgetclass("entry-title", "h1");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="display:inline;text-decoration:none; border:2px solid yellow;" onclick=" document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    }

    … called by …


    <body onload=" checkonl(); setTimeout(initpostedoncc, 3000); widgetcon(); precc(); courseCookies(); cookie_fonts(); is_mentioned_by(); " <?php body_class(); ?>>

    Team that with some new PHP source code you could call is_mentioned_by.php and you have today’s new WordPress blog TwentyTen theme “Is Mentioned By” functionality.

    The proof of concept parent HTML was is_mentioned_by.html for your perusal.

    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment

WordPress Blog Thread Story Mode Tutorial

WordPress Blog Thread Story Mode Tutorial

WordPress Blog Thread Story Mode Tutorial

We feel a “tweak” coming on. It’s been a while since the last such “tweak”. We’re talking about doing the frequent …

  • good ol’ “tweaking” of header.php … owned by our …
  • wordpress.org based WordPress Blog …
  • theme TwentyTen … means by which we …
  • can “tweak” in the morning, at supper time, and in small cubicles the look and feel and “way it works” aspects to the blog you are reading

Yes, it’s mainly header.php we use, though do remember functions.php, footer.php, 404.php and some plugins as well, but the “tweaking” of header.php is the easiest, for most jobs.

Picking up from the, largely, document.body onload event interventions we make happen this way, we latch onto a previous intervention, and “retweak” that (past work related to WordPress Is Mentioned By Less Recently Modified Tutorial), today, to add …


New "Story Mode" display of a thread of WordPress blog postings

… this use of “thread” not being a technical term, rather how we describe how we string together related blog postings (that usually follow each other reverse chronologically (ie. latest blog posting first)) into, what we term, a “blog posting thread”.

But yesterday, suddenly, it dawned on us, that this “blog posting thread” can be confusing for readers coming in to the discussion half way through, or near the end, so why not offer them a new 📖 (&#128214; … ie. story) based (adding to a global var threaddivs=[]; statement part) …

<?php echo ”

function storyizecollect() {
var divsall=document.getElementsByTagName('div');
for (var ivd=0; ivd<divsall.length; ivd++) {
if (divsall[ivd].outerHTML.split('>')[0].indexOf(' post type-post ') != -1) {
threaddivs.push('' + divsall[ivd].id);
}
}
}

function storyresize(atoo) {
//atoo.style.width='' + atoo.getAttribute('data-w') + 'px';
//atoo.style.height='' + atoo.getAttribute('data-h') + 'px';
atoo.style.backgroundColor='rgba(255,155,55,0.3)';
atoo.style.overflow='hidden';
return atoo;
}

function storyreorder(atofind) {
var hrparts=[], hroh='', reorderedcontent='', hrih='', hrdone=false, hrplus='';
var atobr=atofind.getBoundingClientRect();
atofind.setAttribute('data-w',('' + atobr.width));
atofind.setAttribute('data-h',('' + atobr.height));
atofind.setAttribute('data-st',('' + document.body.scrollTop));
for (var ivd=0; ivd<threaddivs.length; ivd++) {
if (document.getElementById(threaddivs[ivd])) {
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf(atofind.outerHTML) != -1 && !hrdone) {
atofind.setAttribute('data-done', 'y');
atofind.style.overflow='scroll';
atofind.style.borderLeft='1px dashed red';
atofind.style.WebkitOverflowScrolling='touch';
atofind.style.zoom='0.4';
if (document.getElementById(threaddivs[ivd]).innerHTML.indexOf('<hr title=') != -1) { hrplus=' title='; }
hrparts=document.getElementById(threaddivs[ivd]).innerHTML.split('<hr' + hrplus);
if (eval('' + hrparts.length) > 1) {
hrih='<hr' + hrplus + hrparts[1].split('>')[0] + '>';
if (hrih.indexOf('/>') == -1 && document.getElementById(threaddivs[ivd]).innerHTML.indexOf('</hr>') != -1) {
hrih+='</hr>';
}
hroh='<hr' + hrplus + hrparts[1].split('>')[0].replace(/\//g,'') + '></hr>';
}
if (hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent='<div style=display:none;>' + hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent=hrparts[eval(-1 + eval('' + hrparts.length))].replace(hrih.replace('<hr' + hrplus,''),'');
}
for (var iivd=eval(-2 + eval('' + hrparts.length)); iivd>=0; iivd--) {
if (hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') != -1 && hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'').indexOf('If this' + ' was interesting ') < 100) {
reordercontent+=hroh.replace('<hr','<hr style="display:none;"');
reordercontent='<div style=display:none;>' + hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'') + '</div>';
} else {
reordercontent+=hroh;
reordercontent+=reordercontent=hrparts[iivd].replace(hrih.replace('<hr' + hrplus,''),'');
}
}
if (reordercontent != '') {
hrdone=true;
atofind.innerHTML+='<br><details title="Thread story ..." open><summary title="Thread story ..."></summary><br>' + reordercontent + '</details>';
reordercontent='';
}
}
}
}
}


function storymember(inoh) {
if (inoh.indexOf('<div data-w=') == 0) { return true; }
if (inoh.indexOf('<details') == 0) { return true; }
return false;
}


function is_mentioned_by() {
//rppspana=docgetclass("widget-title", "h3");
var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2"); // search URL returns
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>&#9986;</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>&#127939;&#127998;&#8205;&#9792;&#65039;&#127939;&#127996;&#8205;&#9794;&#65039;</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; setTimeout(precheckclass,3000); " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div data-w="0" data-h="0" data-st="0" data-style="-webkit-overflow-scrolling:touch;overflow:scroll;" data-done="" onclick=" if (' + "('' + " + 'event.target.id) == this.id || 1 == 1) { if (this.getAttribute(' + "'data-done'" + ').length == 0) { storyreorder(this); } else if (storymember(event.target.outerHTML)) { this.style.zoom=1.0; storyresize(this).innerHTML=' + "'&#128214;'" + '; this.setAttribute(' + "'data-done',''" + '); window.scrollTo(0,this.getAttribute(' + "'data-st'" + ')); } } " title="Reorder thread blog postings to read like a story ..." style="display:inline-block; text-decoration:none; cursor:pointer; background-color:rgba(255,155,55,0.3);" id=r' + zspare + '>&#128214;</div>';
}
}
xpspana=docgetclass("entry-title", "h1"); // real blog postings
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>&#9986;</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" ondblclick="dblrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" ' + oncm + '"rcrplatern(' + String.fromCharCode(39) + xspare + String.fromCharCode(39) + ');" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase ... double click ' + oncmt + ' for blog posting image involvement ... to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>&#127939;&#127998;&#8205;&#9792;&#65039;&#127939;&#127996;&#8205;&#9794;&#65039;</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " setTimeout(precheckclass,3000); title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div data-w="0" data-h="0" data-st="0" data-style="-webkit-overflow-scrolling:touch;overflow:scroll;" data-done="" onclick=" if (' + "('' + " + 'event.target.id) == this.id || 1 == 1) { if (this.getAttribute(' + "'data-done'" + ').length == 0) { storyreorder(this); } else if (storymember(event.target.outerHTML)) { this.style.zoom=1.0; storyresize(this).innerHTML=' + "'&#128214;'" + '; this.setAttribute(' + "'data-done',''" + '); window.scrollTo(0,this.getAttribute(' + "'data-st'" + ')); } } " title="Reorder thread blog postings to read like a story ..." style="display:inline-block; text-decoration:none; cursor:pointer; background-color:rgba(255,155,55,0.3);" id=r' + zspare + '>&#128214;</div>';
}
}
storyizecollect();
}

“; ?>

… reworking of the “blog posting thread” order from oldest through to most recent, like a “story” view of the “blog posting thread” ideas and development. You might notice that we often start a “thread” involving the word “Primer” in the blog posting title.


Previous relevant WordPress Is Mentioned By Less Recently Modified Tutorial is shown below.

WordPress Is Mentioned By Less Recently Modified Tutorial

WordPress Is Mentioned By Less Recently Modified Tutorial

Supposing you came in here paying scant attention to the Blog Posting Title and its Animated GIF Tutorial picture I’d like to set you the challenge to look at the build up to organizing the use of the theme for today’s tutorial, and you try to anticipate what that may be? Up to the challenge? We hope so, because, with respect to the recent WordPress Is Mentioned By Recently Modified Tutorial‘s …

  • MySql SQL …
    <?php

    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, -1 as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 WEEK " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

    ?>
    … we changed it to be
    <?php

    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, (-480 + TIMESTAMPDIFF(MINUTE,NOW()," . $tname . ".post_modified)) as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 MONTH " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

    ?>
    … to fit in with …
  • we changed the modified is_mentioned_by.php‘s SQL result set logic “if logic framework” … from
    <?php

    while (($r_array = mysql_fetch_row($res))) {
    if ($r_array[3] == "-1" && strtolower($r_array[3]) == strtolower($r_array[4])) {
    // this is a member of the modified list (via middle UNION SELECT) of the MySQL SQL query result set
    } else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
    // matches current post logic goes here
    } else {
    // does not match current post logic goes here
    }
    }

    ?>
    to
    <?php

    while (($r_array = mysql_fetch_row($res))) {
    if ($r_array[3] == "-1" && strpos(("" . $r_array[4]), "-") !== false) {
    // this is a member of the modified (and less recently modified) list (via middle UNION SELECT) of the MySQL SQL query result set
    } else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
    // matches current post logic goes here
    } else {
    // does not match current post logic goes here
    }
    }

    ?>
    … turning a “binary” piece of logic into a “ternary” (and above) one … as well as, for good ol’ header.php we add some global Javascript variables

    var coption='option';
    var cdisabled='disabled';
    var chidden='hidden';
    var cblank='_blank';

Is it apparent to you now what we are using to achieve some new “Less Recently Modified Tutorial” list data onto the “Recently Modified Tutorial” list data of below? But how do we go about doing that, that has been an enthusiasm around here, of recent times? What if we could say …

  • we changed the modified is_mentioned_by.php‘s SQL result set logic “within that top if logic” … from
    <?php

    if ($secresult == "") {
    $secresult=" <span id=xdrpl><select style=\"background-color:orange;display:inline-block;width:80px;\" id=mr" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Modified recently (over last week)\"><option value=\"\">Modified</option></select></span> ";
    }
    $secresult=str_replace('>Modified</option>','>Modified</option><option value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . '>' . $r_array[0] . '</option>', $secresult);

    ?>
    to
    <?php

    if ($secresult == "") {
    $secresult=" <span id=xdrpl><select style=\"background-color:orange;display:inline-block;width:80px;\" id=mr" . permalinkit($ourtitle) . " onchange=\"if (this.value.trim().length == 0) { var optslst=document.getElementsByTagName(coption); for (var ioptslst=0; ioptslst<optslst.length; ioptslst++) { if (optslst[ioptslst].outerHTML.indexOf(this.value) != -1) { if (optslst[ioptslst].outerHTML.indexOf(cdisabled) != -1) { optslst[ioptslst].removeAttribute(cdisabled); } if (optslst[ioptslst].outerHTML.indexOf(chidden) != -1) { optslst[ioptslst].removeAttribute(chidden); } } } } else { window.open(this.value,cblank); }\" title=\"Modified recently (over last week)\"><option value=\"\">Modified</option></select></span> ";
    }
    if ($r_array[4] <= -11520) {
    $blks=(40 - floor((0 - $r_array[4]) / (24 * 60)));
    $optv='<option value="">Enable and show through to ' . (40 - $blks) . ' days';
    $altv=' title=""';
    for ($iblks=0; $iblks<$blks; $iblks++) {
    $altv=str_replace(' title="', ' title=" ', $altv);
    $optv=str_replace(' value="', ' value=" ', $optv);
    }
    if (strpos($secresult, $optv) !== false) { $secresult=str_replace($optv . " ... ",$optv . " ... " . $r_array[0] . " and ",$secresult); $optv=""; } else { $optv .= " ... " . $r_array[0] . "</option>"; }
    $secresult=str_replace('>Modified</option>','>Modified</option>' . $optv . '<option' . $altv . ' value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . ' disabled hidden>' . $r_array[0] . '</option>', $secresult);
    } else {

    $secresult=str_replace('>Modified</option>','>Modified</option><option value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . '>' . $r_array[0] . '</option>', $secresult);
    }

    ?>
  • and does the disabled hidden above tell you more?

Yes, back with the recent Emoji Circuit Quiz Animated Emoji Tutorial you might recall …

We’ve also long been interested in HTML select (dropdown) element option (subelement) disabling and/or hiding (statically or dynamically (as with today’s Javascript work)), and today, for the first time for us, we put this into action

… and we’ve found a new (probably you’d say, “more apt”) use of this idea. We differentiate the …

  • arguably more potent “week’s worth” of modified postings list (as per WordPress Is Mentioned By Recently Modified Tutorial‘s situation) … still as is, and “singly selectable” … with …
  • new less potent (you could argue) “older than one week and up to one month” of modified postings list that can be made “singly selectable” by the user (but don’t start that way, because they initially have “hidden” and “disabled” option element attributes set) … and …
  • in order to save space and honour those platforms that really render the “hidden” option tags we add “older than one week and up to one month” blog posting titles onto the “selectable day age” ones (all causing a select (dropdown) element value property of blank (if trimmed … ie. their length matches (40 – number of days age)) so that that new Javascript onchange logic can just look for a select element value existing in an option (list) member outerHTML property in order to decide whether to remove the “disabled” and “hidden” properties initially populated into those option “older than one week and up to one month” elements

Now can we recommend turning off the “scant attention” and having a look at today’s animated GIF tutorial picture showing a bit of how this new functionality works in practice here at the WordPress TwentyTen themed blog you are reading up with the emoji button (you click) above.

For biassed moi, just another reason to keep on admiring and using the ever useful HTML select (dropdown) element in our web applications.


Previous relevant WordPress Is Mentioned By Recently Modified Tutorial is shown below.

WordPress Is Mentioned By Recently Modified Tutorial

WordPress Is Mentioned By Recently Modified Tutorial

Administering this blog there are two major criteria that would cause a blog posting’s modified date to change, that being …

  1. at this blog we schedule one new blog post per day … and …
  2. as we see things, on an ad hoc basis, we’ll make changes

… but that “Recent Posts” widget you see at this blog only reflects blog post criteria 1 above. Supposing you are following a thread of blog posts or an old blog post, try out the code and see that there is something amiss. How could this possibly be so! Yes, humanity rainsreigns, and we are scouring the postings you might visit to see what you might see, as a basis for revisits to code of the past.

And pretty naturally, if we find an issue, and can do something about it, with that category 2 blog posting type above, we may change one or other or both of …

  • the underlying code of said category 2 blog posting … and/or, as applicable …
  • the blog posting content of said category 2 blog posting

… the latter of which will cause that blog posting’s modified date to change, and as of today, adding onto yesterday’s WordPress Is Mentioned By Posting Order Tutorial, your clicking of “Is Mentioned By” “emoji button” above to change the “Recent Posts” widget title to “Recent Posts”, that (select element) dropdown populated in chronological order by a week’s worth of modified date changes at this blog. Using this, you may get an update to something you cannot figure, else drop us a line.

What needed to change for this? Well, first off, we’d like to thank the inspiration of 27 Handy SQL Query Hacks for WordPress for the means by which we changed is_mentioned_by.php‘s central SQL SELECT (DML) statement should receive a new UNION clause as per

<?php

$res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, -1 as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 WEEK " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

?>

… that -1 as tfind, -1 as tother an intentional ploy to fit in with a new “if” clause in the PHP (that loops through database record reads of the MySql SQL query above) as per

<?php

$secresult="";
if ($res == 0) {
if (1 == 2) echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");
} else if (mysql_num_rows($res) == 0) {
if (1 == 2) echo("<b>Query executed successfully</b>");
$retval=$delim;
$retval = str_replace(" }", " parent.document.getElementById('d" . permalinkit($ourtitle) . "').innerHTML='<select style=background-color:yellow; id=" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Is mentioned by\"><option value=\"\">Sadly, this tutorial is not mentioned by any others, yet</option></select>'; }", $retval);
} else {
while (($r_array = mysql_fetch_row($res))) {
if ($r_array[3] == "-1" && strtolower($r_array[3]) == strtolower($r_array[4])) {
if ($secresult == "") {
$secresult=" <span id=xdrpl><select style=\"background-color:orange;display:inline-block;width:80px;\" id=mr" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Modified recently (over last week)\"><option value=\"\">Modified</option></select></span> ";
}
$secresult=str_replace('>Modified</option>','>Modified</option><option value=HTTP://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . '>' . $r_array[0] . '</option>', $secresult);
}
else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
$isize++;
$retval = str_replace(" }", " isize++; theseopts=theseopts.replace(' size=' + eval(-1 + isize) + ' ', ' size=' + isize + ' ').replace('>','><option value=HTTP://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . " selected>" . $r_array[0] . pluckfirstreal($r_array[2]) . "</option>'); }", $retval);
} else {
$pdate = $r_array[1];
if ($retval == "") {
$retval=$delim;
$retval = str_replace(" }", " var theseoptions='<select style=background-color:yellow; id=" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Is mentioned by\"><option value=\"\">This tutorial is mentioned by ...</option></select>'; }", $retval);
$retval = str_replace(" }", " var theseopts='<select si' + 'ze=0 style=width:100%;background-color:#f0f0f0; class=select_ms id=z" . permalinkit($ourtitle) . " onchange=changed(this.value,ocb); title=\"Is part of a blog posting thread ... and you can select multiple tutorials to show\"></selec' + 't>'; }", $retval);
}
if ($r_array[3] != "0") $retval = str_replace(" }", " theseoptions=theseoptions.replace('</select>','<option value=HTTP://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . ">" . $r_array[0] . "</option></select>'); }", $retval);
if ($criteria != "") {
if (str_replace($criteria, "", $r_array[0]) != $r_array[0] && $r_array[4] != "0") {
$found = true;
$isize++;
$retval = str_replace(" }", " isize++; theseopts=theseopts.replace(' size=' + eval(-1 + isize) + ' ', ' size=' + isize + ' ').replace('>','><option value=HTTP://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . ">" . $r_array[0] . pluckfirstreal($r_array[2]) . "</option>'); }", $retval);
}
}
}
}
if ($retval != "") {
if (!$found) {
$retval = str_replace(" }", " theseopts=''; }", $retval);
} else {
$retval = str_replace(" }", " theseoptions+=(' ' + theseopts); }", $retval);
}
$retval = str_replace(" }", " parent.document.getElementById('d" . permalinkit($ourtitle) . "').innerHTML=theseoptions; parent.checkclass(\"\"); }", $retval);
}
}
mysql_close($link); // close the MySql database connection
if ($retval != "") {
if ($secresult != "") {
$retval=str_replace("></selec' + 't>';", "></selec' + 't>' + '" . $secresult . "'; ", $retval);
}

echo $retval; // this get communicated back to TwentyTen theme's header.php changes as explained below ...
}

?>

… teaming up with this blog’s TwentyTen theme’s (good ol’) header.php changes (to suit above) that go

<?php

var rppspana=null;

function rpcheck() {
if (rppspana == null) {
var h3sare=document.getElementsByTagName('h3');
for (var ih3sare=0; ih3sare<h3sare.length; ih3sare++) {
if (('' + h3sare[ih3sare].innerHTML).indexOf('cent Post') != -1) { rppspana=h3sare[ih3sare]; }
}
}
if (rppspana != null && document.getElementById('xdrpl')) {
if (rppspana.innerHTML.indexOf('cent Post') != -1 && document.getElementById('xdrpl').innerHTML != '') {
var dx=document.getElementById('xdrpl').innerHTML;
document.getElementById('xdrpl').innerHTML='';
rppspana.innerHTML=rppspana.innerHTML.replace('cent Post', 'cent ' + dx + ' Post');
} else {
setTimeout(rpcheck, 4000);
}
} else if (document.getElementById('xdrpl')) {
setTimeout(rpcheck, 4000);
} else if (rppspana != null) {
setTimeout(rpcheck, 4000);
}
}


function preresize_font(aois) {
setTimeout(rpcheck, 3000);
zzzspare=aois.id.replace('t','d');
resize_font();
}

function is_mentioned_by() {
var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2"); // search URL returns
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>✂</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>🏃🏾‍♀️🏃🏼‍♂️</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; setTimeout(precheckclass,3000); " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
}
}
xpspana=docgetclass("entry-title", "h1"); // real blog postings
for (ximb=0; ximb<xpspana.length; ximb++) {
xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
xspare=xxspare[eval(-1 + xxspare.length)];
zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
if (document.body.innerHTML.indexOf('d' + zspare) == -1) {
xpspana[ximb].innerHTML+=' <div style="display:inline-block;border:3px solid rgba(255,165,0,0.4); background-color:rgba(255,255,0,0.3); " id=cc' + zspare + '><a target=_blank style="cursor:pointer;display:inline-block;text-decoration:none; font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=tcc' + zspare + '>✂</a><a target=_blank style="background: rgba(0,255,0,0.3); background: -webkit-linear-gradient(left top, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -o-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: -moz-linear-gradient(bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); background: linear-gradient(to bottom right, rgba(0,255,0,0.3), rgba(255,255,0,0.3)); cursor:pointer;display:inline-block;text-decoration:none;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1); font-size:12px;" href=//www.rjmprogramming.com.au/slideshow.html?title=' + encodeURIComponent(xspare) + ' " title="Cut to the Chase to (the gist of) ' + (xspare) + '" id=ttcc' + zspare + '>🏃🏾‍♀️🏃🏼‍♂️</a><iframe style=display:none; id=icc' + zspare + ' src=></iframe></div>';
xpspana[ximb].innerHTML+=' <div style="display:inline; background-color:rgba(255,255,0,0.3);" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " setTimeout(precheckclass,3000); title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
}
}
}

?>

… to move this newly created “Modified” (select element) dropdown from the Blog Posting content area over to the title of the Recent Posts widget to become that “Recent Posts” dropdown populated with a week’s worth of modified date changed blog posting titles that if selected navigate the user onto that blog posting.


Previous relevant WordPress Is Mentioned By Posting Order Tutorial is shown below.

WordPress Is Mentioned By Posting Order Tutorial

WordPress Is Mentioned By Posting Order Tutorial

We are revisiting the WordPress Blog “Is Mentioned By” functionality talked about at WordPress Is Mentioned By Posting Thread Tutorial for a few reasons …

  1. the order of blog postings that could end up on dropdowns as a result of this PHP code was not always chronological … and …
  2. the … “glimpse into” wording on the dropdown options told us (the users) nothing … and …
  3. the navigation off a user selected dropdown option was flaky and sporadic

… so let’s talk about these in more depth below …

  1. the order of blog postings that could end up on dropdowns as a result of this PHP code was not always chronological … so … we changed is_mentioned_by.php‘s central bit of SELECT (DML) SQL as per
    <?php

    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");

    ?>
    … noting that ORDER BY clause fields should appear in the (SELECT) column list, and we chose to put it at the end (of that list) to avoid any array indexing code changes
  2. the … “glimpse into” wording on the dropdown options told us (the users) nothing … so … we changed is_mentioned_by.php‘s “function pluckfirstreal” as per
    <?php

    function pluckfirstreal($pcont) {
    $xpcont=$pcont;
    if (strpos($xpcont, "[/caption]</p>") !== false) {
    $xpcont=explode("[/caption]</p>", $pcont)[1];
    } else if (strpos($xpcont, "[/caption]") !== false) {
    $xpcont=explode("[/caption]", $pcont)[1];
    }

    $paras = explode("</p", str_replace("<p", "</p", $xpcont));
    if (sizeof($paras) > 2) {
    $oth = explode("<", $paras[1]);
    $retval = " ... ";
    for ($i=0; $i<sizeof($oth); $i++) {
    $huh = explode(">", $oth[$i]);
    $retval .= str_replace("'", "`", str_replace("}", " ", str_replace("{", " ", $huh[-1 + sizeof($huh)])));
    }
    return substr($retval,0,200);
    }
    return "";
    }

    ?>
  3. the navigation off a user selected dropdown option was flaky and sporadic … so … in (good ol’) header.php of the WordPress Blog TwentyTen theme folder we changed
    <?php

    function changed(inval,intxt) {
    if (1 == 1 || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    if (callwhat.length == 0) {
    parentwino(inval,intxt.toLowerCase(),'');
    }
    }

    if (callwhat.length > 1) {
    if (prevxcmd != "") {
    eval(prevxcmd);
    } else if (prevcmd != "") {
    eval(prevcmd.replace("''","'top=50,left=50,width=600,height=600'"));
    }
    prevxcmd="parentwino('" + inval + "','" + intxt.toLowerCase() + "','top=50,left=50,width=600,height=600')";
    prevcmd="";
    } else if (callwhat.length == 1) {
    if (sitlist.indexOf(',') != -1) {
    prevcmd="";
    prevxcmd="";
    var invala=sitlist.split(',');
    for (var ip=0; ip<invala.length; ip++) {
    if (prevxcmd != "") {
    eval(prevxcmd);
    } else if (prevcmd != "") {
    eval(prevcmd.replace("''","'top=50,left=50,width=600,height=600'"));
    }
    prevxcmd="parentwino('" + invala[ip] + "','" + intxt.toLowerCase() + "','top=50,left=50,width=600,height=600')";
    prevcmd="";
    }
    } else if (1 == 1) {
    parentwino(inval,intxt.toLowerCase(),'');
    } else {
    if (prevcmd != "") {
    eval(prevcmd);
    } else if (prevxcmd != "") {
    eval(prevxcmd.replace("'top=50,left=50,width=600,height=600'", "''"));
    }
    prevcmd="parentwino('" + inval + "','" + intxt.toLowerCase() + "','')";
    prevxcmd="";
    }
    }
    }

    function antiaway() {
    if (document.getElementById('hfloater') && document.getElementById('aaway')) {
    document.getElementById('hfloater').innerHTML=document.getElementById('hfloater').innerHTML.replace(' ' + document.getElementById('aaway').outerHTML, '');
    }
    }


    function parentwino(a, b, c) {
    var woisp=null, eqas=null;
    if (c == "") {
    try {
    if (woisp == null && document.getElementById('hfloater')) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    document.getElementById('hfloater').innerHTML+=' <a id="aaway" target="_blank" href="' + a + '" style="display:none;">WOpen</a>';
    document.getElementById('aaway').click();
    setTimeout(antiaway, 4300);
    } else {
    woisp=window.open(a,b);
    }
    } catch(eqas) {
    woisp=null;
    }

    return woisp; //window.open(a,b);

    } else {
    try {
    if (woisp == null && document.getElementById('hfloater')) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    document.getElementById('hfloater').innerHTML+=' <a id="aaway" target="_blank" href="' + a + '" style="display:none;">WOpen</a>';
    document.getElementById('aaway').click();
    setTimeout(antiaway, 4300);
    } else {
    woisp=window.open(a,b,c);
    }
    } catch(eqas) {
    woisp=null;
    }
    }

    return woisp; //window.open(a,b,c);
    }

    ?>
    … helping reduce the amount of Javascript window.open we call (and use)
  4. To try this, try the “emoji button” above.


    Previous relevant WordPress Is Mentioned By Posting Thread Tutorial is shown below.

    WordPress Is Mentioned By Posting Thread Tutorial

    WordPress Is Mentioned By Posting Thread Tutorial

    At this blog we are keen for users to learn one off ideas and on occasions linked “threaded” (or blog postings of a theme) ones.

    The last WordPress Blog (TwentyTen theme) “Is Mentioned by” functionality is good for certain scenarios, but what if you arrive at a blog posting that is part of a “threaded” series of blog postings? We normally show you older ones and that’s fine. But I’m not so much talking about the avid reader here who follows it “hot off the press” but more the users finding things off search engines, coming to this blog, and the posting they get to may not be the last in the “thread”. Below the blog posting they log in at, the reader can read all the information of the past to do with the thread, but what of getting it into context, relative to the entire “thread” up to that point, or out more recently “beyond” it? Well, that is the purpose of today’s extension of functionality to the WordPress Blog “Is Mentioned by” functionality we last finished up discussing with WordPress Is Mentioned By Code Download Progress Tutorial as shown below.

    Surprisingly the WordPress Blog TwentyTen theme’s header.php does not need to change to make this happen. The PHP that queries the WordPress MySql database can handle all the change today, and ended up looking like is_mentioned_by.php changing this way.

    The method is to …

    • query the MySql database with a more complex query that results in data for …
    • “is mentioned by” and “is part of a blog posting thread” are represented by two separate dropdowns … and …
    • in order to show you the context of the current blog posting in a blog posting “thread” we have an HTML select size property set to the number of dropdown records … alas, mobile platforms do not honour the size property regarding their display of dropdowns … display and set the selected property to the current blog posting’s entry, with this entry consisting of …
    • a blog posting title and the first paragraph of content are put into the “is part of a blog posting thread” dropdown option text to enhance the context for the user, shown this list with the most recent posting first down in reverse chronological order to the older blog posting of the “thread” down the bottom

    Below in bold is how the MySql query got more complex …


    $res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
    AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
    OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother FROM " . $tname . "
    WHERE " . $tname . ".post_status = 'publish' " . "
    AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
    AND " . $tname . ".post_content like '%GETME%'");

    where the (new) variable $ourother is set to being the first few words of the blog posting title.

    In order to “pluck out” one paragraph from the content (of variable $pcont) we use …


    function pluckfirstreal($pcont) {
    $paras = explode("</p", str_replace("<p", "</p", $pcont));
    if (sizeof($paras) > 2) {
    $oth = explode("<", $paras[1]);
    $retval = " ... ";
    for ($i=0; $i<sizeof($oth); $i++) {
    $huh = explode(">", $oth[$i]);
    $retval .= str_replace("'", "`", str_replace("}", " ", str_replace("{", " ", $huh[-1 + sizeof($huh)])));
    }
    return substr($retval,0,200);
    }
    return "";
    }

    … to append to the blog posting title as the user’s dropdown text for contextual purposes.

    Stop Press

    Was this a Bad Day at Black Rock? We revisit this work with WordPress Is Mentioned By Posting Order Tutorial.


    Previous relevant WordPress Is Mentioned By Code Download Progress Tutorial is shown below.

    WordPress Is Mentioned By Code Download Progress Tutorial

    WordPress Is Mentioned By Code Download Progress Tutorial

    There are various approaches with user experience (UX) considerations regarding putting a web application user at their ease as they wait for a response. I’m talking about where the response is coming from a separate serverside script doing something that may take a while, such as querying a database for instance, and that responder will do the work back at its parent to say it has finished its job. Given all this, you may be asking “What is there left to worry about, with the user, if the responder is doing this?”. Well, there is that amount of time between …

    • clicking the action item of HTML at the parent … all the way through to …
    • the responder “child”, often serverside code (for us, PHP), finishing its work and fixing the parent webpage to indicate that it has finished its work

    Now, we all hope this time period is short, and, hopefully, most of the time, it is short, and perhaps it is “overkill” to worry about doing anything here. However there are some things to consider …

    • if you are writing commercial software code there could well be an UX expectation that you would code for this, to keep the user informed at all times … and …
    • it could be the case that the database crashes at that very “clicking” moment, and though your responder may not get back to the parent with information, at least if you’ve coded for the scenario back at the client, at least the user will know something is being attempted, even if it doesn’t appear to be succeeding, which is less frustrating than getting no information at all, which could be mistaken for software code “hanging” … definitely not a great UX feel, or look

    Now there are a variety of client code approaches for showing “progress”, such as …

    • additional progress bar … like
    • additional meter … like
    • something you just clicked, changing appearance cyclically over time

    That last one appeals to us for a recent bit of functionality we added to this WordPress Blog you are reading, as well as for the fact that what we show “progress” on is difficult to numerically quantify as far as completion time is concerned, and so the first two above are not as suitable. We actually change the HTML div element font size to make an emoji “button” pressed “throb” while the user waits for the PHP and MySql query to respond back. Do you remember our thread of blog posting that used to end with WordPress Is Mentioned By Code Download CSS Tutorial? That’s the functionality we’re talking about today, as we do at WordPress 4.1.1’s WordPress Is Mentioned By Code Download Progress Tutorial.

    Now reading that previous link’s content below, you may see that we have considered the scenario of the child responder not finding any mentions and responding with …

    Sadly, this tutorial is not mentioned by any others, yet

    … which is good, but it may either take a long time for the responder to work this out, or, as we’ve indicated above, the responder’s mechanism for finding out may fail, and we’re dealing with that, from the perspective of the user looking at the client webpage, and waiting for information after clicking that emoji link we introduced when we did that work in that tutorial.

    We decided to prove our method with a “proof of concept” local MAMP web server HTML and Javascript and CSS parent taking …

    1. one blog posting bit of HTML body HTML …
    2. the is_mentioned_by function renamed to was_is_mentioned_by and a new is_mentioned_by worked until it works, tested via the Safari web browser’s Develop menu’s Web Inspector (similar to the Firefox Firebug web inspector we tend to go on and on and on and on and on and on about at this blog)

    … that took the form of this imb_poc.html … supervising the reworked PHP serverside code is_mentioned_by.php on MAMP that is, deliberately, made to …

    • wreck the connection to MySql … and then intervene to …
    • change the die message to instead sleep(18) before showing “Sadly, this tutorial is not mentioned by any others, yet” … at which time our changes should look good UX wise for the user

    We must stress this about “proof of concept”. Don’t waste time on “proof of concept” with too much fine grain simulation of the original scenario, if it is not involved in what you are proving, that is different, and is what is being tested here. See how it can even be that it suits the purposes of some “proof of concept” scenarios, like today’s, that you wreck the MySql connection in a progress “proof of concept” scenario, for example?

    We made these WordPress Blog changes in good ol’ TwentyTen themed header.php, as we so often do, and show changed code bold below …


    <script>
    var ourfs=21, zzzspare='';
    // ...
    // lots of other Javascript code
    // ...
    // down to ...

    function preresize_font(aois) {
    zzzspare=aois.id.replace('t','d');
    resize_font();
    }

    function resize_font() {
    ourfs=eval((ourfs + 5) % 45);
    if (document.getElementById(zzzspare).innerHTML.indexOf('<select ') != -1) {
    ourfs=21;
    } else {
    setTimeout(resize_font, 500);
    }
    document.getElementById(zzzspare).style.fontSize='' + ourfs + 'px';
    }

    function is_mentioned_by() {
    var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    xpspana=docgetclass("entry-title", "h1");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="cursor:pointer;display:inline;text-decoration:none; border:2px solid yellow;" onclick=" preresize_font(this); document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>☞</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    }

    … where is_mentioned_by function is called by the document.body onload event, to trigger all this. You can see some of all this with today’s tutorial picture, and by trying to click some of the right pointing emoji “is mentioned by” functionality “buttons” you see next to Blog Posting Titles around you here at this WordPress TwentyTen themed blog, but here’s hoping you don’t see too many throbbing emojis … heaven forbid?!

    Stop Press

    More regarding this CSS cursor property tomorrow.


    Previous relevant WordPress Is Mentioned By Code Download CSS Tutorial is shown below.

    WordPress Is Mentioned By Code Download CSS Tutorial

    WordPress Is Mentioned By Code Download CSS Tutorial

    A few things come together for today’s user experience (UX) inspired tutorial whereby …

    … to make what we are doing stand out more for the user, who may “swim” in a large table devoid of any styling to focus their attention.

    We’ll leave you with modified PHP, that writes out the HTML Code Download Table manipulator, you could call getmelist.php and which changed in this way to make the Code Download Table be more usercentric with its presentation of hashtagged calls linking a WordPress Blog Posting at this blog with a particular piece of software code of interest in our Code Download Table.

    Hope you try this functionality out for yourself.


    Previous relevant WordPress Is Mentioned By Code Download Navigation Tutorial is shown below.

    WordPress Is Mentioned By Code Download Navigation Tutorial

    WordPress Is Mentioned By Code Download Navigation Tutorial

    We’re following up on some recent WordPress navigation logic today, that we started with WordPress Is Mentioned By Navigation Primer Tutorial as shown below, for blog posting relationships between …

    • A blog posting being referred to … back, optionally, as a link, to …
    • A blog posting that mentioned that blog posting currently being viewed

    … and looking at this premise, it stands to reason that as helpful as this concept looks on paper, if a regular reader expects a recent posting be referred to by others “hot off the press” they’d be expecting quite a lot, and though what they get in this scenario …

    Sadly, this tutorial is not mentioned by any others, yet

    … probably does a good job tweaking them to the dilemma of “hot off the press” being “too recent to be referred to” it still remains a disappointment, perhaps. So, thinking a tad laterally on this, what is going to help out here will be to particularize the scenario for what we do around here … and am sorry if this annoys, but we are showing a line of thinking here … and allow for Blog Posts that contain the word “GETME” … our favourite code download mechanism around here … to add a “Code Download Table” dropdown option, that if selected will lob the user directly onto the RJM Programming Code Download Table entry for the first “GETME” file link found in that blog posting. This additional scouring of the MySql database, that utilizes the SQL UNION operator (the “adding an extra clause or paragraph” SQL operator, we like to think of it as) with its query, will not be relevant to all unmentioned blog postings, but it will help those that talk about software coding, which is quite a few.

    That functionality had us looking back at how the Code Download Table was constructed in terms of its hashtagging when we discussed PHP Blog Summary Follow Up Tutorial. In this way, we had a first try at …

    • … using the hashtagging for a date … as you see with these changes to is_mentioned_by.php at the left hand column of the Code Download Table … did a couple of unit tests seeing the first one work, the second one work if you take it a day back, and the third one not work at all, at which point it tweaked with us that the date in the Code Download Table is a date reflected by the software code file’s modified date, not the WordPress Blog Posting publication date, that we can derive off our amended query … so that being less friendly than we envisaged we end up …
    • … using the very interesting hashtagging that particularizes the filename, where the read file extension (minus all the “GETME” and “-“‘s and “_”‘s that is) is taken out of the prefix to the hashtag, and made into a suffix … like “analogue_clock.-GETMEhtml” for Analogue Clock Timezone Tutorial that is exemplified in today’s tutorial picture and as you can see the changes for at this is_mentioned_by.php link

    So it panned out to make this happen the original Code Download Table code did not need any tweaking, not good ol’ WordPress TwentyTen theme header.php … just is_mentioned_by.php … but we hope you try out clicking some “White Right Pointing Index” emoji …

    … at this WordPress blog sometime soon.

    Did you know?

    What gives with the &tsp=[someBigNumber] GET parameter … like is yellow highlighted in today’s tutorial picture … in the “Code Download Table” lookup URLs? This is so that we end up with different URLs each time a user accesses this functionality. This is because web browsers often try to help you out with speeding up your browsing, and use the web browser cache to “regurgitate” a previously visited URL should that have happened since the last clearing of any web browser cache, to “slap” the cache version quickly on the screen. But we don’t want any “slapping” to go on around our functionality today, and a way to force the web browser to reconsider the real lookup, and go back to the real web server again for data, is to make your URL be unique. A curiosity here you can try is to use something like a local MAMP (for Mac or EasyPHP for Windows) local web server to, for an image file called image.jpg that is put into the Apache web server’s Document Root

    1. see the image in your favoured web browser with the URL HTTP://localhost:8888/image.jpg … then …
    2. change that image somehow with an image editor … and …
    3. refresh, or revisit the image with the URL HTTP://localhost:8888/image.jpg … and you’ll probably see the cached web server version … unless you haven’t got web browser caching going … so amend this to …
    4. revisit the image with the URL HTTP://localhost:8888/image.jpg?random=7456536 … and this time we think you’ll see the amended image that happened with your image editing … and yes, you can add GET parameters to your URLs even for image URLs (often, most helpfully with image URLs, actually)

    Previous relevant WordPress Is Mentioned By Navigation Primer Tutorial is shown below.

    WordPress Is Mentioned By Navigation Primer Tutorial

    WordPress Is Mentioned By Navigation Primer Tutorial

    We’ve written some new WordPress navigation logic today, for blog posting relationships between …

    • A blog posting being referred to … back, optionally, as a link, to …
    • A blog posting that mentioned that blog posting currently being viewed

    … done, because we see that it is not only the “vertical” type linking of blog postings into a “thread” that helps understanding … we hope … but also to jump around among commonalities between concepts (like “horizontal” “degrees of separation”), perhaps. This functionality involves MySql database queries, and is best suited to a user clicks something (rather than pre-emptive content loading) to reach the functionality so that our database query has a post title to work with, and also so that every blog post does not overload the web server with a query ahead of time whose work may not be accessed anyway. The something that is clicked is an HTML a tag whose “look” is an Emoji.

    We also wrote a proof of concept, before applying that proof of concept live. To us, a “proof of concept” is not much use if it is as involved as what it is trying to prove, and in today’s scenario we did a proof of concept for two scenarios, that being …

    • a blog posting that was referred to by others … and …
    • a blog posting that wasn’t … doh! … but if you don’t change something about the “look of things” you’ll confuse the user as to whether the web application just took notice of their click (via the onclick event) … so this is of mild importance, but we grant you that it is not as important as the first scenario’s workings

    We quite often adopt a proof of concept scenario which tests the workings of a child (often in an HTML iframe element), in this case, PHP server side, piece of code, by introducing a simplified and pared down parent, in this case HTML piece of code. At the end of successful testing you are left with a good, and close to totally suitable child piece of code, to slot into the functionality of the real and live parent code.

    That proof of concept was definitely a good “unit testing” thing to do, but nevertheless, don’t feel overconfident as you go live … living with other real “goings on” on the live website are things to consider, and test … it took us half an hour to iron out these types of issues.

    The other good thing to have on your side is a Web Inspector like on Safari, similar to the Firefox Firebug web inspector we tend to go on and on and on and on and on and on about at this blog. We’re giving you a Safari rest on that today, and we want to show you an “early days” view …

    … in the proof of concept help that the Safari Web Inspector gave us, delving in under the called (by HTML parent) PHP’s actions. This type of information makes server side programming, like you do with PHP, that much easier … much easier than ideas where you write out web server files, with information, for your own benefit, or the other one we often like, during testing, is to write information out to top.document.title or perhaps to an alert box or to use console.log (on the debugging window, down the bottom).

    You’ll never guess where we made this change to our WordPress TwentyTen themed blog? Give up … yes, good ol’ header.php changed in the bold Javascript new function way below …



    function is_mentioned_by() {
    var zspare,xspare,xxspare,ximb,xpspana=docgetclass("entry-title", "h2");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="display:inline;text-decoration:none; border:2px solid yellow;" onclick=" document.getElementById(this.id.replace(String.fromCharCode(116),String.fromCharCode(105))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    xpspana=docgetclass("entry-title", "h1");
    for (ximb=0; ximb<xpspana.length; ximb++) {
    xxspare=xpspana[ximb].innerHTML.replace('</a>','').split('>');
    xspare=xxspare[eval(-1 + xxspare.length)];
    zspare=xspare.toLowerCase().replace(String.fromCharCode(35), "").replace(".", "").replace(".", "").replace(".", "").replace("+", "").replace("+", "").replace("'", "").replace('%27','').replace(/\//g, "").replace(/,/g, "").replace("---","-").replace("---","-").replace(/--/g,"-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-");
    if (document.body.innerHTML.indexOf('d' + zspare) == -1) xpspana[ximb].innerHTML+=' <div style="display:inline;" id=d' + zspare + '><a style="display:inline;text-decoration:none; border:2px solid yellow;" onclick=" document.getElementById(this.id.replace(String.fromCharCode(164),String.fromCharCode(151))).src=' + "'" + '//www.rjmprogramming.com.au/PHP/is_mentioned_by.php?title=' + encodeURIComponent(xspare) + "'" + '; " title="' + (xspare) + ' is mentioned by ..." id=t' + zspare + '>&#9758;</a><iframe style=display:none; id=i' + zspare + ' src=></iframe></div>';
    }
    }

    … called by …


    <body onload=" checkonl(); setTimeout(initpostedoncc, 3000); widgetcon(); precc(); courseCookies(); cookie_fonts(); is_mentioned_by(); " <?php body_class(); ?>>

    Team that with some new PHP source code you could call is_mentioned_by.php and you have today’s new WordPress blog TwentyTen theme “Is Mentioned By” functionality.

    The proof of concept parent HTML was is_mentioned_by.html for your perusal.

    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , | Leave a comment

Image Element Dynamic Filter CSS Mobile Filter Tutorial

Image Element Dynamic Filter CSS Mobile Filter Tutorial

Image Element Dynamic Filter CSS Mobile Filter Tutorial

Huh?! Two uses of “filter” in the blog posting title?

Yes, we can have …

  • “filter” … as in CSS filter property … and as …

  • in the case of mobile platforms the amount of image data URI data can exceed limits (even for) hashtagging email purposes … so we “filter” the incoming data through a new canvas <canvas id=mymobilecanvas style=display:none;></canvas> element and back out to an img (image) element smaller in (data) size

… and today, among other issues we’re improving the Image Element Dynamic CSS web application regarding (that you can also try below) for mobile platform users.

Here’s some interventional code, below, with respect to this, further to yesterday’s Image Element Dynamic CSS Canvas Context Filter Tutorial


function canvasize(jnr) {
lastim=new Image();

lastim.onload=function(event){
var filt=document.getElementById('selopt').innerText;
//lastim=document.getElementById('animg');


if (jnr.indexOf('data:') != -1) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
ourdcanvas='d' + 'canvas';
}
newcanvas=document.getElementById('mymobilecanvas'); //document.createElement('canvas');
//alert(111);
if (lastim.width > 800) {
newcanvas.width=800;
newcanvas.height=Math.round(lastim.height * 800 / lastim.width);
//alert('Wh=' + newcanvas.width + 'x' + newcanvas.height);
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
newcanvas.getContext('2d').globalCompositeOperation = 'multiply';
}
if (filt != '') { newcanvas.getContext('2d').filter=filt; }
newcanvas.getContext('2d').drawImage(lastim, 0, 0, lastim.width, lastim.height, 0, 0, newcanvas.width, newcanvas.height);
lesserinurl=newcanvas.toDataURL('image/jpeg', 0.1);
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('animg').src=lesserinurl;
} else if (1 == 2) {
document.getElementById('animg').style.width='800px';
document.getElementById('animg').style.width='' + newcanvas.height + 'px';
}
//return '';
} else {
newcanvas.width=lastim.width;
//alert('' + lastim.width + 'x' + lastim.height);
newcanvas.height=lastim.height;
//alert('wh=' + newcanvas.width + 'x' + newcanvas.height);
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
newcanvas.getContext('2d').globalCompositeOperation = 'multiply';
}
if (filt != '') { newcanvas.getContext('2d').filter=filt; }
newcanvas.getContext('2d').drawImage(lastim, 0, 0);
lesserinurl=newcanvas.toDataURL('image/jpeg', 0.1);
}
}


if (document.getElementById('animg').outerHTML.indexOf(' style="') != -1) {
if (document.getElementById('animg').outerHTML.split(' style="')[1].split('"')[0].indexOf('filter:') != -1) {
filt=document.getElementById('animg').outerHTML.split(' style="')[1].split('"')[0].split('filter:')[1].split(';')[0].trim();
document.getElementById(ourdcanvas).innerHTML='<details id=dtlcanvas><summary id=sumcanvas>Canvas view below ...</summary><br><br><canvas ' + ocm + ' id=mycanvas width=' + lastim.width + ' height=' + lastim.height + '>/canvas></details><hr></hr><br><br>';
} else {
document.getElementById(ourdcanvas).innerHTML='<details id=dtlcanvas><summary id=sumcanvas>Canvas view below ...</summary><br><br><canvas ' + ocm + ' style="' + document.getElementById('animg').outerHTML.split(' style="')[1].split('"')[0] + '" id=mycanvas width=' + lastim.width + ' height=' + lastim.height + '></canvas></details><hr></hr><br><br>';
}
} else {
document.getElementById(ourdcanvas).innerHTML='<details id=dtlcanvas><summary id=sumcanvas>Canvas view below ...</summary><br><br><canvas ' + ocm + ' id=mycanvas width=' + lastim.width + ' height=' + lastim.height + '></canvas></details><hr></hr><br><br>';
}
lastca=document.getElementById('mycanvas');
lastca.width=lastim.width;
lastca.height=lastim.height;
lastcac=lastca.getContext('2d');
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
lastcac.globalCompositeOperation = 'multiply';
}
if (filt != '') { lastcac.filter=filt; }
lastcac.drawImage(document.getElementById('animg'), 0, 0); //lastcac.drawImage(lastim, 0, 0);
lastim=document.getElementById('animg');
};
lastim.src=jnr;


return jnr;
}

… in the changed fourth draft draft Image Element Dynamic CSS web application.

Did you know?

There are mobile platform issues using …


[canvasContext].filter=[derivedFilterPartOfCss];
[canvasContext].drawImage([imgObj], 0, 0);

What a surprise?! The issues relate to [canvasContext].globalCompositeOperation this useful link forewarned us about, thanks. But we might call it quits there, as using PHP gd image filtering feels like overkill to us at this stage. We now present a canvas image equivalent, if the user is interested, and add into that canvas some onclick logic …


var mediatype='img';
ocm=' onclick=" mediatype=' + "'canvas'" + '; var chc=prompt(' + "'Optionally enter email (address) or SMS (number) to share canvas version as required.',''" + '); if (chc != null) { if (chc.toLowerCase() == ' + "'sms'" + ') { dosms(); } else if (chc.toLowerCase() == ' + "'sms'" + ') { doemail(); } else { assess(chc); } } mediatype=' + "'img'" + '; " ';

… allowing for more sharing and collaboration combinations of use and end result, here.


Previous relevant Image Element Dynamic CSS Canvas Context Filter Tutorial is shown below.

Image Element Dynamic CSS Canvas Context Filter Tutorial

Image Element Dynamic CSS Canvas Context Filter Tutorial

Ask and ye shall discover, ‘guvner. Ask …


image to canvas include css filters

… which got us to the excellent …


How to save image from canvas with CSS filters

… including the great canvas advice …

There is a little known property on the context object, conveniently named filter.

This can take a CSS filter as argument and apply it to the bitmap. However, this is not part of the official standard and it only works in Firefox so there is the limitation.. This has since this answer was originally written become a part of the official standard.

You can check for the existence of this property and use CSS filters if it does, or use a fallback to manually apply the filters to the image if not. The only advantage is really performance when available.

CSS and DOM is a separate world from the bitmaps that are used for images and canvas. The bitmaps themselves are not affected by CSS, only the elements which acts as a looking-glass to the bitmap. The only way is to work with at pixel levels (when context‘s filter property is not available).

How to calculate the various filters can be found in the Filter Effects Module Level 1. Also see SVG Filters and Color Matrix.

. Who’d have known?! And … why didn’t people wake me up at 2:23am (me at my “clarifying” best) to tell me? But we digress.

Even so, though this new canvas involvement thinking …


document.getElementById('animg').onload=function(event){
var filt=document.getElementById('selopt').innerText;
if (document.getElementById('animg').outerHTML.indexOf(' style="') != -1) {
if (document.getElementById('animg').outerHTML.split(' style="')[1].split('"')[0].indexOf('filter:') != -1) {
filt=document.getElementById('animg').outerHTML.split(' style="')[1].split('"')[0].split('filter:')[1].split(';')[0].trim();
document.getElementById('dcanvas').innerHTML='<details id=dtlcanvas><summary id=sumcanvas>Canvas view below ...</summary><br><br><canvas id=mycanvas width=' + lastim.width + ' height=' + lastim.height + '></canvas></details>';
} else {
document.getElementById('dcanvas').innerHTML='<details id=dtlcanvas><summary id=sumcanvas>Canvas view below ...</summary><br><br><canvas style="' + document.getElementById('animg').outerHTML.split(' style="')[1].split('"')[0] + '" id=mycanvas width=' + lastim.width + ' height=' + lastim.height + '></canvas></details>';
}
} else {

document.getElementById('dcanvas').innerHTML='<details id=dtlcanvas><summary id=sumcanvas>Canvas view below ...</summary><br><br><canvas id=mycanvas width=' + lastim.width + ' height=' + lastim.height + '></canvas></details>';
}
lastca=document.getElementById('mycanvas');
lastcac=lastca.getContext('2d');
if (filt != '') { lastcac.filter=filt; }
lastcac.drawImage(event.target, 0, 0);
lastim=document.getElementById('animg');
};
document.getElementById('animg').src=document.getElementById('animg').src;

… offers new context menu functionality, and so we are keen to include it, it has not changed our sharing hashtag powered logic.

If at this stage you are forgetting the original issue … let me explain it from a new outlook …

  • you’ve got an image or have taken one with your device’s Camera app …
  • you want to apply some CSS filter “effects” … yeh, yeh, yeh … we realize all the big players have this covered … but, remember, you want to program
  • you want to share it … for example, on Google Chrome you have a context menu option “Create QR code for this image” … just supposing you choose that option …
  • QR code appears on the screen … and with your device’s …
  • Camera app you access the URL off that QR code (in the way Covid taught so many of us to do) … huh?!!! …
  • yes, sadly, the image filter affects you applied do not flow through …

… well, it is this issue we’re talking about with this thread of blog postings.

Okay, so, today’s changed third draft Image Element Dynamic CSS web application you can also try below, gets us further along our path, and, indeed, it may be at its end. Even so that sharing happens with the img element processing and the canvas involvement is supplementary only (in the sense that the canvas context menu has no Share type of option, though it has Copy and Save As and an Inspect option which is not useful), moving on from yesterday’s Image Element Dynamic CSS Hashtag Sharing Tutorial.

We’ll see if we can discover anything else?



Previous relevant Image Element Dynamic CSS Hashtag Sharing Tutorial is shown below.

Image Element Dynamic CSS Hashtag Sharing Tutorial

Image Element Dynamic CSS Hashtag Sharing Tutorial

Our recent realization that “hashtag sharing” could be the alternative to our “PHP mail” exploits of the past meant that …

  • that “proof of concept” idea we had of involving the HTML canvas sharing conduit we wanted to tell about, as yet, has not happened because our CSS filters did not flow through via the [canvasContext].drawImage functionality … was not the end of our sharing endeavours because …
  • hashtag sharing of the image outerHTML alternative approach …

… comes into play, today. We’ll see what can be done at the canvas element end regarding more “filter CSS flow through” research into the future. Meanwhile, also below see a mechanism by which users can tweak dropdown CSS styling options …


function doemail() {
var emailee=prompt('Please enter email address to share with.', '');
if (emailee == null) { emailee=''; }
if (emailee.indexOf('@') != -1) {
document.getElementById('aemail').href='mailto:' + emailee + '?subject=Image%20Filters&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#image=' + encodeURIComponent(document.getElementById('animg').outerHTML));
document.getElementById('aemail').click();
}
}

function dosms() {
var emailee=prompt('Please enter SMS number to share with.', '');
if (emailee == null) { emailee=''; }
if (emailee != '' && emailee.trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
document.getElementById('asms').href='sms:' + emailee + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#image=' + encodeURIComponent(document.getElementById('animg').outerHTML));
document.getElementById('asms').click();
}
}

function embellish() {
var newstyling=prompt('Optionally change styling.', document.getElementById('selopt').innerText);
if (newstyling == null) { newstyling=''; }
if (newstyling != document.getElementById('selopt').innerText && newstyling.indexOf(':') != -1) {
document.getElementById('selopt').innerText=newstyling;
ais=document.getElementById('animg').src;
document.getElementById('danimg').innerHTML="<img style=\"" + newstyling + "\" id=animg src=\"" + ais + "\"></img>";
}
}

And so, onto yesterday’s Image Element Dynamic CSS Primer Tutorial we have a changed second draft Image Element Dynamic CSS web application you can also try below.


Previous relevant Image Element Dynamic CSS Primer Tutorial is shown below.

Image Element Dynamic CSS Primer Tutorial

Image Element Dynamic CSS Primer Tutorial

We’re curious about something and need to start a new “proof of concept” (first draft) phase involving, at this early stage …

  • HTML img elements …
  • applied dynamic user selected CSS (with an emphasis on dropdown suggested filter property usage) … powered by …
  • browsed for or image URL defined content logic

Luckily we have precedents for all this, and this can be a good start! So please try our first draft Image Element Dynamic CSS web application you can also try below.

Tomorrow’s work will see whether our theory comes to fruition!

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, iOS, Photography, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Image Element Dynamic CSS Canvas Context Filter Tutorial

Image Element Dynamic CSS Canvas Context Filter Tutorial

Image Element Dynamic CSS Canvas Context Filter Tutorial

Ask and ye shall discover, ‘guvner. Ask …


image to canvas include css filters

… which got us to the excellent …


How to save image from canvas with CSS filters

… including the great canvas advice …

There is a little known property on the context object, conveniently named filter.

This can take a CSS filter as argument and apply it to the bitmap. However, this is not part of the official standard and it only works in Firefox so there is the limitation.. This has since this answer was originally written become a part of the official standard.

You can check for the existence of this property and use CSS filters if it does, or use a fallback to manually apply the filters to the image if not. The only advantage is really performance when available.

CSS and DOM is a separate world from the bitmaps that are used for images and canvas. The bitmaps themselves are not affected by CSS, only the elements which acts as a looking-glass to the bitmap. The only way is to work with at pixel levels (when context‘s filter property is not available).

How to calculate the various filters can be found in the Filter Effects Module Level 1. Also see SVG Filters and Color Matrix.

. Who’d have known?! And … why didn’t people wake me up at 2:23am (me at my “clarifying” best) to tell me? But we digress.

Even so, though this new canvas involvement thinking …


document.getElementById('animg').onload=function(event){
var filt=document.getElementById('selopt').innerText;
if (document.getElementById('animg').outerHTML.indexOf(' style="') != -1) {
if (document.getElementById('animg').outerHTML.split(' style="')[1].split('"')[0].indexOf('filter:') != -1) {
filt=document.getElementById('animg').outerHTML.split(' style="')[1].split('"')[0].split('filter:')[1].split(';')[0].trim();
document.getElementById('dcanvas').innerHTML='<details id=dtlcanvas><summary id=sumcanvas>Canvas view below ...</summary><br><br><canvas id=mycanvas width=' + lastim.width + ' height=' + lastim.height + '></canvas></details>';
} else {
document.getElementById('dcanvas').innerHTML='<details id=dtlcanvas><summary id=sumcanvas>Canvas view below ...</summary><br><br><canvas style="' + document.getElementById('animg').outerHTML.split(' style="')[1].split('"')[0] + '" id=mycanvas width=' + lastim.width + ' height=' + lastim.height + '></canvas></details>';
}
} else {

document.getElementById('dcanvas').innerHTML='<details id=dtlcanvas><summary id=sumcanvas>Canvas view below ...</summary><br><br><canvas id=mycanvas width=' + lastim.width + ' height=' + lastim.height + '></canvas></details>';
}
lastca=document.getElementById('mycanvas');
lastcac=lastca.getContext('2d');
if (filt != '') { lastcac.filter=filt; }
lastcac.drawImage(event.target, 0, 0);
lastim=document.getElementById('animg');
};
document.getElementById('animg').src=document.getElementById('animg').src;

… offers new context menu functionality, and so we are keen to include it, it has not changed our sharing hashtag powered logic.

If at this stage you are forgetting the original issue … let me explain it from a new outlook …

  • you’ve got an image or have taken one with your device’s Camera app …
  • you want to apply some CSS filter “effects” … yeh, yeh, yeh … we realize all the big players have this covered … but, remember, you want to program
  • you want to share it … for example, on Google Chrome you have a context menu option “Create QR code for this image” … just supposing you choose that option …
  • QR code appears on the screen … and with your device’s …
  • Camera app you access the URL off that QR code (in the way Covid taught so many of us to do) … huh?!!! …
  • yes, sadly, the image filter affects you applied do not flow through …

… well, it is this issue we’re talking about with this thread of blog postings.

Okay, so, today’s changed third draft Image Element Dynamic CSS web application you can also try below, gets us further along our path, and, indeed, it may be at its end. Even so that sharing happens with the img element processing and the canvas involvement is supplementary only (in the sense that the canvas context menu has no Share type of option, though it has Copy and Save As and an Inspect option which is not useful), moving on from yesterday’s Image Element Dynamic CSS Hashtag Sharing Tutorial.

We’ll see if we can discover anything else?


Previous relevant Image Element Dynamic CSS Hashtag Sharing Tutorial is shown below.

Image Element Dynamic CSS Hashtag Sharing Tutorial

Image Element Dynamic CSS Hashtag Sharing Tutorial

Our recent realization that “hashtag sharing” could be the alternative to our “PHP mail” exploits of the past meant that …

  • that “proof of concept” idea we had of involving the HTML canvas sharing conduit we wanted to tell about, as yet, has not happened because our CSS filters did not flow through via the [canvasContext].drawImage functionality … was not the end of our sharing endeavours because …
  • hashtag sharing of the image outerHTML alternative approach …

… comes into play, today. We’ll see what can be done at the canvas element end regarding more “filter CSS flow through” research into the future. Meanwhile, also below see a mechanism by which users can tweak dropdown CSS styling options …


function doemail() {
var emailee=prompt('Please enter email address to share with.', '');
if (emailee == null) { emailee=''; }
if (emailee.indexOf('@') != -1) {
document.getElementById('aemail').href='mailto:' + emailee + '?subject=Image%20Filters&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#image=' + encodeURIComponent(document.getElementById('animg').outerHTML));
document.getElementById('aemail').click();
}
}

function dosms() {
var emailee=prompt('Please enter SMS number to share with.', '');
if (emailee == null) { emailee=''; }
if (emailee != '' && emailee.trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
document.getElementById('asms').href='sms:' + emailee + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#image=' + encodeURIComponent(document.getElementById('animg').outerHTML));
document.getElementById('asms').click();
}
}

function embellish() {
var newstyling=prompt('Optionally change styling.', document.getElementById('selopt').innerText);
if (newstyling == null) { newstyling=''; }
if (newstyling != document.getElementById('selopt').innerText && newstyling.indexOf(':') != -1) {
document.getElementById('selopt').innerText=newstyling;
ais=document.getElementById('animg').src;
document.getElementById('danimg').innerHTML="<img style=\"" + newstyling + "\" id=animg src=\"" + ais + "\"></img>";
}
}

And so, onto yesterday’s Image Element Dynamic CSS Primer Tutorial we have a changed second draft Image Element Dynamic CSS web application you can also try below.


Previous relevant Image Element Dynamic CSS Primer Tutorial is shown below.

Image Element Dynamic CSS Primer Tutorial

Image Element Dynamic CSS Primer Tutorial

We’re curious about something and need to start a new “proof of concept” (first draft) phase involving, at this early stage …

  • HTML img elements …
  • applied dynamic user selected CSS (with an emphasis on dropdown suggested filter property usage) … powered by …
  • browsed for or image URL defined content logic

Luckily we have precedents for all this, and this can be a good start! So please try our first draft Image Element Dynamic CSS web application you can also try below.

Tomorrow’s work will see whether our theory comes to fruition!

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Image Element Dynamic CSS Hashtag Sharing Tutorial

Image Element Dynamic CSS Hashtag Sharing Tutorial

Image Element Dynamic CSS Hashtag Sharing Tutorial

Our recent realization that “hashtag sharing” could be the alternative to our “PHP mail” exploits of the past meant that …

  • that “proof of concept” idea we had of involving the HTML canvas sharing conduit we wanted to tell about, as yet, has not happened because our CSS filters did not flow through via the [canvasContext].drawImage functionality … was not the end of our sharing endeavours because …
  • hashtag sharing of the image outerHTML alternative approach …

… comes into play, today. We’ll see what can be done at the canvas element end regarding more “filter CSS flow through” research into the future. Meanwhile, also below see a mechanism by which users can tweak dropdown CSS styling options …


function doemail() {
var emailee=prompt('Please enter email address to share with.', '');
if (emailee == null) { emailee=''; }
if (emailee.indexOf('@') != -1) {
document.getElementById('aemail').href='mailto:' + emailee + '?subject=Image%20Filters&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#image=' + encodeURIComponent(document.getElementById('animg').outerHTML));
document.getElementById('aemail').click();
}
}

function dosms() {
var emailee=prompt('Please enter SMS number to share with.', '');
if (emailee == null) { emailee=''; }
if (emailee != '' && emailee.trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
document.getElementById('asms').href='sms:' + emailee + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#image=' + encodeURIComponent(document.getElementById('animg').outerHTML));
document.getElementById('asms').click();
}
}

function embellish() {
var newstyling=prompt('Optionally change styling.', document.getElementById('selopt').innerText);
if (newstyling == null) { newstyling=''; }
if (newstyling != document.getElementById('selopt').innerText && newstyling.indexOf(':') != -1) {
document.getElementById('selopt').innerText=newstyling;
ais=document.getElementById('animg').src;
document.getElementById('danimg').innerHTML="<img style=\"" + newstyling + "\" id=animg src=\"" + ais + "\"></img>";
}
}

And so, onto yesterday’s Image Element Dynamic CSS Primer Tutorial we have a changed second draft Image Element Dynamic CSS web application you can also try below.


Previous relevant Image Element Dynamic CSS Primer Tutorial is shown below.

Image Element Dynamic CSS Primer Tutorial

Image Element Dynamic CSS Primer Tutorial

We’re curious about something and need to start a new “proof of concept” (first draft) phase involving, at this early stage …

  • HTML img elements …
  • applied dynamic user selected CSS (with an emphasis on dropdown suggested filter property usage) … powered by …
  • browsed for or image URL defined content logic

Luckily we have precedents for all this, and this can be a good start! So please try our first draft Image Element Dynamic CSS web application you can also try below.

Tomorrow’s work will see whether our theory comes to fruition!

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Photography, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Image Element Dynamic CSS Primer Tutorial

Image Element Dynamic CSS Primer Tutorial

Image Element Dynamic CSS Primer Tutorial

We’re curious about something and need to start a new “proof of concept” (first draft) phase involving, at this early stage …

  • HTML img elements …
  • applied dynamic user selected CSS (with an emphasis on dropdown suggested filter property usage) … powered by …
  • browsed for or image URL defined content logic

Luckily we have precedents for all this, and this can be a good start! So please try our first draft Image Element Dynamic CSS web application you can also try below.

Tomorrow’s work will see whether our theory comes to fruition!

If this was interesting you may be interested in this too.

Posted in eLearning, Photography, Tutorials | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Worldbank API User Supplied Indicator Name Word List Tutorial

Worldbank API User Supplied Indicator Name Word List Tutorial

Worldbank API User Supplied Indicator Name Word List Tutorial

Yesterday’s Worldbank API User Supplied Indicator Code Tutorial

  • gave the user some WorldBank API Indicator control … but because your average person would not know these codes … today we offer …
  • user entered Word List in the Indicator Name as an option … eg. Labor female

… and we started the day thinking a better way to go would be Regular Expressions either at the PHP end or the Javascript end. That confusion alone (ie. they are different in syntax) made us rethink, and with KISS (keep it simple signor) principles, we just thought, though, sometimes, despite the fact that … well, um … yes, well … it was still a better idea.


function showStuff() {
var iprts=0, isallokay=false, jprts=-1, iw=0, dsofar='|';
if (zhr != null) {
if (zhr.readyState == 4) {
if (zhr.status == 200) {
var partsare=zhr.responseText.split('>' + wordsare[0] + '<');
//alert(partsare.length);
if (wordsare.length == 1) {
for (iprts=0; iprts<partsare.length; iprts++) {
if (partsare[iprts].split('>')[eval(-1 + partsare[iprts].split('>').length)].indexOf('?view=chart') != -1 && partsare[iprts].split('>')[eval(-1 + partsare[iprts].split('>').length)].indexOf('/') != -1) {
findingsindc.push(partsare[iprts].split('>')[eval(-1 + partsare[iprts].split('>').length)].split('?view=chart')[0].split('/')[eval(-1 + partsare[iprts].split('>')[eval(-1 + partsare[iprts].split('>').length)].split('?view=chart')[0].split('/').length)]);
findingsdesc.push(wordsare[0]);
}
}
}
partsare=zhr.responseText.split(' ' + wordsare[0] + '<');
//alert(partsare.length);
if (wordsare.length == 1) {
for (iprts=0; iprts<partsare.length; iprts++) {
if (partsare[iprts].split('>')[eval(-1 + partsare[iprts].split('>').length)].indexOf('?view=chart') != -1 && partsare[iprts].split('>')[eval(-1 + partsare[iprts].split('>').length)].indexOf('/') != -1) {
findingsindc.push(partsare[iprts].split('>')[eval(-1 + partsare[iprts].split('>').length)].split('?view=chart')[0].split('/')[eval(-1 + partsare[iprts].split('>')[eval(-1 + partsare[iprts].split('>').length)].split('?view=chart')[0].split('/').length)]);
findingsdesc.push(partsare[iprts].split('>')[eval(-1 + partsare[iprts].split('>').length)] + ' ' + wordsare[0]);
}
}
}

partsare=zhr.responseText.split('>' + wordsare[0] + ' ');
//alert(partsare.length);
if (wordsare.length == 1 || 2 == 2) {
for (iprts=1; iprts<partsare.length; iprts++) {
isallokay=true;
jprts=eval(-1 + iprts);
if (partsare[jprts].split('>')[eval(-1 + partsare[jprts].split('>').length)].indexOf('?view=chart') != -1 && partsare[jprts].split('>')[eval(-1 + partsare[jprts].split('>').length)].indexOf('/') != -1) {
if (wordsare.length != 1) {
for (iw=1; iw<wordsare.length; iw++) {
if (partsare[iprts].split('<')[0].toLowerCase().indexOf(wordsare[iw].toLowerCase()) == -1) { isallokay=false; }
}
}
if (isallokay) {
findingsindc.push(partsare[jprts].split('>')[eval(-1 + partsare[jprts].split('>').length)].split('?view=chart')[0].split('/')[eval(-1 + partsare[jprts].split('>')[eval(-1 + partsare[jprts].split('>').length)].split('?view=chart')[0].split('/').length)]);
findingsdesc.push(wordsare[0] + ' ' + partsare[iprts].split('<')[0]);
}
}
}
}

partsare=zhr.responseText.split(' ' + wordsare[0] + ' ');
//alert(partsare.length);
if (wordsare.length == 1 || 2 == 2) {
for (iprts=1; iprts<partsare.length; iprts++) {
isallokay=true;
jprts=eval(-1 + iprts);
if (partsare[jprts].split('>')[eval(-1 + partsare[jprts].split('>').length)].indexOf('?view=chart') != -1 && partsare[jprts].split('>')[eval(-1 + partsare[jprts].split('>').length)].indexOf('/') != -1) {
if (wordsare.length != 1) {
for (iw=1; iw<wordsare.length; iw++) {
if (partsare[iprts].split('<')[0].toLowerCase().indexOf(wordsare[iw].toLowerCase()) == -1) { isallokay=false; }
}
}
if (isallokay) {
findingsindc.push(partsare[jprts].split('>')[eval(-1 + partsare[jprts].split('>').length)].split('?view=chart')[0].split('/')[eval(-1 + partsare[jprts].split('>')[eval(-1 + partsare[jprts].split('>').length)].split('?view=chart')[0].split('/').length)]);
findingsdesc.push(partsare[jprts].split('>')[eval(-1 + partsare[jprts].split('>').length)] + ' ' + wordsare[0] + ' ' + partsare[iprts].split('<')[0]);
}
}
}
}

if (findingsindc.length > 0) {
for (iprts=0; iprts<findingsindc.length; iprts++) {
//alert(findingsindc[iprts] + '#' + findingsdesc[iprts]);
if (dsofar.indexOf('|' + findingsindc[iprts] + '#' + findingsdesc[iprts] + '|') == -1) {
dsofar+=findingsindc[iprts] + '#' + findingsdesc[iprts] + '|';
donewone(findingsindc[iprts] + '#' + findingsdesc[iprts], document.getElementById('sindicator'));
}
}
}

//alert(zhr.responseText); // '/' . $indicator . '?view=chart'
}
}
}
}

function donewone(newone, thisobj) {
if (newone.indexOf('.') != -1 && newone.indexOf('#') != -1) {
if (thisobj.innerHTML.indexOf('indicator=' + newone.split('#')[0].toUpperCase()) != -1) {
thisobj.value='&indicator=' + newone.split('#')[0].toUpperCase();
} else {
descis=newone.split('#')[1];
if (descis.trim() == '') { descis=newone.split('#')[0]; }
thisobj.innerHTML=thisobj.innerHTML.replace(' id="sellastone" ', ' ') + '<option id="sellastone" value="&indicator=' + newone.split('#')[0].toUpperCase() + '&inddesc=' + encodeURIComponent(descis) + '">' + descis + '</option>';
thisobj.value='&indicator=' + newone.split('#')[0].toUpperCase() + '&inddesc=' + encodeURIComponent(descis);
}
} else if (newone.trim().split(' ')[0].split('#')[0].indexOf('.') != -1) {
if (thisobj.innerHTML.indexOf('indicator=' + newone.split('#')[0].toUpperCase()) != -1) {
thisobj.value='&indicator=' + newone.split('#')[0].toUpperCase();
} else {
descis=newone.split('#')[0];
thisobj.innerHTML=thisobj.innerHTML.replace(' id="sellastone" ', ' ') + '<option id="sellastone" value="&indicator=' + newone.split('#')[0].toUpperCase() + '&inddesc=' + encodeURIComponent(descis) + '">' + descis + '</option>';
thisobj.value='&indicator=' + newone.split('#')[0].toUpperCase() + '&inddesc=' + encodeURIComponent(descis);
}
} else if (newone.trim() != '') {
wordsare=newone.replace(/\,/g,' ').replace(/\ \ /g,' ').split(' ');
zhr = new XMLHttpRequest();
zhr.open('get', './worldbank_population_data.php?justindicators=y', true);
zhr.onreadystatechange = showStuff;
zhr.send(null);
}
}

function addselopt(noth,thisobj,thisvalue) {
var newone='', descis='';
if (thisvalue == '&indicator=#') {
newone=prompt('Please separate a WorldBank indicator code, optionally, by hash (ie. #) then Description or we can look for all the words in a word list.');
if (newone == null) { newone=''; }
donewone(newone, thisobj);
}
return noth;
}

… as reflected by worldbank_population_data.htm changed in this way, and you can try here.

The PHP helped us out, reaching out to Worldbank as reflected by worldbank_population_data.php changed in this way.


Previous relevant Worldbank API User Supplied Indicator Code Tutorial is shown below.

Worldbank API User Supplied Indicator Code Tutorial

Worldbank API User Supplied Indicator Code Tutorial

In yesterday’s Worldbank API Null Value Issue Tutorial‘s …

  • WorldBank API input XML data … is linked to via …
  • Dropdown list user selected WorldBank Indicator Code … and other user selections … so as to produce …
  • Google Chart report

But being as we are using PHP in the mix we can make more flexible that “Dropdown list user selected WorldBank Indicator Code” arrangement, adding one last dropdown list item (as reflected by worldbank_population_data.htm changed in this way, and you can try here) selectable that asks for a known WorldBank Indicator Code of interest that the user might know about from …


This useful WorldBank webpage ... thanks

… via …

<?php

if (isset($_GET['indicator'])) {
$indicator=str_replace('+',' ', urldecode($_GET['indicator']));
if ($indicator != "") {
$reportmode=str_replace("IC.REG.DURS","Time required to start a business (days)",str_replace("EN.POP.DNST","Population density (people per sq. km of land area)",str_replace("SL.TLF.TOTL.IN","Labor Force, Total",str_replace("IS.RRS.TOTL.KM","Rail Lines (total route-km)",str_replace("SH.MED.BEDS.ZS","Hospital Beds (per 1,000 people)",str_replace("SP.DYN.TFRT.IN","Fertility rate, total (births per woman)",str_replace("AG.LND.AGRI.K2","Agricultural Land (sq km)",str_replace("AG.LND.FRST.K2","Forest Area (sq km)",str_replace("EG.ELC.ACCS.ZS","Access to electricity (% of population)",str_replace("NY.GDP.MKTP.CD","Gross Domestic Product",$indicator))))))))));
$reportmode2=str_replace("IC.REG.DURS","Time required to start a business (days)",str_replace("EN.POP.DNST","Population density (people per sq. km of land area)",str_replace("SL.TLF.TOTL.IN","Labor Force, Total",str_replace("IS.RRS.TOTL.KM","Rail Lines (total route-km)",str_replace("SH.MED.BEDS.ZS","Hospital Beds (per 1,000 people)",str_replace("SP.DYN.TFRT.IN","Fertility rate, total (births per woman)",str_replace("AG.LND.AGRI.K2","Agricultural Land (sq km)",str_replace("AG.LND.FRST.K2","Forest Area (sq km)",str_replace("EG.ELC.ACCS.ZS","Access to electricity (% of population)",str_replace("NY.GDP.MKTP.CD","Gross Domestic Product (US$)",$indicator))))))))));
$lookforis=str_replace("IC.REG.DURS","Time required",str_replace("EN.POP.DNST","Population density",str_replace("SL.TLF.TOTL.IN","Labor force",str_replace("IS.RRS.TOTL.KM","Rail line",str_replace("SH.MED.BEDS.ZS","Hospital beds",str_replace("SP.DYN.TFRT.IN","Fertility rate",str_replace("AG.LND.AGRI.K2","Agricultural land (",str_replace("AG.LND.FRST.K2","Forest area (s",str_replace("EG.ELC.ACCS.ZS","Access to electricity (",str_replace("NY.GDP.MKTP.CD","GDP (current US",$indicator))))))))));
if (isset($_GET['inddesc'])) {
$reportmode=str_replace('+',' ', urldecode($_GET['inddesc']));
$reportmode2=$reportmode;
$lookforis=trim(explode(',', explode(' (', $reportmode)[0])[0]);
}
if ($indicator == strtoupper($reportmode)) {
$huhpg=file_get_contents('//data.worldbank.org/indicator/');
$hggs=explode('/' . $indicator . '?view=chart', $huhpg);
if (sizeof($hggs) > 1) {
$reportmode=explode('>', explode('<', $hggs[1])[0])[1];
$reportmode2=$reportmode;
$lookforis=trim(explode(',', explode(' (', $reportmode)[0])[0]);
}
}

if (strpos($reportmode,"Forest area (s") !== false) { $recit=true; }
}
}
if (isset($_POST['indicator'])) {
$indicator=str_replace('+',' ', urldecode($_POST['indicator']));
if ($indicator != "") {
$reportmode=str_replace("IC.REG.DURS","Time required to start a business (days)",str_replace("EN.POP.DNST","Population density (people per sq. km of land area)",str_replace("SL.TLF.TOTL.IN","Labor Force, Total",str_replace("IS.RRS.TOTL.KM","Rail Lines (total route-km)",str_replace("SH.MED.BEDS.ZS","Hospital Beds (per 1,000 people)",str_replace("SP.DYN.TFRT.IN","Fertility rate, total (births per woman)",str_replace("AG.LND.AGRI.K2","Agricultural Land (sq km)",str_replace("AG.LND.FRST.K2","Forest Area (sq km)",str_replace("EG.ELC.ACCS.ZS","Access to electricity (% of population)",str_replace("NY.GDP.MKTP.CD","Gross Domestic Product",$indicator))))))))));
$reportmode2=str_replace("IC.REG.DURS","Time required to start a business (days)",str_replace("EN.POP.DNST","Population density (people per sq. km of land area)",str_replace("SL.TLF.TOTL.IN","Labor Force, Total",str_replace("IS.RRS.TOTL.KM","Rail Lines (total route-km)",str_replace("SH.MED.BEDS.ZS","Hospital Beds (per 1,000 people)",str_replace("SP.DYN.TFRT.IN","Fertility rate, total (births per woman)",str_replace("AG.LND.AGRI.K2","Agricultural Land (sq km)",str_replace("AG.LND.FRST.K2","Forest Area (sq km)",str_replace("EG.ELC.ACCS.ZS","Access to electricity (% of population)",str_replace("NY.GDP.MKTP.CD","Gross Domestic Product (US$)",$indicator))))))))));
$lookforis=str_replace("IC.REG.DURS","Time required",str_replace("EN.POP.DNST","Population density",str_replace("SL.TLF.TOTL.IN","Labor force",str_replace("IS.RRS.TOTL.KM","Rail line",str_replace("SH.MED.BEDS.ZS","Hospital beds",str_replace("SP.DYN.TFRT.IN","Fertility rate",str_replace("AG.LND.AGRI.K2","Agricultural land (s",str_replace("AG.LND.FRST.K2","Forest area (s",str_replace("EG.ELC.ACCS.ZS","Access to electricity (",str_replace("NY.GDP.MKTP.CD","GDP (current US",$indicator))))))))));
if (isset($_POST['inddesc'])) {
$reportmode=str_replace('+',' ', urldecode($_POST['inddesc']));
$reportmode2=$reportmode;
$lookforis=trim(explode(',', explode(' (', $reportmode)[0])[0]);
}
if ($indicator == strtoupper($reportmode)) {
$huhpg=file_get_contents('//data.worldbank.org/indicator/');
$hggs=explode('/' . $indicator . '?view=chart', $huhpg);
if (sizeof($hggs) > 1) {
$reportmode=explode('>', explode('<', $hggs[1])[0])[1];
$reportmode2=$reportmode;
$lookforis=trim(explode(',', explode(' (', $reportmode)[0])[0]);
}
}

if (strpos($reportmode,"Forest area (s") !== false) { $recit=true; }
}
}

?>

… as reflected in worldbank_population_data.php changed in this way.


Previous relevant Worldbank API Null Value Issue Tutorial is shown below.

Worldbank API Null Value Issue Tutorial

Worldbank API Null Value Issue Tutorial

The WorldBank API channelling inhouse HTML and PHP web application we talked about with Worldbank API and Looks Nice Debugging Styles Tutorial had a reporting mechanism …

[later year] through to [earlier year] based World Bank Indicator of Interest [country starts with letter] style Google Chart Line/Area/Bar/Column Chart basis report

The crux of the data needed for this could end up with an HTML form getting you to such a report “Rail Lines (total route-km) by World Country K for Year 2018 to 2023 Column Chart” example looking like …


<form onsubmit="return preiframeviaurl();" target="myiframe" id="myform" style="display:none;" method="POST" action="//www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php">
<input type="hidden" name="title" id="title" value="Rail Lines (total route-km) by World Country K for Year 2018 to 2023">
<input type="hidden" name="onclick" id="onclick" value="y">
<input type="hidden" name="task" id="task" value="Rail Lines (total route-km)">
<input type="hidden" name="desc" id="desc" value="Rail Lines (total route-km)">
<input type="hidden" name="label" id="label" value="Year">
<input type="hidden" name="value" id="value" value="KZ Rail Lines (total route-km) ,KE ,KI ,KP ,KR ,KW ,KG ">
<!--input type='hidden' name='onclick' value='y'></input-->
<input type="hidden" name="moreopt" id="moreopt" value=" width: 522, height: 1200, chartArea: { width: "86%", height: "70%" }, legend: { position: "right" }, ">
<input type="hidden" name="extraopts" id="extraopts" value=" chartArea: { width: "67%" }, ">
<input type="hidden" name="wouldlikeyoutoseekpermission" value="y">
<input type="hidden" name="data" id="data" value=", [~2018~,424,0.0,4200,0.0,0.0,0.0,16060.8], [~2019~,424,0.0,4109.15,0.0,0.0,0.0,16060.8], [~2020~,424,0.0,4284.7,0.0,0.0,0.0,16063], [~2021~,417,0.0,4308.5,0.0,0.0,0.0,16005.6], [~2022~,0.0,0.0,0.0,0.0,0.0,0.0,0.0], [~2023~,0.0,0.0,0.0,0.0,0.0,0.0,0.0]">
<input id="mysubmit" type="submit" value="Draw Pie Chart">

Do you see all the “0.0” data points? They are all represented in the WorldBank API by incoming XML data that looks like …


<wb:value />

… to represent a value for WorldBank that has not been collected yet, or maybe never will be. Our improvement is to treat all those as …


<wb:value>0.0</wb:value>

… because we get nowhere with the Google Charts when the data arrays have differing member number lengths, and we can be more assured of keeping the array member lengths the same by introducing this “null becomes inhouse zero” system from here on. These changes (as well as emoji flag usage) are reflected in worldbank_population_data.php changed in this way, and which we can try for yourself here or below …

We also wanted to show a progress cursor up the top, as our PHP is querying the WorldBank API, thanks, for data to use in a report, reflected by worldbank_population_data.htm changed in this way.


Previous relevant Worldbank API and Looks Nice Debugging Styles Tutorial is shown below.

Worldbank API and Looks Nice Debugging Styles Tutorial

Worldbank API and Looks Nice Debugging Styles Tutorial

Back on the way to Worldbank API Comparison Year More Indicators Tutorial with the recent “makeover start” we had occasion to, with …

And yes, on that last item you may remember with Looks Nice Nearby Speech to Text Game Video Tutorial a theory we had …

navigation reversal fixes in wls_vs_php.htm (calling colour_wheel.html) needing to add new codeline to terminate Javascript activity (used for the first time that we can remember, ever, and thanks to this webpage)) to stop colour_wheel.html click navigation reversals …

… an idea that did seem to help with Safari but did not seem to fix the “navigation reversal” feelings on Google Chrome, to the extent that the word “furphy” springs to mind. So we continued for half a day, without success, on different “stop Javascript” strategies, with no success. And then we stumbled onto …


Google Chrome's View -> Developer -> Developer Tools and its Source tab (or panel)

… and a combination of surprise, investigation and programmer’s “aaaaaaaaahhhhh” ensued, for us. A lesson in blinkered thinking to …

  • limit scope of looking for problem to …

    … bad … and …

  • limit scope of looking to the timing of the problem, but on odd occasions the problem can be to do with the precursors to that problem

… and so we found …

  • the “grandparent” PHP changed PHP code of speech_supervisor.php with its live run … now works better with these tiny changes …
  • regarding that “grandparent”‘s textbox’s “onblur” event origins of the navigation (that you can see, and resulted to us tweaking to, with today’s tutorial picture, in that we had forgotten to check for non essential “onblur” event logic repeats when clicking on that right hand table cell (in the “grandparent”‘s view of the woooooorrrrrrllllldddd) … as per new …

    var lastval=''; // global variable

    … now gets used with the “grandparent”‘s (associated) textbox’s “onblur” event logic changes

    onblur="if (this.value.length > 0 && this.value != lastval) { if (1 == 1) { placeme(this.value); } else { thisresult=this.value + resultsuffix; } }"

    … and then variable lastval gets it’s new value at …

    function placeme(pwhere) {
    if (pwhere != '') {
    lastval=pwhere;
    // rest of logic
    }
    }

    … ensuring double “onblur” event logic executions are avoided

We think hard and fast debugging style methodology thinking can be a bit restrictive, when you consider the contrast between these two (perfectly acceptable in our programming wooooorrrrlllldd) approaches. Lateral thinking can help us too, perhaps to broaden the discussion, and emoliate our prejudices. And bravo the client side web browser web inspectors of this woooooooorrrrrrrlllllldddd.

Stop Press

We’ve added some additional emoji flag functionality into Looks Nice Game via …

  1. the “parent” HTML the changed wls_vs_php.htm … calling …
  2. the “child” HTML the changed colour_wheel.html

Previous relevant Worldbank API Comparison Year More Indicators Tutorial is shown below.

Worldbank API Comparison Year More Indicators Tutorial

Worldbank API Comparison Year More Indicators Tutorial

Today’s progress onto yesterday’s Worldbank API Comparison Year Google Chart Mobile Tutorial is a callback to the original reason for the work, that being a graphical way to present what is the real marvel of proceedings, the amazing breadth and depth of public data presented at The World Bank – Indicators | Data, thanks. Sometimes we tend to ignore the primary source of information, but we need to acknowledge every now and again, such “founts of information”, broken into indicators within the categories …

  • Agriculture & Rural Development
  • Aid Effectiveness
  • Climate Change
  • Economy & Growth
  • Education
  • Energy & Mining
  • Environment
  • External Debt
  • Financial Sector
  • Gender
  • Health
  • Infrastructure
  • Poverty
  • Private Sector
  • Public Sector
  • Science & Technology
  • Social Development
  • Social Protection & Labor
  • Trade
  • Urban Development

Pretty impressive! We’ve chosen a few new indicators to add to the pre-existant top two of …

  • Population
  • Gross Domestic Product
  • Access to electricity (% of population)
  • Forest Area (sq km)
  • Agricultural Land (sq km)
  • Fertility rate, total (births per woman)
  • Hospital Beds (per 1,000 people)
  • Rail Lines (total route-km)
  • Labor Force, Total
  • Population density (people per sq. km of land area)
  • Time required to start a business (days)

… “Access to electricity (% of population)” noteworthy Pie Chart wise benefitting from option part pieSliceText: “value”, … the general “theme” being the more we all find out, the better we are to tackle the worldwide discussions we all need to have regarding Earth’s big issues.

This needed changes to …


Previous relevant Worldbank API Comparison Year Google Chart Mobile Tutorial is shown below.

Worldbank API Comparison Year Google Chart Mobile Tutorial

Worldbank API Comparison Year Google Chart Mobile Tutorial

Yesterday’s Worldbank API Comparison Year Pie Chart Differences Tutorial involved Google Charts Pie Chart Difference graphics that …

  • needed work to be functional on mobile platforms, allowing for some Javascript tweaking of the options of those Google ChartPie Chart Difference options … with the …
  • “parent” supervisory web application has HTML (and Javascript and CSS) you could call worldbank_population_data.htm changed in this way … supplying a screen width …

    var whsuffix='';
    var deviceWidth = window.orientation == 0 ? window.screen.height: window.screen.width;
    var deviceHeight = window.orientation == 0 ? window.screen.width : window.screen.height;
    var rectis=document.body.getBoundingClientRect();
    if (('' + rectis.width).replace('px','').replace(/0/g,'') != '' && ('' + rectis.height).replace('px','').replace(/0/g,'') != '') {
    deviceWidth=('' + rectis.width).replace('px','');
    deviceHeight=('' + rectis.height).replace('px','');
    }
    whsuffix='&swidth=' + ('' + eval(('' + deviceWidth).replace('px','')) * 1.0) + '&sheight=' + ('' + eval(('' + deviceHeight).replace('px','')) * 1.0);

    … via a suffix to its URL call of the …
  • “child” supervised you could call worldbank_population_data.php changed in this way
    <?php

    $widea=620;
    if (isset($_GET['swidth'])) {
    $widea=$_GET['swidth'];
    $widea/=3.0;
    } else if (isset($_POST['swidth'])) {
    $widea=$_POST['swidth'];
    $widea/=3.0;
    }
    $widea=round($widea);
    //
    // later ... in an echo " some HTML " bit ...
    //
    <input type='hidden' name='moreopt' value=' width: " . $widea . ", height: 1200, chartArea: { width: \"86%\", height: \"70%\" }, '></input>

    ?>
    … we think we’ve come up with a better compromise for all … and today we turn a lot of attention to …
  • start improving the Year “through to” Year functionality calling on …
  • Area Chart interfacing area_chart.php is the changed PHP programming source code as per changes
  • Bar Chart interfacing bar_chart.php is the changed PHP programming source code as per changes
  • Column Chart interfacing column_chart.php is the changed PHP programming source code as per changes
  • Line Chart interfacing line_chart.php is the changed PHP programming source code as per changes
  • … what we like to think of as “the statistical charts”, improving …

    1. emoji flags
    2. legend size … and in so doing, opening the door to …
    3. future parameterization of these chart options, via a “parent”‘s business logic (without having to change the Charts so much again)

    … also affecting …

  • pie_chart.php changed this way
  • pie_chart_diff.php changed this way

As you may well be familiar with, here is a live run link to try this WorldBank data reporting yourself.


Previous relevant Worldbank API Comparison Year Pie Chart Differences Tutorial is shown below.

Worldbank API Comparison Year Pie Chart Differences Tutorial

Worldbank API Comparison Year Pie Chart Differences Tutorial

When you compare two year data sets with the web application of yesterday’s Worldbank API World Country Reporting Revisit Tutorial you are likely to be accessing the Google Charts Pie Chart Differences tool using Google”smarts” to compare two data sets via three graphical components.

Those “graphical components” are each “entities” in terms of servicing any Google Charts “select” event logic. In order to still have some “select” (onclick) event logic we needed to compromise in two ways …

  • onmouseover tooltips could not be supported
  • the smaller Pie Chart slices two small to display a percentage value have not be zeroed into

… and so we become keen to help out here in two ways …

  1. try to make the legend not need clicking (and so size it to be a full list, at least for single letter executions) … thanks to this useful link, thanks, for lead to

    <form onsubmit='return preiframeviaurl();' target='myiframe' id='myform' style='display:none;' method='POST' action='" . $preudiff . $udiff . ".php'>
    <input type='hidden' name='title' id='title' value='" . $reportmode2 . " by World Country " . $startswith . " for Year " . $tbit . "'></input>
    " . $onclick . "
    <input type='hidden' name='task' id='task' value='" . $reportmode . "'></input>
    <input type='hidden' name='desc' id='desc' value='" . $reportmode . "'></input>
    <input type='hidden' name='label' id='label' value='Year'></input>
    <input type='hidden' name='value' id='value' value='" . str_replace('%2c','',str_replace('%2C','',$valuelist)) . "'></input>
    <input type='hidden' name='onclick' value='y'></input>
    <input type='hidden' name='moreopt' value=' width: 620, height: 1200, chartArea: { width: \"50%\", height: \"70%\" }, '></input>
    <input type='hidden' name='data' id='data' value='" . explode("&data=",$url)[1] . "'></input>" . "\n" . $idata2 . "\n" . "
    <input id='mysubmit' type='submit' value='Draw Pie Chart'></input>
    </form>
  2. make sure a full data list appears (along with emoji flags and population numbers) in the Javascript prompt window value part

This involved the “supervisory child” …


Previous relevant Worldbank API World Country Reporting Revisit Tutorial is shown below.

Worldbank API World Country Reporting Revisit Tutorial

Worldbank API World Country Reporting Revisit Tutorial

We’re revisiting the PHP web application of Worldbank API World Country Reporting Regex Tutorial for a few days to …

  • add some emoji flags
  • fix some event logic weaknesses, starting today with the single year Worldbank Data incarnations (thanks to World Bank API), but not finished as far as comparison years Worldbank Data incarnations
  • fix Mixed Content issues to allow for seamless SSL https: or http: URL usage

So, today, both “parent” HTML and “child” PHP changed today so that …

… overseeing Google Chart Pie Chart interfacing that changed as per pie_chart.php changed this way and pie_chart_diff.php changed this way.

Try a live run link for yourself to see where we are going with this.


Previous relevant Worldbank API World Country Reporting Regex Tutorial is shown below.

Worldbank API World Country Reporting Regex Tutorial

Worldbank API World Country Reporting Regex Tutorial

Don’t know why, but have often equated regex work in Javascript or PHP with “RegEx Rangers”, or some such other “superhero” categorization. That is because to wield RegEx principles is a bit like swinging a sword through the “butter” of coding problems. Its use can feel arcane, but using it can solve so many issues and simplify projects, it is unbelievable. Trouble I’ve always found is that I like to be presented with a RegEx “ask” as a user, but don’t think a lot of people like it. An upcoming tutorial, though, will show the wonders of a “RegEx” scenario for a text editing job we did recently … we’ll keep you posted on that.

But back to today’s “RegEx” thinking, building on top of yesterday’s Worldbank API World Country Reporting Range Tutorial. We ended up asking the user for optional “RegEx” matching criteria for name matches between the Worldbank API data’s …

  • key (or name)
  • value (numerical)

… properties, to add to the pre-existing, and still available, the “starting with” name filtering functionality we’ve had working ever since Worldbank API World Country Population Report Tutorial as shown way below.

RegEx “thinking” exists for both server and client parts of web applications, for us, consecutively with …

… and we use it with serverside PHP today, under the auspices of the preg_match function, though we most often use RegEx thinking with the Javascript replace function, as the way to make substitutions for more than one occurrence, (the one occurrence design being) a default “curiosity” (but can be useful too) about Javascript’s version of substitution. You may know this RegEx usage of the Javascript replace function as “global substitution”.

If you’re new to RegEx thinking let me outline just a few tips …

  • ^ can mean “start of”
  • $ can mean “end of”
  • . can sometimes mean “one existant character wildcard” … or sometimes it is % or ? for this in other “systems”
  • * can often mean “zero or more of preceding character wildcard”
  • [] and () bracketing rules are pretty crucial for the more esoteric usages … also study | usage

In our tutorial picture we are showing “land$” countries that would feature, if Greenland goes independent one day …

  • Greenland … “full of ice” … and …
  • Iceland … “full of green”

Again, both “parent” HTML and “child” PHP changed today so that …

… to facilitate better (optional) Country name filtering for users of the web application.


Previous relevant Worldbank API World Country Reporting Range Tutorial is shown below.

Worldbank API World Country Reporting Range Tutorial

Worldbank API World Country Reporting Range Tutorial

If you’ve been keeping up to date with the latest thread of blog postings regarding our “Worldbank API World Country Reporting Project” web application, you’ll notice that there is no mention of a Worldbank API indicators in the blog title. That is because we still have “generic” matters to consider, but that is not an imposition to the web application design today. Today, as well as …

  • the original alphabetic starting with country filter (to key below) … we’ve added, today, a …
  • value “range” filter (to value below) applied to the reporting theme’s numerical value

… and because everything reported on has a …

  • key (or name)
  • value (numerical)

… basis, we can apply today’s value “range” filter generically “across the board” (for any of the indicators “Population” and “Gross Domestic Product”, so far).

Why do we use the word “filter” here? Well, a filter limits something, and we’re limiting the maximum amount of output data reported on, by, optionally, taking what a user says about the minimum and maximum (numerical) value ranges for data reporting.

In the case of Google Charts, when there is lots of data too close together to view it definitively, it does some clever data reduction, and we have a means today, to get in under that data reduction to more esoteric reporting possibilities, as a result of our new filter, used well by the user.

Let’s show you how a cluttered //www.rjmprogramming.com.au/PHP/worldbank_population_data.php?startswith=C&year=2015&yearvs=-2011&justletters=y

… can become uncluttered //www.rjmprogramming.com.au/PHP/worldbank_population_data.php?startswith=C&year=2015&yearvs=-2011&max=40000000&justletters=y for those smaller values, by using this value “range” filter below …

So yet again, both “parent” HTML and “child” PHP changed today so that …

  • “parent” supervisory web application has HTML (and Javascript and CSS) you could call worldbank_population_data.htm changed in this way
  • “child” supervised you could call worldbank_population_data.php changed in this way that if you examine you can see the use of PHP cookie methods for the first time here (as we usually use Javascript), specifically, reading and creating (via PHP setcookie method) HTTP Cookies as per the code …

    function rangeget($basis) {
    global $reportmode;
    $cookie_name = "Worldbank_" . str_replace(" ","_",$reportmode) . "_" . $basis;
    if (isset($_COOKIE[$cookie_name])) {
    return $_COOKIE[$cookie_name];
    }
    return 0.0;
    }

    function rangeset($basis, $val) {
    global $reportmode, $startswith;
    if ($startswith == "") {
    $cookie_name = "Worldbank_" . str_replace(" ","_",$reportmode) . "_" . $basis;
    $cookie_value = $val;
    setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/PHP/"); // 86400 = 1 day
    return $val;
    }
    return rangeget($basis);
    }

And so yet again, we would welcome you trying this web application for yourself to try out the new value range filtering functionality that we also talk about at WordPress 4.1.1’s Worldbank API World Country Reporting Range Tutorial.


Previous relevant Worldbank API World Country Gross Domestic Product Tutorial is shown below.

Worldbank API World Country Gross Domestic Product Tutorial

Worldbank API World Country Gross Domestic Product Tutorial

We’ve changed onion types today in our quest for the ultimate “onion of the 4th dimension” concept this project, that being our … oops, the goalposts have shifted … web application project “Worldbank API World Country Population Report Project” where we extend the “scope” of the “indicators” we can report on to those we presented yesterday with Worldbank API World Country Population Period Tutorial, those being the original …

… and here you may have sneaked a peek below to see that …

  • nothing codewise has been added to in terms of “pieces of code” … we thank the excellence of (the organization of the) Worldbank API for this, as the form of the GDP data is not enough different to that of the Population data to warrant us thinking that we needed to change anything other than versions … and …
  • nothing codewise has been renamed in terms of “pieces of code” … and that is us … we’re not embarrassed that a “guinea pig” for an idea gets extended into a bigger picture … so long as “Worldbank” is there in the name somewhere

This “guinea pig” method of extending a project has its advantages and disadvantages as most methods of doing things (inherently) have (their own) advantages and disadvantages. The “guinea pig” approach may suffer if things become complex later when you try to fit in another “extended” concept that is a bit of a “square hole” being forced into our “round socket” … (😄💖🔴). Conversely, if things stay simple enough, why not use methods like …

  • plugging in a programmatic “variable” where once there was a “hardcoding” … and …
  • plugging in (the equivalent of) an HTML select element “dropdown” where once there was a titular piece of text

… to keep on pushing out the “onion” types … we know you’re out there … come an’ show us the cut of your jib!

Yet again, both “parent” HTML and “child” PHP changed today for the new extended “indicator” reporting (adding GDP to pre-existing Population indicator(s)), so that …

And yet again, we would welcome you trying this web application for yourself to try out this new “layer” of functionality “positioning”.


Previous relevant Worldbank API World Country Population Period Tutorial is shown below.

Worldbank API World Country Population Period Tutorial

Worldbank API World Country Population Period Tutorial

Yesterday’s Worldbank API World Country Population Trend Tutorial started us on the topic of “trends” with data and our Google Chart Pie Chart Differences representation of Worldbank API derived data took the form of the first of …

  • snapshot (of two different snapshotted times) … but today we turn our attention to …
  • period of time (of several regular snapshotted times)

… and for the purposes of this latter “chart” reporting we like, around here, still talking in terms of Google Charts, in order of our opinion “regarding quality of reporting purpose” with regard to this Worldbank API Population data reporting …

  • Line Chart
  • Column Chart
  • Bar Chart
  • Area Chart

… all Google Chart “types” looking for the same basic form of data, the hint, in the first place, why we associate these all together with that new period of time reporting options we’ve integrated into the web application at the “parent” HTML supervisor level by, for every new option from yesterday of the form [year] compared to in that top lefthand HTML select element “dropdown”, we also add in an associated [year] through to “dropdown” option which, if selected, will present the user with the opportunity to select the type of Google Chart they’d like to see from the list of four chart types as described above.

Again, both “parent” HTML and “child” PHP changed today for that period of time concept of reporting, so that …

And again, we would welcome you trying this web application for yourself, to get this into perspective regarding perhaps, your own opinions about the pros and cons, strengths and weaknesses of the various very useful Google Chart ideas we appreciate for those reporting tasks, helping support the adage “every picture is worth a thousand words”.


Previous relevant Worldbank API World Country Population Trend Tutorial is shown below.

Worldbank API World Country Population Trend Tutorial

Worldbank API World Country Population Trend Tutorial

The “onion of the 4th dimension” way to go (after yesterday’s Worldbank API World Country Population Report Tutorial as shown below) for our latest web application project “Worldbank API World Country Population” we like is to now start thinking of a means to show “trends” in population. With this in mind there is a ready made Google Chart Pie Chart Differences to help here. With the Google Chart Pie Chart Differences we’ll supply two different years worth of data, and the cleverness of this Google Chart product is called into play to show three Pie Charts, namely …

  • original year’s Pie Chart Worldbank API data
  • “compared to” year‘s Pie Chart data
  • a Google Chart Pie Chart Differences “trend” Pie Chart showing an “inner ring” Pie Chart within an “outer ring” Pie Chart where you can get a sense of “trends” that are taking place

… that is manifested in the “parent” HTML code by changing the previous hardcoded “Year” word with an HTML select element “dropdown” element to define that optional second “compared to” year of interest.

The other new functionality today is a “share” via Email emoji (HTML a link “button”) that latches on to the user’s Email client program via Middle Word Share Tutorial‘s approach, namely …

mailto:[emailAddress]?subject=[Subject]&body=[URLtoLinkTo] type of href property (on that link). As you can imagine, it is possible to piece together a Javascript encodeURIComponent() version of [URLtoLinkTo] value via the current webpage’s document.URL

… the curious variation being that we don’t think of the “parent” HTML’s document.URL here (in blurb above), but, rather, it is more useful to consider the “child” HTML iframe element PHP’s document.URL both as an easier to code concept, and the simplifier of “length of data” GET vs POST HTML form element originated data issues. You see, if your data getting to the Pie Chart is over a certain length, it will be POSTed and you would lose the opportunity to Email this (in that mailto: email client program way), because you rely on real GET method URLs for this approach. At the “view” of the middle “child” PHP, though, it gets its calls, always, in a GET URL way, so it is, counterintuitively, the best (and simplest) place to intervene and code for this Email “share” functionality.

Both “parent” HTML and “child” PHP changed today, so that …

We would welcome you trying this web application for yourself, to get this into perspective.


Previous relevant Worldbank API World Country Population Report Tutorial is shown below.

Worldbank API World Country Population Report Tutorial

Worldbank API World Country Population Report Tutorial

In yesterday’s Worldbank API World Country Population Primer Tutorial, as shown below, we noted …

the data is presented in some way shape or form with the Pie Chart, but for all the advantages of lots of information in the one place, it does suffer a bit with clutter

… and today we show some practical strategies to be more clear (less cluttered) with the data, should the user, optionally, be interested, here.

In practical terms, we built a supervisory HTML “parent” you could call worldbank_population_data.html (with this new live run link) on top of yesterday’s “duck with the legs moving fast” hard working “child” HTML iframe element housed PHP worldbank_population_data.php (changed this way to accomodate this move).

If you had to break up a huge chunk of Worldbank API data related to World Countries and their Population, what would you research as an idea to do this? No doubt a lot of people would agree with how we approach it, that being …


report via a "starting with" alphabetic criteria

Makes sense? We hope so, and we’ll also ask for a Year of interest, with the caveat that we should offer the user the “absolute thinking” that would say if you are doing a report on …


Population by World Country A for year 2015

… for example, you should offer the user to show Pie Charts for the two scenarios below …

  • World Country A Populations compared to each other … or …
  • World Country A Populations compared to each other and a Non-A Population entry (which totals all non-A country populations)

We could present these functionality options in an HTML select element “dropdown”, but we think today, we’ll use a top menu of HTML a links to interface to the user of this “parent” supervisory web application we welcome you to try out for yourself.


Previous relevant Worldbank API World Country Population Primer Tutorial is shown below.

Worldbank API World Country Population Primer Tutorial

Worldbank API World Country Population Primer Tutorial

Today we’re revisiting the absolutely astonishing resource that the Worldbank API website provides. Such free public sources of data are very much appreciated in our books. Not so much in our pamphlets, but definitely in the books. Revisiting we thought, perhaps, we heard you ask … or were you passing wind? Glad you asked. Remember when we presented PHP Worldbank Growth of Merchandise Trade Tutorial, as shown below? Then, we used Google Chart Bubble Chart to present reams of information. Today, we again broach “reams” of Wordbank Population data per country to present a Google Chart Pie Chart report.

On our “first draft” of this web application project we create just the one pie chart, but we do that, along the way showing you a couple of things …

  • the “reams” of data is processed on the understanding it could be sent to an HTML iframe as a URL plonked into that iframe element’s src property (as if), or if that URL is too long then that data is plugged into the HTML form and then sent (POSTed) to that same HTML iframe (whose name is the same as the form element’s target=name) via an HTML form element whose action property is set to …

    //www.rjmprogramming.com.au/PHP/PieChart/pie_chart.php
  • the data is presented in some way shape or form with the Pie Chart, but for all the advantages of lots of information in the one place, it does suffer a bit with clutter

… and so we try some strategies to help with those clutter issues above in blog postings to come.

In the meantime, why not try a live run of the underlying PHP (serverside) web application you could call worldbank_population_data.php featuring …

  • use of PHP file_get_contents() to extract …
  • JSON data is extracted and parsed to help piece together that URL to the Google Chart Pie Chart, as mentioned way above

Previous relevant PHP Worldbank Growth of Merchandise Trade Tutorial is shown below.

PHP Worldbank Growth of Merchandise Trade Tutorial

PHP Worldbank Growth of Merchandise Trade Tutorial

We’ve said it before, and (no doubt) we’ll say it again … there are great public data sources out there for you to explore.

As far as international data goes the Worldbank series of statistics is great, so, thanks.

Today we combine the Worldbank data for Growth of Merchandise Trade 2003-2013 with the wonderful Google Chart Bubble Chart to create (52 = (first letters of country name) 26 x 2 (concepts: Exports and Imports)) reporting charts of interest, we hope. Again, as with any reporting subject, it is a personal thing, whether the subject matter of a report is of interest, but you could say that about so many things in life.

So, we offer some PHP source code you could call growth_of_merchandise_trade.php and a live run link as well, the full loading of which requires patience.

Stop Press

Tomorrow we go over what was needed to change PHP code above to be more mobile friendly …

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in Ajax, eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment