PDA

View Full Version : Extracting Tabbed Document Viewer URL for use with PHP



Shawn
01-19-2006, 12:31 AM
Hi, I'm trying to build an easier way to browse the content of PubMed/MEDLINE. I'd like to somehow extract the URL being displayed in the Tabbed Document Viewer (http://www.dynamicdrive.com/dynamicindex3/tabdocviewer.htm) so that it can be manipulated with a PHP script. The initial URL in the Tabbed Document Viewer would be http://www.nlm.nih.gov/mesh/2006/MeSHtree.html and users could then click on a Medical Subject Heading. When a subject heading is clicked on, the PHP script would output recent citations for the heading underneath the Tabbed Document Viewer. I'm sure that there's a simple way to do this, so I'd appreciate your help.

Twey
01-19-2006, 08:49 AM
It's in the "selectedtablink" Javascript variable.

Shawn
01-20-2006, 10:24 PM
I need to know how to convert the selectedtablink variable into a variable that I can use with PHP.

Twey
01-21-2006, 10:46 AM
Now there's a tricky one. To send it server-side, you'll need to submit a form with an element the value of which has been set to selectedtablink. This is a bit inelegant. You could also use AJAX:
function getHTTPObject() {
var httpobject = null;
try {
httpobject = new XMLHttpObject();
} catch (e) {
try {
httpobject = new ActiveXObject("Msxml2.DOMDocument");
} catch (e) {
try {
httpobject = new ActiveXObject("Msxml.DOMDocument");
} catch (e) { }
}
}
if(typeof httpobject.load == "undefined") httpobject = null;
return httpobject;
}

function touchPage(page) {
var xho = getHTTPObject();
if(xho == null) return;
xho.open("GET", page, true);
xho.send(null);
}Then, add
touchPage("mypage.php?url=" + selectedtablink); to the bottom of the handlelink() function (but before return false;). This will call a PHP page, from which you can then grab the "url" GET parameter and use it in whatever odd rituals you may wish to.

Shawn
01-23-2006, 11:48 PM
Thanks for the suggestion. That route turned out to be much too difficult to bother with, so I used a combination of two iFrames instead (based on the suggestions at http://www.samisite.com/test-csb2nf/id82.htm).