Call php file form .tpl

Hi,
I use some JS on payment.tpl but when client side JS is disable then I have to make those JS into simple buttons where they post every data onto same page and then I get those data.

But I dont know how to make if condition for this.

like this in any .tpl file, read my code as in smarty.

if(javascript enabled) {
run this code
}
else {
run this code
}

Anyone to help me out please?

Cheers!!!

I just call what I need, but when I give the path http.open(“GET”, “jsenabled.tpl”, true);. The AJAX code what I used when JAVASCRIPT is enable. It append the file on DIV called foo.

<script type=“text/javascript”>
var http = false;

  			if(navigator.appName == "Microsoft Internet Explorer") {
  			  http = new ActiveXObject("Microsoft.XMLHTTP");
  			} else {
  			  http = new XMLHttpRequest();
  			} 
  			
  			function ifJSenable() {
  			  http.open("GET", "jsenabled.tpl", true);
  			  http.onreadystatechange=function() {
  				if(http.readyState == 4) {
  				  document.getElementById('foo').innerHTML = http.responseText;
  				}
  			  }
  			  http.send(null);
  			}
  			 ifJSenable()
  		&lt;/script&gt;

then OXID gives me an error

Access forbidden!

You don’t have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.
Error 403
localhost
01/10/11 13:02:01
Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9

And if I make that file extension php,html then it displayed like core HTML not as samrty.

Any suggestions!!!

When I give file extension .html or .php then it puts that code simply as HTML no samrty no .css nothing.

Hurrey guys…

I got the solution and its very simple.

:slight_smile:

would you mind sharing it for other users which may have a similar issue in future?

[QUOTE=Hebsacker;47993]would you mind sharing it for other users which may have a similar issue in future?[/QUOTE]

I does it with JS. I just active DIV and deactivate DIV just.

I dont know about <noscript>, it is also useful for when JS is disable.