Link to home
Start Free TrialLog in
Avatar of photoman11
photoman11Flag for United States of America

asked on

What Is Your Opinion of a PHP to JavaScript Converter?

Hi EE,

Not being very technical (quite an understatement) and only being marginally familiar with JavaScript, I would like to get your opinion on something:

I want to run a PHP script on my website but the company hosting it does not allow PHP to be loaded. Please don't suggest changing hosting companies, because that is a long and separate discussion.

For sake of argument, let's assume that I cannot change companies. I was doing some searching on Google for "PHP to JavaScript Converter" and ran across the following:

http://www.harmony-framework.com/

Can you please supply a an opinion on what you think of the above approach; the PHP to JavaScript converter concept as a whole; and in the converter that you have found which works the best?

Your help in this matter is greatly appreciated.
SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of photoman11

ASKER

As far as me having knowledge of one language, let alone two, I think I would have more luck teaching pigs to fly.

On a more practical note, here is the sales page for the product that I am talking about which produces a PHP script: http://www.exitsplash.com/

I provided the link here because this would give you a much better idea of what I am looking to do than I can possibly explain. Exit Splash could come off as simply an elaborate POP-UP page creator, however when combined with all of his templates and approaches, etc. my understanding (although not complete, I will admit) is that it is far more than that.

I think part of the reason why his package is so powerful is that it includes the integration of some of the bonuses he is offering, into the main product.

Anyway, that's the gist of it, so if you are aware of any Java scripts that can produce things like this without being blocked by pop-up blockers, please let me know. I would be extremely interested!
Avatar of joep1978
joep1978

Here's the code from his page.  It should work if you copy and paste it in - it's just Javascript generated by PHP


var exitsplashalertmessage = '***************************************\n\n         > > > W A I T < < <\n\n     CLICK THE ***CANCEL*** BUTTON\n    on the NEXT Window for Something\n             VERY Special!\n\n***************************************';
var exitsplashmessage = '***************************************\n\n W A I T   B E F O R E   Y O U   G O !\n\n  CLICK THE *CANCEL* BUTTON RIGHT NOW\n     TO STAY ON THE CURRENT PAGE.\n\n I HAVE SOMETHING VERY SPECIAL FOR YOU!\n\n***************************************';
var exitsplashpage = 'http://www.exitsplash.com/exit/exit.php?hop=ehotitems';
 
