Page 1 of 2
Strange but True
Posted: Thu May 08, 2003 11:30 am
by jkmcgrath
Ok check this out.
Code: Select all
<html>
<head>
<title>New Page 1</title>
</head>
<body>
<?php include("http://mo-avcrad-fs01/invision/ssi.php?a=lasttopics"); ?>
<?php include("http://mo-avcrad-fs01/invision/ssi.php?a=stats"); ?>
<?php include("invision/hitsfile.txt"); ?>
</body>
</html>
I save as test.php go to it in the browser and I get "10" which is in the hitsfile.txt but nothing else at all.
I can take each of the include addresses and put them in address bar and they display as should be.
This is on IIS5 so I dont know if that has anyting to do with it or not. PHP v4.2.3.
Any ideas why the php includes will not show but the txt does?
Thanks
John
Posted: Thu May 08, 2003 11:49 am
by volka
that's not a valid url. What are you trying to do?
Intranet
Posted: Thu May 08, 2003 11:53 am
by jkmcgrath
That is a url to my units intranet server.
Posted: Thu May 08, 2003 11:59 am
by volka
ok, then it's difficult for me to test

if you put
Code: Select all
<?php error_reporting(E_ALL); ini_set('display_errors', TRUE); ?>
before the first include block is there any error raising?
What if you do the same in ssi.php (for debug purposes only).
If you enable the access-log on \\mo-avcrad-fs01's IIS (but I forgot where this setting was) does the request show up there?
ahhhhhhh
Posted: Thu May 08, 2003 12:04 pm
by jkmcgrath
Warning: Failed opening '
http://mo-avcrad-fs01/invision/ssi.php?a=lasttopics' for inclusion (include_path='.;c:\php4\pear') in c:\inetpub\wwwroot\test.php on line 28
Warning: Failed opening '
http://mo-avcrad-fs01/invision/ssi.php?a=stats' for inclusion (include_path='.;c:\php4\pear') in c:\inetpub\wwwroot\test.php on line 29
So that is an issue in my php.ini correct?
In the end this is for trying to get a javascript variable to run which I will post once I have this resolved.

