I'm combining my old website with zenphoto using zenpage. I have a custom video viewing area that uses ajax and javascript to load the next video. You can see this working here (it's the Home Theater): http://schafli.com/oldsite2009/
To integrate this into zenphoto I used Pages and inserted most of the code into the code block field. Then I went on the backend and opened themes/zenpage/pages.php and inserted the script into the section. It does not work. You can see the result here:
http://schafli.com/index.php?p=pages&title=weclome-to-the-schafli-family-website-
What am I doing wrong?
The script I am using is from DynamicDrive and can be found here:
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
Without detailed investigation the most likely issue is JavaScript conflicts. Zenphoto makes extensive use of jQuery as its script support library. If you have a debug console with your browser it may show you JavaScript errors. But how to fix them is more of a problem.
Best would be to find a jQuery based script that does what you want.
You know what? It is a jquery based script...
Here it is:
/***
var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""
function ajaxpage(url, containerid){
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.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}
function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}
function loadobjs(){
if (!document.getElementById)
return
for (i=0; i
That script is actually not jQuery based but plain JavaScript. It also seems to be using ActiveX which is a Microsoft specific thing that you should not use nowadays as it only works in Internet Explorers anyway (if the plugin is installed). Therefore your old sit is not working for me.
You will hopefully understand that it exceeds the forum possibility a bit to check any third party script and such specific usages.
You get this error: [i]The requested URL /ajaxpage('/Videos/pleasant.html', 'videoarea'); was not found on this server.[/i] So the page you are trying to call is not where it is expected.
Where do the videos come from? Selfhosted? What format? I guess you might need to update your knowldege about videos on the web. A lot has changed the last years.
Got it to work with Jquery. Thank you. For anyone who's interested, here's the raw but complete markup:
$(document).ready(function(){
$("a.video").click(function(){
$("#div1").load($(this).attr('href'));
event.preventDefault();
});
});
You can start off with content in this div! It will be replaced, when you
click on one of the links below!
Get External Content
Get External Content2
Thanks. Also, I got my original script to work as well... I moved the directory I was trying to link to out of themes/zenpage/ and placed it in my root directory. That's when it started to work. Unfortunately that simple fix wasted at least 15 hours of my time.