Iframe integration procedure and code V2

User avatar
axew3
w3all User
w3all User
Posts: 2707
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Iframe integration procedure and code V2

Post by axew3 »

New procedure, files and code released, check it here:
https://www.axew3.com/w3/2018/09/wordpr ... -embed-v2/
User avatar
axew3
w3all User
w3all User
Posts: 2707
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Redirect email notification links to iframe via Javascript

Post by axew3 »

Hi there lovely and cool people! Waiting for next steps, and doing something else, i would like to post the procedure as memo for when this will be added into documentation and (presumably) overall_footer.html js will be little changed to avoid the change also into page-forum, as is on this procedure example. Do not worry, the joke as will be rewrite soon, will be even more easy to apply.

So here the hint/memo on fly, to achieve the javascript redirect Just a preview how to of what will be.

open your overall_header.html
and where this code:

Code: Select all

<!-- IF S_ENABLE_FEEDS -->
or by the way, as soon is possible, inside <head> </head> tags, add the following code:

Code: Select all

<script>
// START w3all redirect to iframe
(function() {
var r = window.location.href.indexOf("iframe=");
   if(r > 0){ // avoid a loop
    var red0 = window.location.href.split('/');
    var u = red0[red0.length-1].replace("iframe=true&","");
    var red1 = window.btoa(unescape(encodeURIComponent(u)));
    var red2 = 'https://localhost/mysite/forum/?w3=' + red1;
    window.location.replace(red2);
  }
})();
// END w3all redirect to iframe
</script>
on code added change

Code: Select all

var red2 = 'https://localhost/mysite/forum/?w3=' + red1;
to fit your needs. It need to point to your wp iframed phpBB page, so may something like this:

Code: Select all

var red2 = 'https://mysite.com/wordpress/board/?w3=' + red1;
Note https://mysite.com/wordpress/board
that point to wordpress iframed wordpress page.
Save, remember to recompile phpBB template.

Now open your page-forum.php on your active template folder (or page-board or whatever named) and search for this code:

Code: Select all

if( isset($_GET["w3"]) ){
 $phpbb_url = base64_decode($_GET["w3"]);
 $phpbb_url = trim(utf8_encode($phpbb_url));
	 if( preg_match('/[^-0-9A-Za-z\._#\:\?\/=&%]/i',$phpbb_url) ){
    $w3all_url_to_cms = $w3all_url_to_cms;
   } else {
	   $phpbb_url = substr($phpbb_url, 1);
	   $w3all_url_to_cms = $w3all_url_to_cms . "".$phpbb_url."";
    }
}
change with this:

Code: Select all

if( isset($_GET["w3"]) ){
 $phpbb_url = base64_decode($_GET["w3"]);
 $phpbb_url = trim(utf8_encode($phpbb_url));
	 if( preg_match('/[^-0-9A-Za-z\._#\:\?\/=&%]/i',$phpbb_url) ){
    $w3all_url_to_cms = $w3all_url_to_cms;
   } else {
   	 if($phpbb_url[0] != '/'){
   	 	  $w3all_url_to_cms = $w3all_url_to_cms . "/" . "".$phpbb_url."";
       } else {
	      $phpbb_url = substr($phpbb_url, 1);
	      $w3all_url_to_cms = $w3all_url_to_cms . "".$phpbb_url."";
	   }
    }
}
Now it is necessary to add the needed var on phpBB email template files sent out as explained on this article:
https://www.axew3.com/w3/2017/04/wp-w3a ... me-how-to/
NOTE: NOT CONSIDER on the article, as may obvious, the part about .htaccess, (remove it if previously using, by apply this js way) but just the example on how to edit phpBB notification email template files, adding the needed var and related value: iframe=true

Cheers to all cool people ;)
User avatar
axew3
w3all User
w3all User
Posts: 2707
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Iframe integration procedure and code V2

Post by axew3 »

Ops! Javascript code to add on overall_header.html has been little changed this morning because containing wrong value, example code mixed with the code used for a site where i'm working on --- sorry guys

just an occasion to explain what can may be obvious: the var iframe=true can be whatever you like so may
ifr=1if you change this on js code.
Just change to fit the same on: js overall_footer.html code in case, and into phpBB email templates files, in accord to what you choose to change in.
Post Reply