Jump to content

Calling Outside pages & Scripts


Heritage1

Recommended Posts

I've come up with this little script code for calling outside pages, and/or scripts. There is no Need to fill up the Admin pages section in phpvms anymore. You can create any html page, php, or even a graphic with this little script. Its very simple, fast an doesn't bog down the layout.php page what so ever. I use it hardcore for calling my own custom html or php files within my sites.

For those who are even just a little advanced, there is NO limit to what you can create, I use a sub-directory "pages", and/or whatever you decide to call your custom files. As long as the directory is within the folder where your phpvms lives, then again, there is no limit.

You do not have to worry about multiple pages within the Admin section of phpvms anymore. just call your outside custom script/pages.

Thats it. Its very very simple. The biggest thing is making sure you place the call just before the closing of the </head>. It will not work any other way. Then after doing so, you can place the call for the actual file anywhere in the <body> area you'd like. Below is the code snippet, please read the comments carefully, and enjoy. This works great for me. Hope you guys get some use out of it, I know I do.

Jimbo

ceo@heritageva.net

=========================================================================================================

<!--Insert into the layout.php file first before calling any outside scripting
Below initializes the call functions.This also MUST be in between the
<head>HERE</head>. NOT the <body> See below for calling your outside pages.-->

<!-- start call outside scripts-html etc pages-->
<script type="text/javascript">
var rootdomain="http://"+window.location.hostname
function ajaxinclude(url) {
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.open('GET', url, false) //get page synchronously
page_request.send(null)
writecontent(page_request)
}
function writecontent(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
document.write(page_request.responseText)
}
</script>
<!-- end of call outside scripts initializing coding. by Jungle-->
<!--/==============================================================================/-->
<!--How to call your pages ! Place in <body> only, anywhere you feel it functions good.
Do not enter a named domain, the (rootdomain makes the script call, just add the
folders as example below-->
EXAMPLE::::
<script type="text/javascript">
ajaxinclude(rootdomain+"/hva/core/pages/imenu.html") <!--you can call anything!-->
</script>


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...