All in One Dynamic Script both ASP and PHP into one html file it simple but interesting technique moreover it can use for insert a little ASP or PHP script into html file.
This is method to run both ASP and PHP in one page by using javascript. When we want to use dynamic script in html file.There is 3 ways to do this
1.Using <iframe> tag
2.Call by SSI (Server Side Include)
3.Javascript
This article I use javascript because It can support all browser,now you can follow me to do this
1.filePHP.php
PHP Code:
<?php $word="This is way to"; ?>
document.write("<?php echo $word; ?>");
*remark - don't have this tag( <!-- Comment --> , " ,\n ) in file.If you want to use \n you can replace with <br>.
2.fileASP.asp
PHP Code:
<%
Dim word
word = " include ASP and PHP"
%>
document.write("<%= word %>");
*remark - don't have this tag( <!-- Comment --> , " ,\n ) in file.If you want to use \n you can replace with <br>.
3.dynamic.html
PHP Code:
<script language="Javascript" type="text/javascript" src="filePHP.php"></script>
<script language="Javascript" type="text/javascript" src="fileASP.asp"></script>