Posted: Thu May 08, 2003 12:08 pm
by volka
either it's not able to resolve the host's name or url_wrappers might be disabled.
http://www.php.net/manual/en/ref.filesy ... -url-fopen
IIRC it effects include(),require(),... as well
Still no luck
Posted: Thu May 08, 2003 2:11 pm
by jkmcgrath
I still havent gotten it to work. It is a setting in the php.ini I am sure and I will find it some day lol
BUt in the mean time I can use iframes to get around it
But here is the javascript problem I am having.
I have read the sticky topcs on this subjuect pluys many others but still cannot get it right.
Code: Select all
<script language"javascript" src="scroll.js" type="text/javascript"></script>
<html>
<head>
<title>New Page 1</title>
<style type="text/CSS">
.scrollClass {
text-align:center;
font:normal 8pt Arial,sans-serif;
}
</style>
</head>
<body onLoad="scroller1.scroll();">
<?php
error_reporting(E_ALL); ini_set('display_errors', TRUE);
$test = "test";
?>
<?PHP echo '<script language"javascript" type="text/javascript">
<!--
test = <?PHP echo($test);?>
var scroller1 = new scrollObject("scroller1", "MainName", 120, 120, "white", 1, 60, 30, 0, "scrollClass");
scroller1.blockї1] = "<iframe src=http://mo-avcrad-fs01/invision/ssi.php?a=stats width=150 height=300 frameborder=0></iframe>";
scroller1.blockї1] = "<iframe src=http://mo-avcrad-fs01/invision/ssi.php?a=lasttopics width=150 height=300 frameborder=0></iframe>";
scroller1.blockї2] = "<iframe src=http://mo-avcrad-fs01/invision//ssi.php?a=active width=150 height=300 frameborder=0></iframe>";
scroller1.blockї3] = "'document.write(test)'";
scroller1.blockї4] = "Easy to configure, easy to run, with content automatically centred horizontally and vertically";
scroller1.blockї5] = "Have any number of block scrollers running on a single page all with a single JavaScript";
scroller1.blockї6] = "View the source for more info!";
//-->
</script>'
?>
<?php include("http://dfseals.net/invision/ssi.php?a=lasttopics"); ?>
<?php include("http://mo-avcrad-fs01/invision/ssi.php?a=stats"); ?>
<?php include("invision/hitsfile.txt"); ?>
<iframe src="http://mo-avcrad-fs01/invision/ssi.php?a=lasttopics" width="150" height="300" frameborder="0"></iframe>
<div id="MainName">
The contents of this block will be displayed if the browser does not support the scroller.
It will be overwritten if the scroller is supported.
</div>
</body>
</html>
I have tried several ways to pull the variable out of php so it will show up in a scrolling block but no luck on that either.
Any ideas on this one?
Here is the scroller.js code
Code: Select all
var scObj1 = new scrollObject("scObj1", "sMain", 120, 120, "white", 1.45, 3, 30, 5000, "scrollClass");
scObj1.blockї0] = "This is block 1";
scObj1.blockї1] = "This is block 2, which appears five seconds later";
scObj1.blockї2] = "Blocks can contain any HTML including:";
scObj1.blockї3] = "Images, tables, links and more";
scObj1.blockї4] = "Easy to configure, easy to run, with content automatically centred horizontally and vertically";
scObj1.blockї5] = "Have any number of block scrollers running on a single page all with a single JavaScript";
scObj1.blockї6] = "View the source for more info!";
var scObj2 = new scrollObject("scObj2", "sMain2", 60, 468, "aliceblue", 1.44, 3, 30, 3000, "scrollClass");
scObj2.blockї0] = "<a href="http://www.greywyvern.com" target="_top"><span style="font:bold 36pt fantasy;">Visit GreyWyvern.com!</span></a>";
scObj2.blockї1] = "<a href="http://www.greywyvern.com/forum.php" target="_top"><span style="font-weight:bold;">Home of the GWForum, and webring script (in development)</span></a>";
scObj2.blockї2] = "<a href="http://www.greywyvern.com" target="_top"><img src="http://www.greywyvern.com/img/nav/banner468x60.jpg" border="0"/></a>";
/* **************************************************************************
*** Don't pass this line ****************************************************
************************************************************************** */
function scrollObject(objName, main, height, width, bkgcol, deccel, begin, speed, pause, classname) {
this.objName = objName;
this.main = main;
this.one = main + "Block1";
this.two = main + "Block2";
this.block = new Array();
this.blockup = 1;
this.height = height;
this.width = width;
this.bkgcol = bkgcol;
this.deccel = Math.max(deccel, 1);
this.begin = Math.max(Math.min(begin, this.height), 1);
this.speed = speed;
this.pause = pause;
this.slide = height / this.begin;
this.table = "<table cellpadding="0" cellspacing="0" border="0"><tr><td class="" + classname + "" style="width:" + width + "px;height:" + height + "px;">";
this.scroll = scroll;
this.scrollLoop = scrollLoop;
}
function scroll() {if (!document.getElementById) return false;
document.getElementById(this.main).innerHTML = "<div id="" + this.one + ""></div><div id="" + this.two + ""></div>";
var divList = їdocument.getElementById(this.main), document.getElementById(this.one), document.getElementById(this.two)];
for (var i = 0; i <= 2; i++) {
if (i > 0) {
divListїi].style.position = "absolute";
divListїi].style.left = "0px";
(i == 1) ? divListїi].style.top = "0px" : divListїi].style.top = this.height + "px";
divListїi].innerHTML = this.table + this.blockїi - 1] + "</td></tr></table>";
} else {
divListїi].style.position = "relative";
divListїi].style.background = this.bkgcol;
}
divListїi].style.width = this.width + "px";
divListїi].style.height = this.height + "px";
divListїi].style.overflow = "hidden";
} setTimeout(this.objName + ".scrollLoop();", this.pause);
}
function scrollLoop() {
var divList = їdocument.getElementById(this.main), document.getElementById(this.one), document.getElementById(this.two)];
for (var j = 1; j <= 2; j++) divListїj].style.top = (parseInt(divListїj].style.top) - this.slide) + "px";
this.slide = Math.max(parseInt(this.slide / this.deccel), 1);
if (Math.min(parseInt(divListї1].style.top), parseInt(divListї2].style.top)) <= -this.height) {
this.slide = this.height / this.begin;
if (++this.blockup >= this.block.length) this.blockup = 0;
var wDiv = (parseInt(divListї1].style.top) <= -this.height) ? 1 : 0;
divListї2 - wDiv].style.top = this.height + "px";
divListї2 - wDiv].innerHTML = this.table + this.blockїthis.blockup] + "</td></tr></table>";
divListї1 + wDiv].style.top = "0px";
setTimeout(this.objName + ".scrollLoop();", this.pause);
} else setTimeout(this.objName + ".scrollLoop();", this.speed);
}
Posted: Fri May 09, 2003 3:58 am
by Tubbietoeter
include can only include local files not web files
you could do a frameset and load the file into the frame
or you could use session variables and include the local file which also uses your session variables. so it doesnt get the values by GET
Posted: Fri May 09, 2003 7:00 am
by jkmcgrath
Roger that thank you
John
Posted: Fri May 09, 2003 7:52 am
by volka
include can fetch remote files (like fopen) but you will receive what the remote system offers you. In case of a php-aware webserver you only get the output of that script, just like you've opened the document in your browser.
passing the varible to javascript
Posted: Fri May 09, 2003 8:34 am
by jkmcgrath
I read the sticky topics concerning this and I am still dazed and confused.
Would it be possible to have an example of how to pass the var $test into the javascript below. In one of the (scroller1.block[6] = " $test " ; )
Code: Select all
<script language"javascript" src="scroll.js" type="text/javascript"></script>
<html>
<head>
<title>New Page 1</title>
<style type="text/CSS">
.scrollClass {
text-align:center;
font:normal 8pt Arial,sans-serif;
}
</style>
</head>
<body onLoad="scroller1.scroll();">
<?PHP
$test = "test"
echo '<script language"javascript" type="text/javascript">
<!--
var scroller1 = new scrollObject("scroller1", "MainName", 140, 125, "#cdcdcd", 1.45, 3, 30, 2000, "scrollClass");
scroller1.blockї0] = "<img src=images/pullups.gif>";
scroller1.blockї1] = "Have you got what it takes?";
scroller1.blockї2] = "<img src=images/jumping_jacks.gif>";
scroller1.blockї3] = "The burning desire to excell?";
scroller1.blockї4] = "<img src=images/pushups.gif>";
scroller1.blockї5] = "THe MO_AVCRAD does!";
//-->
</script>'
?>
<div id="MainName">
The contents of this block will be displayed if the browser does not support the scroller.
It will be overwritten if the scroller is supported.
</div>
</body>
</html>
Thanks again for your help guys
John
Posted: Fri May 09, 2003 8:47 am
by volka
try
Code: Select all
...
<?php
$test = "test";
?>
<script language"javascript" type="text/javascript">
<!--
var scroller1 = new scrollObject("scroller1", "MainName", 140, 125, "#cdcdcd", 1.45, 3, 30, 2000, "scrollClass");
scroller1.block[0] = "<img src=images/pullups.gif>";
scroller1.block[1] = "Have you got what it takes?";
scroller1.block[2] = "<img src=images/jumping_jacks.gif>";
scroller1.block[3] = "The burning desire to excell?";
scroller1.block[4] = "<img src=images/pushups.gif>";
scroller1.block[5] = "THe MO_AVCRAD does!";
scroller1.block[6] = "<?php echo $test; ?>";
//-->
</script>
?>
<div id="MainName">
...
I tried this
Posted: Fri May 09, 2003 9:13 am
by jkmcgrath
<?PHP
$test = "test";
?>
<script language"javascript" type="text/javascript">
<!--
var scroller1 = new scrollObject("scroller1", "MainName", 140, 125, "#cdcdcd", 1.45, 3, 30, 2000, "scrollClass");
scroller1.block[0] = "<img src=images/pullups.gif>";
scroller1.block[1] = "Have you got what it takes?";
scroller1.block[2] = "<img src=images/jumping_jacks.gif>";
scroller1.block[3] = "The burning desire to excell?";
scroller1.block[4] = "<img src=images/pushups.gif>";
scroller1.block[5] = "THe MO_AVCRAD does!";
scroller1.block[6] = "<?PHP echo $test; ?>";
//-->
</script>
And it still comes up blank.
It is really getting the best of me lol
Posted: Fri May 09, 2003 9:32 am
by volka
blank it what way?
The scrollerObject does not show up or the browser's source view showed scroller1.block[6] = "";?
sorry
Posted: Fri May 09, 2003 9:34 am
by jkmcgrath
I just resaved the file and it works now like a charm!
Thank you so very much!
Now if I can get it to pass from page to page
