Login
·
Signup
Home
»
XtGem
»
Coding help
»
How Display forum blog message in home page of site
» View post
Graham
Rajsurya
This is a test of a script for displaying a forum thread on the home page using XHR javascript
If XHR is not supported normal forum should load
<div id="content" class="xt_container" style="display:none"> <!--content--><xt:forum /><!--content--> </div>
And then this
<script> var thisPath = window.location.pathname; // Adjust path to suit if (thisPath == "/" || thisPath == "/index" && typeof ( new XMLHttpRequest())!=undefined){ // Change this for your own url newPath = "/index/__xt/test/thread-oon8wg4ki2cqrt9e1bcdih8qa4ec2wkln9y1.html"; function loadContent(){ var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function(){ if (this.readyState == 4 && this.status == 200){ var content=this.responseText.split("<!--content-->"); document.getElementById("content").innerHTML = content[1]; document.getElementById("content").style.display = "block";}} xhttp.open("GET", newPath, true); xhttp.send();} loadContent();} else{ document.getElementById("content").style.display = "block";} </script>
DEMO
http://banana.madpath.com/
#
2018-02-08 20:14 ·
(0)
Home
»
XtGem
»
Coding help
»
How Display forum blog message in home page of site
» View post
Online: Guests: 1
Log in