function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); }  func(); }}}
function addClickEvent(a,i,func) { if (typeof a[i].onclick != 'function') { a[i].onclick = func; } }
var theDiv = '<div id="ExitSplashDiv"  style="display:block; width:100%; height:100%; position:absolute; background:#FFFFFF; margin-top:0px; margin-left:0px;" align="center">';
theDiv = theDiv + '<div id="ExitCancelButtonImageDiv" style="background: #FFFFFF; width: 100%;" align="left"><img src="http://exitsplash.s3.amazonaws.com/files/exitimpactimage.gif?exit49f4f3a2c2316" border="0"></div>';
theDiv = theDiv + '<div onmouseover="this.style.background=\'#FFFFFF\'; document.getElementById(\'exitsplashlink\').style.color=\'#0000FF\'" onmouseout="this.style.background=\'#3399cc\'; document.getElementById(\'exitsplashlink\').style.color=\'#FFFFFF\'" style="padding-top:0px; padding-left:0px; margin-top:0px; margin-left:0px; background:#3399cc; width: 100%; height: 22px; text-align:right;"><span style="font-family:tahoma; font-size:12px; font-weight:bold; color:#3399cc">Increases Website Response by up to 325% in 3 days! CLICK HERE ==&gt;</span>&nbsp;&nbsp;<a href="http://www.exitsplash.com" target="_blank" style="text-decoration:none;"><span id="exitsplashlink" style="font-family:tahoma; font-size:12px; font-weight:bold; color:#FFFFFF">Powered by ExitSplash</span></a>&nbsp;&nbsp;&nbsp;</div>';
theDiv = theDiv + '<div id="exitsplashimpactaudio"><embed wmode="transparent" src="http://exitsplash.s3.amazonaws.com/player.swf?url=http://exitsplash.s3.amazonaws.com/files/exitsplash.mp3&mode=play&autostart=true&exit49f4f3a2c2316" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1" height="1"></embed></div>';
theDiv = theDiv + '<iframe src="'+exitsplashpage+'" width="100%" height="100%" align="middle" frameborder="0"></iframe>';
theDiv = theDiv + '</div>';
theBody = document.body; if (!theBody) {theBody = document.getElementById("body"); if (!theBody) {theBody = document.getElementsByTagName("body")[0];}}
var PreventExitSplash = false;
function DisplayExitSplash(){ if(PreventExitSplash == false){ window.scrollTo(0,0);  PreventExitSplash=true; divtag = document.createElement("div"); divtag.setAttribute("id","ExitSplashMainOuterLayer"); divtag.style.position="absolute"; divtag.style.width="100%"; divtag.style.height="100%"; divtag.style.zIndex="99"; divtag.style.left="0px"; divtag.style.top="0px"; divtag.innerHTML=theDiv; theBody.innerHTML=""; theBody.topMargin="0px"; theBody.rightMargin="0px"; theBody.bottomMargin="0px"; theBody.leftMargin="0px"; theBody.style.overflow="hidden"; theBody.appendChild(divtag); return exitsplashmessage; } }
var a = document.getElementsByTagName('A'); for (var i = 0; i < a.length; i++) { if(a[i].target !== '_blank') {addClickEvent(a,i, function(){ PreventExitSplash=true; });} else{addClickEvent(a,i, function(){ PreventExitSplash=false;});}}disablelinksfunc = function(){var a = document.getElementsByTagName('A'); for (var i = 0; i < a.length; i++) { if(a[i].target !== '_blank') {addClickEvent(a,i, function(){ PreventExitSplash=true; });} else{addClickEvent(a,i, function(){ PreventExitSplash=false;});}}}
hideexitcancelbuttonimage = function(){ document.getElementById('ExitCancelButtonImageDiv').style.display='none'; }
addLoadEvent(disablelinksfunc);
disableformsfunc = function(){ var f = document.getElementsByTagName('FORM'); for (var i=0;i<f.length;i++){ if (!f[i].onclick){ f[i].onclick=function(){ PreventExitSplash=true; } }else if (!f[i].onsubmit){ f[i].onsubmit=function(){ PreventExitSplash=true; }}}}
addLoadEvent(disableformsfunc);
window.onbeforeunload = DisplayExitSplash;

Open in new window

Joep,

Well, I inserted the other could end to one of my test pages and the result was not terribly good. I'm attaching a code snippet with some of what displayed on the page.

I don't know enough about this to know whether I am supposed to do something to the code before inserting it in my page or not so that could cause the issue. Like I said, this is as foreign to me as teaching a lizard to dance.
 var exitsplashalertmessage = '***************************************\n\n > > > W A I T < < <\n\n CLICK THE ***CANCEL*** BUTTON\n on the NEXT Window for Something\n VERY Special!\n\n***************************************';var exitsplashmessage = '***************************************\n\n W A I T B E F O R E Y O U G O !\n\n CLICK THE *CANCEL* BUTTON RIGHT NOW\n TO STAY ON THE CURRENT PAGE.\n\n I HAVE SOMETHING VERY SPECIAL FOR YOU!\n\n***************************************';var exitsplashpage = 'http://www.exitsplash.com/exit/exit.php?hop=ehotitems';
 
function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); }}}function addClickEvent(a,i,func) { if (typeof a[i].onclick != 'function') { a[i].onclick = func; } }var theDiv = '
';theDiv = theDiv + '
';theDiv = theDiv + '
Increases Website Response by up to 325% in 3 days! CLICK HERE ==> Powered by ExitSplash
';theDiv = theDiv + '
';theDiv = theDiv + '
 
(in addition I received some messages like these:)
 
Error: Execution of this script not permitted

Open in new window

Sorry, I had a play with this code and it seemed to work but it's a horrible, spammy script and I kept getting tons of popups opening so I hope you understand I don't really want to work too much on it :)

The code listed is the actual script from ExitSplash and it should work with no need for PHP.  You will need to modify the first three lines to fit your site and then paste it into a Javascript file.  You should then be able to include this Javascript file on a HTML file on your server
Joep,

I completely understand. Thanks for your effort. I'm clueless as to what would need to be done, so it's probably best to let this die quietly for now.
thanks for everything, guys.
Thanks for the assist and the points.

Good luck & have a great day