Because we spend so much time in WordPress blog TwentyTen theme’s good ol’ header.php “tweaking away” we’ve quite often got a Javascript codeline of the ilk …
var blahdeblah=document.getElementsByTagName('[elementType]');
… to suit a new scenario of interest, and so we find ourselves embedding new logics into old logics. That is the case today where in WordPress Calendar Widget Destination Webpage Image Background Tutorial‘s “function calendar_pass()” we’re happy building after …
var cps=document.getElementsByTagName('a');
… as an ideal intervention point for a “WordPress Link URL Remapping” idea today. It could be used for broken links, which we’ll look into over time, but, for now, we wanted to remap …
https://www.youtube.com/watch?v=e9_7GcQeiqw&t=2m37s
… to …
… to, primarily …
- (touch wood it stays this way) avoid advertisements by playing YouTube video through the YouTube Embedded Iframe Video Play API …
- improve on a video stop place
… to get the ball rolling reading the new “inhouse” fromtolist.txt …
https://www.youtube.com/watch?v=e9_7GcQeiqw&t=2m37s
https://www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=e9_7GcQeiqw&youtube_duration=201.361&email=&email=&emoji=on&c0=on&i0=157&j0=162&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=
https://www.youtube.com/watch?v=e9_7GcQeiqw&t=157s
https://www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=e9_7GcQeiqw&youtube_duration=201.361&email=&email=&emoji=on&c0=on&i0=157&j0=162&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=
https://www.youtube.com/watch?v=g2Y_p8-LbY4&t=1m25s
https://www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=g2Y_p8-LbY4&youtube_duration=189.781&email=&email=&emoji=on&c0=on&i0=85&j0=189.781&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=
… processed within “function calendar_pass()” …
function calendar_pass() {
var thisc='', thiscc='', thist='', jiicp=0, thisdate='', thistime='', nexttime='', thishour=0, nexthour=0, thisminute='', thissecond='00', thisurl='';
var h1cps=docgetclass('entry-title','*'); //document.getElementsByTagName('h2');
var tdzs=document.getElementsByTagName('td'), itdzs=0;
var cps=document.getElementsByTagName('a');
var cdes=document.getElementsByTagName('code');
var mfnd=false, washref='';
for (var ijcal=0; ijcal<cps.length; ijcal++) { // new calendar links background image
<?php
$fromtojs=""; // inhouse a link href remapping idea ... November, 2024
$fromtolist="";
if (file_exists('./fromtolist.txt')) {
$fromtolist='' . file_get_contents('./fromtolist.txt');
$fromtos=explode("\n", $fromtolist);
//file_put_contents('xzv.xzv', '' . sizeof($fromtos));
for ($ifromtos=0; $ifromtos<sizeof($fromtos); $ifromtos+=2) {
if (strpos($fromtos[$ifromtos], "//") !== false && strpos($fromtos[1 + $ifromtos], "//") !== false) {
$fromtojs.="\n if (('' + cps[ijcal].href).indexOf('//" . substr($fromtos[$ifromtos],strlen(explode('//',$fromtos[$ifromtos])[0] . '//')) . "') != -1) { \n cps[ijcal].href='//" . substr($fromtos[1 + $ifromtos],strlen(explode('//',$fromtos[$ifromtos])[0] . '//')) . "'; \n } \n";
}
}
//file_put_contents('xzvv.xzvv', '' . $fromtojs);
}
echo $fromtojs;
?>
// Check for GETME links for .htm and no diff.php mention
if (('' + cps[ijcal].href).toLowerCase().indexOf('.htm') != -1 && ('' + cps[ijcal].href).indexOf('GETME') != -1 && ('' + cps[ijcal].href).indexOf('diff.php') == -1) {
if (cps[ijcal].innerHTML.replace('(oldest)', 'Older ').replace('Newer ', 'Older ').indexOf('Older ') == -1) {
washref=('' + cps[ijcal].href);
cps[ijcal].href='//www.rjmprogramming.com.au/PHP/Geographicals/diff.php?zero=' + encodeURIComponent(washref) + '#seehtmllook=n';
}
}
if (eval('' + ('' + cps[ijcal].href).split('/').length) == 8) {
if (eval('' + ('' + cps[ijcal].href).split('/')[4].length) == 4) {
mfnd=false;
for (itdzs=0; itdzs<tdzs.length; itdzs++) {
if (tdzs[itdzs].innerHTML.replace(String.fromCharCode(10),'').indexOf('<code') == 0 && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if (tdzs[itdzs].outerHTML.indexOf('-webkit-overflow-scrolling') == -1) {
if (1 == 1) {
tdzs[itdzs].innerHTML=tdzs[itdzs].innerHTML.replace('<code>','<code style="-webkit-overflow-scrolling:touch;overflow:scroll;">').replace('<code style="','<code style="-webkit-overflow-scrolling:touch;overflow:scroll;');
} else {
tdzs[itdzs].WebkitOverflowScrolling='touch';
tdzs[itdzs].Overflow='scroll';
}
}
}
if (tdzs[itdzs].innerHTML == cps[ijcal].outerHTML) {
tdzs[itdzs].className=cps[ijcal].title.replace(/\ /g,'_');
tdzs[itdzs].onclick=function(evt){ window.open('//www.rjmprogramming.com.au/ITblog/' + evt.target.innerHTML.split(' title="')[1].split('"')[0].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(" ","-"), '_blank', 'top=50,left=50,width=1200,height=900'); };
mfnd=true;
}
}
if (!mfnd) {
cps[ijcal].onmouseover=function(evt){ var pbs=('' + evt.target.href).split('/'); if (document.head.innerHTML.indexOf('[title=' + "'" + evt.target.title + "'" + ']') == -1) { document.head.innerHTML+=' <style> [title=' + "'" + evt.target.title + "'" + '] { ' + ' background:url(//www.rjmprogramming.com.au/ITblog/500/500/?random=178654345&mustbedated=' + pbs[4] + pbs[5] + pbs[6] + ') center center no-repeat; background-size:cover; } </style> '; } };
} else {
cps[ijcal].onmouseover=function(evt){ var pbs=('' + evt.target.href).split('/'); if (document.head.innerHTML.indexOf(' .' + evt.target.title.replace(/\ /g,'_') + ' {') == -1) { document.head.innerHTML+=' <style> .' + evt.target.title.replace(/\ /g,'_') + ' { ' + ' background:url(//www.rjmprogramming.com.au/ITblog/500/500/?random=178654345&mustbedated=' + pbs[4] + pbs[5] + pbs[6] + ') center center no-repeat !important; background-size:cover; } </style> '; } };
}
}
}
}
//for (itdzs=0; itdzs<cdes.length; itdzs++) {
// cdes[itdzs].className='notranslate';
// cdes[itdzs].translation='no';
//}
for (var iicp=0; iicp<h1cps.length; iicp++) {
thist=h1cps[iicp].innerHTML.split(' <')[0].split('<')[0];
thisurl='';
if (h1cps[iicp].innerHTML.indexOf(' id="d') != -1) {
thisurl="//www.rjmprogramming.com.au/ITblog/" + h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0];
}
if (jiicp < cps.length) {
while (jiicp < cps.length && (cps[jiicp].innerHTML.indexOf(' content="') == -1 || cps[jiicp].innerHTML.indexOf('') != -1)) {
jiicp++;
}
if (jiicp < cps.length) {
if (cps[jiicp].title.indexOf(':') != -1) {
thisdate=cps[jiicp].innerHTML.split(' content="')[1].split('"')[0].replace('-','').replace('-','');
thishour=eval(cps[jiicp].title.split(':')[0]);
nexthour=thishour;
if (cps[jiicp].title.indexOf(' pm') != -1 && thishour < 12) thishour+=12;
if (thishour < 12) {
nexthour+=12;
} else if (nexthour < 23) {
nexthour=23;
}
thisminute=cps[jiicp].title.split(':')[1].split(' ')[0];
thistime=':' + ('0' + thishour).slice(-2) + thisminute + thissecond;
nexttime=':' + ('0' + nexthour).slice(-2) + thisminute + thissecond;
//alert(thist + ' ' + thisurl + ' ' + thisdate + thistime);
//alert("//www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&inhouse_ynft=y&eventwords=test&title=" + encodeURIComponent(thist) + '&stage=' + encodeURIComponent(h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0]) + '&datestart=' + encodeURIComponent(thisdate + thistime) + '&dateend=' + encodeURIComponent(thisdate + thistime) + '&emode=Address&address=Address&description=Description&url=' + encodeURIComponent(thisurl));
//window.open("//www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent("Australia/Perth,Australia/Perth") + "&inhouse_ynft=y&eventwords=test&title=" + encodeURIComponent(thist) + '&stage=' + encodeURIComponent(h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0]) + '&datestart=' + encodeURIComponent(thisdate + thistime) + '&dateend=' + encodeURIComponent(thisdate + nexttime) + '&emode=AndTo&address=' + encodeURIComponent('rmetcalfe15@gmail.com') + '&description=Description&url=' + encodeURIComponent(thisurl), '_blank', 'top=45,left=55,width=600,height=600');
thisc="//www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent("Australia/Perth,Australia/Perth") + "&inhouse_ynft=y&eventwords=test&title=" + encodeURIComponent(thist) + '&stage=' + encodeURIComponent(h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0]) + '&datestart=' + encodeURIComponent(thisdate + thistime) + '&dateend=' + encodeURIComponent(thisdate + nexttime) + '&emode=To&address=emailAddress&description=Description&url=' + encodeURIComponent(thisurl);
thiscc="//www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent("Australia/Perth,Australia/Perth") + "&inhouse_ynft=y&eventwords=test&title=" + encodeURIComponent(thist) + '&stage=' + encodeURIComponent(h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0]) + '&datestart=' + encodeURIComponent(thisdate + thistime) + '&dateend=' + encodeURIComponent(thisdate + nexttime) + '&emode=Address&address=&description=Description&url=' + encodeURIComponent(thisurl);
cps[jiicp].innerHTML+=' <a id="oe' + h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0] + '" title="Change order of blog posts (now newest to oldest) to oldest through to newest (like a book)" target=_blank style="text-decoration:none;cursor:pointer;" onclick="hrrearrange(this);">🔀</a>';
cps[jiicp].innerHTML+=' <a id="ce' + h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0] + '" title="Create iCal Calendar Event ' + thist + '" target=_blank href="' + "//www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent("Australia/Perth,Australia/Perth") + "&inhouse_ynft=y&eventwords=test&title=" + encodeURIComponent(thist) + '&stage=' + encodeURIComponent(h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0]) + '&datestart=' + encodeURIComponent(thisdate + thistime) + '&dateend=' + encodeURIComponent(thisdate + nexttime) + '&emode=AndTo&address=' + encodeURIComponent('rmetcalfe15@gmail.com') + '&description=Description&url=' + encodeURIComponent(thisurl) + '">📅</a>';
cps[jiicp].innerHTML+=' <iframe id="ice' + h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0] + '" src="about:blank" style="display:none;width:1px;height:1px;"></iframe><a title="Email and Create iCal Calendar Event ' + thist + '" target=_blank href="#" onclick=" var emtwo=prompt(' + "'" + 'Who do we email to?' + "','fillin@email.in'); document.getElementById('ice" + h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0] + "').src='" + thisc + "'.replace(/emailAddress/g, encodeURIComponent(emtwo)); window.open('" + thiscc + "','_blank'); \">➕</a>";
cps[jiicp].innerHTML+=' <a id="ee' + h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0] + '" title="Email iCal Calendar Event ' + thist + '" target=_blank href="#" onclick=" var em=prompt(' + "'" + 'Who do we email to?' + "','fillin@email.in'); window.open('" + thisc + "'.replace(/emailAddress/g, encodeURIComponent(em)),'_blank'); \">📧</a>";
jiicp+=3;
cps=document.getElementsByTagName('a');
}
}
}
}
}
Previous relevant WordPress Calendar Widget Destination Webpage Image Background Tutorial is shown below.
Yesterday’s WordPress Calendar Widget Table Cell Tutorial Image Background Tutorial highlights a talking point regarding webpage functionality …
- there is the flagging that “functionality is there” phase of webpage development … maybe almost as important as …
- the “functionality itself working” phase of webpage development
Alas, mobile platforms not having an onhover feel to showing an HTML element’s title attribute have made the former “functionality is there” flagging harder (than it should be) to achieve, sometimes. Over time, though, we have often found solace here with the “placeholder” attribute with textboxes and various “short period” ideas. We’re not complaining, as much as trying to get the point across, that doing productive office work which involves webpages, is likely to be a lot easier and more self explanatory on a laptop rather than a mobile device. And it’s not just this aspect where this is the case. Ajax via the onmouseover (ie. hover) event is not a mobile friendly thing. But, of course, the big counter argument, is that there are mobile apps designed for your bespoke purposes. The question is, do you want hundreds of bespoke applications that could be solved via a few generic web applications designed for use on your office laptops or desktops?
Yesterday’s work helped flag what you might expect next, at least if you click that “a” link embedded within the “td” cell element. You get to …
- that date’s summary of relevant blog postings … which a user might now expect … as happens as of today … some background images showing tutorial pictures … possible because of that 404.php functionality … and then we realized it would be good to extend that to all of …
- a search list of tutorial blog post summaries … or …
- a category list of tutorial blog post summaries … or …
- a tag list of tutorial blog post summaries … or …
- a monthly list of tutorial blog post summaries
… which got us to (PHP code), in (good ol’) header.php, first off, down in the HTML before div id=main definition …
<?php
$mypre=''; $mysuff=''; if (strlen($stylebitapp) > 0) { $mypre='<div id="divnthcss">'; $mysuff='</div>'; } echo str_replace('<style>','<!--style>',str_replace('</style>','</style-->',$mypre . $stylebitapp . $mysuff));
?>
… and just below “<style>” …
<style>
<?php
$stylebitapp=' <style> .entry-summary { background: linear-gradient(rgba(255,255,255,0.5),rgba(255,255,255,0.5)),url(//www.rjmprogramming.com.au/ITblog/1000/1000/?random=4575657&mustbedated=) center center no-repeat; background-size:cover; background-color:white; text-shadow: 1px 1px 2px #ff2d95; } .entry-utility { background: linear-gradient(rgba(255,255,255,0.7),rgba(255,255,255,0.7)),url(//www.rjmprogramming.com.au/ITblog/1000/1000/?random=4575657&mustbedated=) center right no-repeat; background-size:contain; background-color:white; text-shadow: 1px 1px 2px #2dff95; } </style> ';
$thisoky=false;
$isfour=false;
$uparts=explode("/", $_SERVER['REQUEST_URI']);
if (sizeof($uparts) >= 2) {
if (trim(explode('#',explode('?',$uparts[-1 + sizeof($uparts)])[0])[0]) == '') {
$ioff=-1;
}
if (1 == 1 || ('' . $_SERVER['QUERY_STRING']) == '') {
$usz=sizeof($uparts);
if (str_replace('?' . $_SERVER['QUERY_STRING'],'',trim($uparts[-1 + sizeof($uparts)])) == '') { $usz--; }
if ($usz >= 6 && strpos($_SERVER['REQUEST_URI'], "/page/") !== false) {
if (sizeof(explode("/", explode("/page/",$_SERVER['REQUEST_URI'])[0])) == 4) { $isfour=true; }
}
if ($usz == 4) { // && strpos($uparts[-1 + $usz], "%20") !== false || strpos($uparts[-1 + $usz], "+") !== false) { // fix /ITblog/Linux%20mailx%20Primer%20Tutorial/ 18/1/2022 RM
if (substr(trim($uparts[$ioff - 1 + sizeof($uparts)]) . ' ',0,1) >= '0' && substr(trim($uparts[$ioff - 1 + sizeof($uparts)]) . ' ',0,1) <= '9') {
if (substr(trim($uparts[$ioff - 2 + sizeof($uparts)]) . ' ',0,1) >= '0' && substr(trim($uparts[$ioff - 2 + sizeof($uparts)]) . ' ',0,1) <= '9') {
$isfour=true;
}
}
if ($thisoky) {
$stylebitapp=str_replace("mustbedated=", "mustbedated=" . trim($uparts[$ioff - 3 + sizeof($uparts)]) . trim($uparts[$ioff - 2 + sizeof($uparts)]) . trim($uparts[$ioff - 1 + sizeof($uparts)]), $stylebitapp);
}
}
if ($usz == 5) { // && strpos($uparts[-1 + $usz], "%20") !== false || strpos($uparts[-1 + $usz], "+") !== false) { // fix /ITblog/Linux%20mailx%20Primer%20Tutorial/ 18/1/2022 RM
$thisoky=false;
if (substr(trim($uparts[$ioff - 1 + sizeof($uparts)]) . ' ',0,1) >= '0' && substr(trim($uparts[$ioff - 1 + sizeof($uparts)]) . ' ',0,1) <= '9') {
if (substr(trim($uparts[$ioff - 2 + sizeof($uparts)]) . ' ',0,1) >= '0' && substr(trim($uparts[$ioff - 2 + sizeof($uparts)]) . ' ',0,1) <= '9') {
if (substr(trim($uparts[$ioff - 3 + sizeof($uparts)]) . ' ',0,1) >= '0' && substr(trim($uparts[$ioff - 3 + sizeof($uparts)]) . ' ',0,1) <= '9') {
$thisoky=true;
}
}
}
if ($thisoky) {
$stylebitapp=str_replace("mustbedated=", "mustbedated=" . trim($uparts[$ioff - 3 + sizeof($uparts)]) . trim($uparts[$ioff - 2 + sizeof($uparts)]) . trim($uparts[$ioff - 1 + sizeof($uparts)]), $stylebitapp);
}
} else if ($isfour || strpos(('' . $_SERVER['REQUEST_URI']), '/tag') !== false || strpos(('' . $_SERVER['REQUEST_URI']), '/cat') !== false) {
$stylebitapp=""; //str_replace("mustbedated=", "mustbedated=" . $usz, $stylebitapp);
$stylebitapp=" <style> .entry-meta:nth-of-type(1) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(2) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(3) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(4) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(5) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60pxx; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(6) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(7) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(8) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
} else if (strpos(('?' . $_SERVER['QUERY_STRING']), '?tag') !== false || strpos(('?' . $_SERVER['QUERY_STRING']), '?cat') !== false || strpos(('?' . $_SERVER['QUERY_STRING']), '?s=') !== false) {
$stylebitapp=""; //str_replace("mustbedated=", "mustbedated=" . $usz, $stylebitapp);
$stylebitapp=" <style> .entry-meta:nth-of-type(1) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(2) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(3) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(4) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(5) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60pxx; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(6) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(7) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
$stylebitapp.=" <style> .entry-meta:nth-of-type(8) { background-image: linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(//www.rjmprogramming.com.au/ITblog/500/500/?random=4575657&mustbedated=20170230); background-repeat:no-repeat; background-color:white; text-shadow: 1px 1px 2px #2dff95; background-position: left 0px top 60px; background-size:contain; } </style> ";
} else {
$stylebitapp="";
}
} else {
$stylebitapp="";
}
} else {
$stylebitapp="";
}
if (strpos($stylebitapp, "mustbedated=)") === false && sizeof(explode("<style>", $stylebitapp)) <= 2) {
echo "\n" . str_replace('<style>','',str_replace('</style>','',$stylebitapp)) . "\n";
$stylebitapp="";
} else if (sizeof(explode("<style>", $stylebitapp)) > 2) {
str_replace('<style>','<!--style>',str_replace('</style>','</style-->',$stylebitapp));
}
?>
… and at the end of the Javascript …
<?php echo ”
function divnthcssf() {
var nnum=1;
var lastpst='';
var drects=null;
if (document.getElementById('divnthcss')) {
if (document.getElementById('divnthcss').innerHTML.indexOf('style>') != -1) {
if (1 == 2) { alert(document.getElementById('divnthcss').innerHTML); }
var ddivt=document.getElementById('divnthcss').innerHTML; //.replace(/\!\-\-/g,'').replace(/\-\-/g,'');
var sss=document.getElementsByTagName('div');
for (var isss=0; isss<sss.length; isss++) {
if (sss[isss].outerHTML.indexOf(' id="post-') != -1 && sss[isss].outerHTML.indexOf(' content="') != -1) {
drects=sss[isss].getBoundingClientRect();
if (sss[isss].outerHTML.split(' id="post-')[1].split('"')[0] != lastpst) {
ddivt=ddivt.replace('20170230', sss[isss].outerHTML.split(' content="')[1].split('"')[0].replace(/\-/g,'')).replace('!--','').replace('--','');
ddivt=ddivt.replace('.entry-meta:nth-of-type(' + nnum + ')','#post-' + sss[isss].outerHTML.split(' id="post-')[1].split('"')[0]);
//if (eval('0' + drects.width) > 500) {
// ddivt=ddivt.replace('0px 60px', '' + eval(eval('' + drects.width) - 500) + 'px 61px');
//} else {
// ddivt=ddivt.replace('0px 60px', '0px 61px');
//}
nnum++;
lastpst=sss[isss].outerHTML.split(' id="post-')[1].split('"')[0];
}
}
}
//alert(ddivt);
document.getElementById('divnthcss').innerHTML=ddivt;
}
}
}
setTimeout(divnthcssf, 2000);
“; ?>
… to make this image backgrounding possible.
Previous relevant WordPress Calendar Widget Table Cell Tutorial Image Background Tutorial is shown below.
The recently increased role for our Word Press Blog 404.php (initially envisaged by WordPress codex as the PHP to address HTTP error 404 “Page Not Found”) has opened the door to many more uses. And thanks here to Lorem Picsum regarding a good role model here.
Today’s idea, best suited to non-mobile users (but can work more awkwardly on mobile) is to respond for a mobile hovering over our TwentyTen themed WordPress Blog’s Calendar widget, specifically the active “a” links within “td” table cells, and render a background image into that cell that corresponds to that date’s tutorial picture.
In order to achieve this we revisit the “function calendar_pass” Javascript function, within (good ol’) header.php, featuring in Calendar iCal Integration WordPress Tutorial up near the top …
<?php echo ”
function calendar_pass() {
var thisc='', thiscc='', thist='', jiicp=0, thisdate='', thistime='', nexttime='', thishour=0, nexthour=0, thisminute='', thissecond='00', thisurl='';
var h1cps=docgetclass('entry-title','*'); //document.getElementsByTagName('h2');
var tdzs=document.getElementsByTagName('td'), itdzs=0;
var cps=document.getElementsByTagName('a');
var mfnd=false;;
for (var ijcal=0; ijcal<cps.length; ijcal++) { // new calendar links background image
if (eval('' + ('' + cps[ijcal].href).split('/').length) == 8) {
if (eval('' + ('' + cps[ijcal].href).split('/')[4].length) == 4) {
mfnd=false;
for (itdzs=0; itdzs<tdzs.length; itdzs++) {
if (tdzs[itdzs].innerHTML == cps[ijcal].outerHTML) {
tdzs[itdzs].className=cps[ijcal].title.replace(/\ /g,'_');
tdzs[itdzs].onclick=function(evt){ window.open('//www.rjmprogramming.com.au/ITblog/' + evt.target.innerHTML.split(' title="')[1].split('"')[0].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(" ","-"), '_blank', 'top=50,left=50,width=1200,height=900'); };
mfnd=true;
}
}
if (!mfnd) {
cps[ijcal].onmouseover=function(evt){ var pbs=('' + evt.target.href).split('/'); if (document.head.innerHTML.indexOf('[title=' + "'" + evt.target.title + "'" + ']') == -1) { document.head.innerHTML+=' <style> [title=' + "'" + evt.target.title + "'" + '] { ' + ' background:url(//www.rjmprogramming.com.au/ITblog/500/500/?random=178654345&mustbedated=' + pbs[4] + pbs[5] + pbs[6] + ') center center no-repeat; background-size:cover; } </style> '; } };
} else {
cps[ijcal].onmouseover=function(evt){ var pbs=('' + evt.target.href).split('/'); if (document.head.innerHTML.indexOf(' .' + evt.target.title.replace(/\ /g,'_') + ' {') == -1) { document.head.innerHTML+=' <style> .' + evt.target.title.replace(/\ /g,'_') + ' { ' + ' background:url(//www.rjmprogramming.com.au/ITblog/500/500/?random=178654345&mustbedated=' + pbs[4] + pbs[5] + pbs[6] + ') center center no-repeat !important; background-size:cover; } </style> '; } };
}
}
}
}
// Rest of calendar_pass as in Calendar iCal Integration WordPress Tutorial below ...
}
“; ?>
… in the process …
- in a first pass adding a classname to those relevant “td” table cells …
- in same first pass adding an “onmouseover” (ie. hover) event to the relevant “a” link, that when the user hovers, appends to the document “head” some CSS styling that adds the tutorial picture image as the “td” background image and helped out by that “td” table cell classname …
- in same first pass adding an “onclick” event to the relevant “td” table cell, that when the user clicks the “td” cell, opens the relevant blog posting webpage in a popup window …
… helping, a little, previewing a calendar date’s content ahead of navigating to that content.
Previous relevant Calendar iCal Integration WordPress Tutorial is shown below.
After yesterday’s Calendar iCal Integration Email Tutorial we hoped we had a Calendar Event (creating) (component) “tool” web application that could be used in a variety of ways by other web applications. The first cab off the rank for this we decided should be (this) …
WordPress Blog
… that being our TwentyTen themed local effort. One of the reasons we plumped for this is that it involves Publishing Dates and we can even get access to a Publishing Time and even a Publishing Timezone (though this last one is a “hardcoded” (piece of) knowledge, rather than it being gleaned by WordPress (data) in any way). So we had the choice of means of display of this new functionality …
- adding to logic of the already hyperlinked Publishing Date data string
- adding the Publishing Time as a new HTML a (hyper)link placed after the Publishing Date and linking to the Calendar functionality
- adding relevant Emojis as new HTML a (hyper)links after the Publishing Date and linking to the Calendar functionality
… and we plumped for the last of these thoughts with our work today, as we liked the look of 📅 ➕ 📧 (that we tried out with our proof of concept p_o_f.html) to point at …
- Create iCal Calendar Entry
- Create and Email iCal Calendar Entry
- Email (only) iCal Calendar Entry
… respectively. The “go” with the email functionalities could be that you share a tutorial link with a friend whose email you know and correspond with.
And so it behoves us to show you (good ol’) TwentyTen header.php (the usual suspect) changes to make this happen below, for your perusal and/or interest …
function docgetclass(inc, intag) {
if (document.getElementsByClassName) {
return document.getElementsByClassName(inc);
} else {
var ijl;
var anarris=[];
var huhs=document.getElementsByTagName(intag);
for (ijl=0; ijl<huhs.length; ijl++) {
if (huh[ijl].className.indexOf(inc) != -1) {
anarris.push(huhs[ijl]);
}
}
return anarris;
}
}
function calendar_pass() {
var thisc='', thiscc='', thist='', jiicp=0, thisdate='', thistime='', nexttime='', thishour=0, nexthour=0, thisminute='', thissecond='00', thisurl='';
var h1cps=docgetclass('entry-title','*'); //document.getElementsByTagName('h2');
var cps=document.getElementsByTagName('a');
for (var iicp=0; iicp<h1cps.length; iicp++) {
thist=h1cps[iicp].innerHTML.split(' <')[0].split('<')[0];
thisurl='';
if (h1cps[iicp].innerHTML.indexOf(' id="d') != -1) {
thisurl="https://www.rjmprogramming.com.au/ITblog/" + h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0];
}
if (jiicp < cps.length) {
while (jiicp < cps.length && (cps[jiicp].innerHTML.indexOf(' content="') == -1 || cps[jiicp].innerHTML.indexOf('&#') != -1)) {
jiicp++;
}
if (jiicp < cps.length) {
if (cps[jiicp].title.indexOf(':') != -1) {
thisdate=cps[jiicp].innerHTML.split(' content="')[1].split('"')[0].replace('-','').replace('-','');
thishour=eval(cps[jiicp].title.split(':')[0]);
nexthour=thishour;
if (cps[jiicp].title.indexOf(' pm') != -1 && thishour < 12) thishour+=12;
if (thishour < 12) {
nexthour+=12;
} else if (nexthour < 23) {
nexthour=23;
}
thisminute=cps[jiicp].title.split(':')[1].split(' ')[0];
thistime=':' + ('0' + thishour).slice(-2) + thisminute + thissecond;
nexttime=':' + ('0' + nexthour).slice(-2) + thisminute + thissecond;
//alert(thist + ' ' + thisurl + ' ' + thisdate + thistime);
//alert("http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&eventwords=test&title=" + encodeURIComponent(thist) + '&stage=' + encodeURIComponent(h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0]) + '&datestart=' + encodeURIComponent(thisdate + thistime) + '&dateend=' + encodeURIComponent(thisdate + thistime) + '&emode=Address&address=Address&description=Description&url=' + encodeURIComponent(thisurl));
//window.open("http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent("Australia/Perth,Australia/Perth") + "&eventwords=test&title=" + encodeURIComponent(thist) + '&stage=' + encodeURIComponent(h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0]) + '&datestart=' + encodeURIComponent(thisdate + thistime) + '&dateend=' + encodeURIComponent(thisdate + nexttime) + '&emode=AndTo&address=' + encodeURIComponent('rmetcalfe15@gmail.com') + '&description=Description&url=' + encodeURIComponent(thisurl), '_blank', 'top=45,left=55,width=600,height=600');
thisc="http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent("Australia/Perth,Australia/Perth") + "&eventwords=test&title=" + encodeURIComponent(thist) + '&stage=' + encodeURIComponent(h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0]) + '&datestart=' + encodeURIComponent(thisdate + thistime) + '&dateend=' + encodeURIComponent(thisdate + nexttime) + '&emode=To&address=emailAddress&description=Description&url=' + encodeURIComponent(thisurl);
thiscc="http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent("Australia/Perth,Australia/Perth") + "&eventwords=test&title=" + encodeURIComponent(thist) + '&stage=' + encodeURIComponent(h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0]) + '&datestart=' + encodeURIComponent(thisdate + thistime) + '&dateend=' + encodeURIComponent(thisdate + nexttime) + '&emode=Address&address=&description=Description&url=' + encodeURIComponent(thisurl);
cps[jiicp].innerHTML+=' <a id="ce' + h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0] + '" title="Create iCal Calendar Event ' + thist + '" target=_blank href="' + "http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent("Australia/Perth,Australia/Perth") + "&eventwords=test&title=" + encodeURIComponent(thist) + '&stage=' + encodeURIComponent(h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0]) + '&datestart=' + encodeURIComponent(thisdate + thistime) + '&dateend=' + encodeURIComponent(thisdate + nexttime) + '&emode=AndTo&address=' + encodeURIComponent('rmetcalfe15@gmail.com') + '&description=Description&url=' + encodeURIComponent(thisurl) + '">📅</a>';
cps[jiicp].innerHTML+=' <iframe id="ice' + h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0] + '" src="about:blank" style="display:none;width:1px;height:1px;"></iframe><a title="Email and Create iCal Calendar Event ' + thist + '" target=_blank href="#" onclick=" var emtwo=prompt(' + "'" + 'Who do we email to?' + "','fillin@email.in'); document.getElementById('ice" + h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0] + "').src='" + thisc + "'.replace(/emailAddress/g, encodeURIComponent(emtwo)); window.open('" + thiscc + "','_blank'); \">➕</a>";
cps[jiicp].innerHTML+=' <a id="ee' + h1cps[iicp].innerHTML.split(' id="d')[1].split('"')[0] + '" title="Email iCal Calendar Event ' + thist + '" target=_blank href="#" onclick=" var em=prompt(' + "'" + 'Who do we email to?' + "','fillin@email.in'); window.open('" + thisc + "'.replace(/emailAddress/g, encodeURIComponent(em)),'_blank'); \">📧</a>";
jiicp+=3;
cps=document.getElementsByTagName('a');
}
}
}
}
}
</script>
<?php
if (isset($_GET['showtags'])) {
echo "<link href='//www.rjmprogramming.com.au/HTMLCSS/showtags.css' rel='stylesheet' type='text/css'>";
}
?>
</head>
<body onload=" checkonl(); setTimeout(initpostedoncc, 3000); sdescih(); widgetcon(); precc(); courseCookies(); cookie_fonts(); is_mentioned_by(); calendar_pass(); " <?php body_class(); ?>>
We hope you try out this WordPress TwentyTen themed blog functionality introduced with this code above.
Previous relevant Calendar iCal Integration Email Tutorial is shown below.
With yesterday’s Calendar iCal Integration Timezone Tutorial‘s emphasis on timezones, we turn our attention now, thinking of our web application as a “tool” and an integrated software product, to two interrelated issues …
- What does the future hold as far as using this Calendar “tool” (web application)? In other words, what software and/or operating system platforms will use it and in what way.
- How do we respond with this Calendar “tool” web application, fitting in with the requirements implicit in what the whole gammut of software and/or operating system platforms needing its services will need.
The most “asking” of “software and/or operating system platforms” that we can think of here is to cater for a mobile application WebView (please read here regarding Android WebView (using Eclipse or Android Studio IDEs) and iOS UIWebView (using Xcode IDE)) using the Calendar “tool” web application. Mobile platform WebViews can be programmed with Back and Forward navigation buttons, but that is not the ideal thing to rely on to get you out of a pickle that your web application may cause a mobile application WebView, if it navigates out to a place where there is no navigable return. The Back and Forward mobile application WebView buttons may work to return from a Calendar Event population event … honestly don’t know … but we’d prefer to cater for a new means by which such an “offshoot” feeling of navigation can be avoided. So in our new incarnation of the Calendar (event) web application we allow any/all of the following three modes of rjmprogramming-event.ics creation …
- Create iCal Calendar Entry
- Email (only) iCal Calendar Entry
- Create and Email iCal Calendar Entry
… where the second of those above would leave you, within the web application running within a mobile application’s WebView, not moving off the webpage you are on, and thus not falling foul of any “offshoot” navigation weaknesses (to the process).
This new emailing functionality, again only in serverside PHP (and not in clientside Javascript), is relatively easy to arrange by rearranging many of the PHP header statements and feeding that through to the PHP mail function to shoot off the email, given that the user, ahead of time, has supplied you with that filled in email address, which we also attend to today.
Our web application has, in two separate areas of the code, made use of an HTML select element’s child option elements’ title properties to contain useful information for the web application’s workings. We’ll show you below some code to access the information stored from such an arrangement …
<select onchange='document.getElementById("subb").value=this.options[this.selectedIndex].title;' id='emode' name='emode'><option title='Create iCal Calendar Entry' value='Address'>Address</option><option title='Email (only) iCal Calendar Entry' value='To'>Email To (only)</option><option title='Create and Email iCal Calendar Entry' value='AndTo'>Email To (as well)</option></select>
… and you might wonder about the destination for the HTML option title property storage here? We use it to rename our HTML form’s input type=submit button that fires off the callback message. The “guises” of our one HTML input type=submit thus have a one to one correspondence with the values on that HTML select (dropdown) element, and with that list of “modes of output” we showed above. This is our approach to this today, but there are other approaches to such requirements regarding HTML form element HTML input type=submit element arrangements, and you may prefer to use multiple forms and/or multiple input type=submit buttons as we talk about with the series of blog posts finishing, so far, with HTML Multiple Form Multiple Submit Buttons Primer Tutorial.
Actually yesterday we prepared for another eventuality down the road of usefulness for this web application, but before we tell you about that, what we’d encourage you to do yourself should you put such a Calendar (event) web application into production is, interface your data flow not with $_POST[] (nor $_GET[] … damn, gave away the secret) but we’d prefer you to have it be that data in and out, as required, is stored in a secure database of some sort, for security purposes. But back to our (not very well kept) secret, yesterday, we prepared the ground for the web application (callback functionality) to be accessible via PHP $_GET[] arguments.
So, sorry not to have moved off “tool” (web application) work today, but it is very important to try to think of most/all eventualities you can imagine, ahead of the time when you get to the integration tasks the other way around, that is, the integration from the viewpoint of the software acting as “parent” or “co-operative peer” to your Calendar (event) “tool” web application.
The reshaped PHP code now additionally catering for email “messaging” functionality you could call ics_attachment.php, which changed in this way, able to be run with this live run link. We hope you try out the new email functionality yourself.
Previous relevant Calendar iCal Integration Timezone Tutorial is shown below.
You might have thought with yesterday’s Calendar iCal Integration Primer Tutorial‘s emphasis on timezones we’d have …
- had too much
- seen too little
- invited Goldilocks for some porridge
… but time is quite a complex scenario on Earth, when it comes to timezones for at least two reasons, one being a functional improvement, and one being to fix a bug, that being …
- things like WebEx or Skype or GoTo Meeting are not tied down by geography and you may want Calendar functionality to reflect this, or you may also want it to cater for airplane departure and arrival times in various timezones around the world, and it would be best if the HTML form user entry phase catered for a user specifying a date and time not necessarily in either of their local timezone nor the GMT timezone (of the iCal “Z” property special interest) … is the functional improvement, whereas …
- we had a bug, leaving off from yesterday’s work with timezones whose GMT offset involved half hour differences … and yes, that happens quite often … and the bug will occur as of yesterday’s code when you come to use those PHP DateTime object add and/or sub methods where the PT[offset]H argument has an [offset] involving a decimal point, so it behoves us to update that relevant PHP code snippet for you, again, below, regarding that (and remind … forgot yesterday … that $ts variable is a user HTML form passed date and time) …
$di="PT" . str_replace("-","",("" . $start_end_offsets[$thisi])) . "H";
$parsed_date = DateTime::createFromFormat('Ymd:His', $ts);
if (strpos(("" . $start_end_offsets[$thisi]), "-") !== false) {
if (strpos($di, ".") !== false) {
$parsed_date->sub(new DateInterval(explode(".",$di)[0] . "H"));
$parsed_date->sub(new DateInterval("PT30M"));
} else {
$parsed_date->sub(new DateInterval($di));
}
} else {
if (strpos($di, ".") !== false) {
$parsed_date->add(new DateInterval(explode(".",$di)[0] . "H"));
$parsed_date->add(new DateInterval("PT30M"));
} else {
$parsed_date->add(new DateInterval($di));
}
}
$outts = $parsed_date->format('Ymd:His');
Now allowing for the first idea above is not as involved as you may think, but only if you think serverside PHP, rather than think it will be easy with clientside Javascript. And what makes it a doddle, generally, are all those Open Source contributors to knowledge out there, and those great computing program language documenters out there exemplified in their brilliance with this totally useful link to the PHP timezone_identifiers_list and PHP DateTimeZone object method getOffset method links. So we allow the user to enter any of …
- Local
- GMT
- Any of the half hour timezone numerical offset (indicators) from -24 to 24
- Any of the timezone names as per those PHP methods above, with valid continental prefix names
… to define the start and end date and time parameters to express for their Calendar iCal Event that they define. Along the way we also add in dropdowns and HTML input type=number (year) elements to help for those not so keen on keyboard entry.
Guess you’d say we are still on the “tool” feel of the web application, but aim to move more on the “integration” front into the future.
Here is the renewed PHP code you could call ics_attachment.php, that changed in this way, able to be run with this live run link. We hope you try it out for yourself, especially as we’ve added some Google Chart Map Chart linking of the “when” and “where” of defined timezone thinking, via the use of PHP’s DateTimeZone object method getLocation, as you can see happening with today’s tutorial picture.
Previous relevant Calendar iCal Integration Primer Tutorial is shown below.
Do you remember us talking about the ICS extension file when we presented WebEx Prerecording Primer Tutorial as shown below? It is an integration input to working with iCal Calendar software.
So here we are at a “when” of life tutorial, which is always an interesting exercise in our book. And “book” could be the go for an application to use this type of functionality. When you “book” something, you’d often want to remind yourself and/or others of such an event. But for now, we are concentrating on making a “tool” type of web application that will suit future purposes.
We’ve built a web application around the useful logic presented in this great Git repository today, writing our code in PHP, because you are dealing with header manipulation here centering around …
header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename=rjmprogramming-event.ics');
echo $ical;
… where the PHP variable $ical contents has been pieced together in response to a callback from an earlier HTML form execution of the same ics_attachment.php code where the necessary details are collected off the user.
If you try the live run you’ll probably glean that most of our concern centered around the date and time, regarding timezone use so that we …
- in the HTML form execution we use client Javascript to glean the local timezone and local date and time to default the form appropriately … so that …
- in the HTML form execution the user fills out Calendar Event start and end times with respect to local time and this, along with an offset to get these times back to UTC or (Greenwich Mean Time) are passed to the callback web application (which is the same web application) … so that …
- the second callback execution constructs the iCal (for an rjmprogramming-event.ics attachment) with these UTC (or GMT) date and times in mind, whereby the “Z” timezone parameter fits the bill nicely … and when …
- the user saves this rjmprogramming-event.ics event into the iCal Calendar application, where the event will be shown back relative to the local date and time
The date and time functions used to make this happen are …
- Javascript’s Date object …
var dd=new Date();
var qw=eval((eval(dd.toTimeString().replace('-',' ').replace('+',' ').split(' ')[2]) - eval(dd.toTimeString().replace('-',' ').replace('+',' ').split(' ')[2] % 100)) / 100) + eval((0.0 + eval(dd.toTimeString().replace('-',' ').replace('+',' ').split(' ')[2] % 100)) / 60.0);
if (dd.toTimeString().indexOf('+') != -1) qw=-qw;
document.getElementById('tz').value=qw;
- Javascript’s Date object’s toTimeString method (as shown above) to glean the local timezone offset, and its opposite
- PHP’s DateTime object …
$di="PT" . str_replace("-","",urldecode($_POST['tz'])) . "H";
$parsed_date = DateTime::createFromFormat('Ymd:His', $ts);
if (strpos(urldecode($_POST['tz']), "-") !== false) {
$parsed_date->sub(new DateInterval($di));
} else {
$parsed_date->add(new DateInterval($di));
}
$outts = $parsed_date->format('Ymd:His');
- PHP’s DateTime object’s createFromFormat constructor method (as above) to create a DateTime object from the passed through user details
- PHP’s DateInterval object
- PHP’s DateTime object’s add and/or sub methods (as above) to create a DateTime object with a DateInterval offset to UTC (or GMT) (expressed in hours)
- PHP’s DateInterval object’s format method (as above) to end up with a UTC (or GMT) expression of date and time to be placed into the rjmprogramming-event.ics iCal message
We’ll probably be revisiting with improvements soon, but we hope you try it for yourself.
Previous relevant WebEx Prerecording Primer Tutorial is shown below.
We’ve been trying out WebEx (by Cisco) prerecording as a video conferencing idea as an alternative to …
- GoToMeeting (by Citrix) we talked about with GoToMeeting Primer Tutorial
- Skype (by Skype and now Microsoft) we talked about with Skype Primer Tutorial
… regarding video conferencing products we’ve tried at this blog.
Have to say, WebEx is great, even with respect to the “wide eyed and bushy tailed” reaction “this little black duck” has to all these networky communicaty ideas on the net (at least we spelt “net” correctly).
Have to thank my wife, Maree, for her expertise and the facilities her company, Thomson Reuters, supplies for the serving of WebEx recordings … thanks everyone. Have been assured they are periodically deleted, and my lame impersonations of the old “ducks on the wall” can rest in peace shortly.
And so, we have a slideshow starting with a WebEx email link to join a meeting, and we pan down the email to show you other WebEx functionalities, such as adding a Calendar reference to the meeting time, and though we haven’t shown you detail here, rest assured it handles timezone scenarios very well, unless you lie about living in Antarctica, that is … sorry, scientists in Antarctica reading this blog posting … all 237 of you.
During this “earlier than today exploration of WebEx” session the necessary software installs just happened for this MacBook Pro Mac OS X laptop as if we were shelling peas … it’s always good to have some handy when installing any software. So we won’t show you this unless we deem it essential at a later date. You can perhaps do as I did, and ask a real WebEx user invite you to a meeting, to set yourself up. In fact, today’s session meeting creation time you may notice is well in the past from that earlier introductory learning session Maree and I had, and you can bring back up that old email, and resurrect that meeting again and again, if you like … am not sure if there is an expiry date on this too, like with server stored WebEx prerecordings.
So also rest assured, WebEx handles …
- video via webcam on your device
- audio via microphone on your device (“Use Computer”) or via a phone line
- the synchronization of the two above
- mobile devices
Did you know?
A .ics extension file, as you can see being used as an email attachment file extension in is, as explained in this link‘s sublink …
ICS is a global format for calendar files widely being utilized by various calendar and email programs including Google Calendar, Apple iCal, and Microsoft Outlook. These files enable users to share and publish information directly from their calendars over email or via uploading it to the world wide web.
… as helping interface meetings to online calendar appointments. Cute, huh?!
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.