PDA

View Full Version : Calling on a .php file in iframe



john
03-12-2006, 08:27 PM
Hello all. I am faced with an issue that has me puzzled. I am a major newbie in the area of .php. Recently, I had created an iframe on my web site that called various dates and events from a calendar that I had. I used the iframe scroller code supplied and everything was working well. I made the necessary changes to refer to the calendar's upcoming.php file, which held information on all upcoming dates and events. After making some changes to other areas of my site, I was forced to recreate the page in question, however now, the content within the iframe (upcoming.php) is still shown, but it is stationary. Am I forgetting something? It used to flow nicely. The iframe code itself initially asks to refer to a file called external.htm which one is to upload to their servers, however I am almost certain that I had made some changes, so that it pointed to my upcoming.php file. In any case, the issue lies with the javascript which is in the original external.htm file provided with the iframe scroller code and the fact that it is not in the upcoming.php file. Is there any way to get it in there? Would this allow said dates within the iframe to scroll automatically as they used to before? I am sorry if it sounds like I am rambling and I promise to be more direct and to the point as my "posting experience" grows.:rolleyes:

Thanking you in advance for your time and assistance, I remain,

John.

djr33
03-13-2006, 08:34 PM
I'm tired... I didn't quite follow that.

Not to drag the thread off topic, but let me try at stab at this... if its right, great... if not, it's probly related:

Can php work between frames? If so, how?

john
03-13-2006, 10:17 PM
Okay, it seems like I DID indeed ramble up there. I need to have the iframe scroller supplied in this site get it's content from a .php file and not from the external.htm file it says to get it from. The .php file whose content I want scrolling in this iframe is automatically changed on a daily basis. I can get the iframe to show the content of the .php file, but it does not scroll and remains fixed. How do I get it to automatically scroll? Any better, buddy? ;)

djr33
03-14-2006, 06:12 AM
Ok... got the issue... kinda got that before. the issue i'm seeing is that I really don't know what the setup is. Sorry.... I just don't have enough info to really know.

My only guess is that your php page has something overriding something that the old html page doesn't... meaning it'll be just a matter of modifying the php to be compliant with the html of the other page. ...I think.

Perhaps a link in this case might be most helpful. :)


hmm... one more question... what's this iframe scroller... a script of some sort, right? js?

Twey
03-14-2006, 06:35 AM
I daresay it has nothing to do with the PHP at all. We'll need to see the source of this iframe scroller, though.

john
03-14-2006, 07:45 AM
<html>

<body>

<script type="text/javascript">

/***********************************************
* IFRAME Scroller script- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//specify path to your external page:
var iframesrc="external.htm" <----THIS IS WHAT I CHANGED TO update.php

//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc+'" width="150px" height="150px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"></iframe>')

</script>

</body>
</html>

john
03-14-2006, 07:48 AM
It was also mentioned that when creating the file that was to be called into the iframe, that the following .htm file was to be placed on the server. I have changed the .htm file for a .php file though...so which part of the below code must be included into the .php file?
********************************************************
<html>
<body>

<div id="datacontainer" style="position:absolute;left:1px;top:10px;width:100%" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache">

<!-- ADD YOUR SCROLLER CONTENT INSIDE HERE -->

<b>What's Hot</b></p>
<p align="left"><strong><font face="Verdana"><small><a href="http://www.dynamicdrive.com/dynamicindex9/encrypter.htm" target="_top">Source
code encrypter</a>&nbsp;</small></font></strong><br>
<font face="Verdana" size="2">Scramble the source of any chunk of code using
this unique script.</font></p>
<p align="left"><strong><font face="Verdana"><small><a href="http://www.dynamicdrive.com/dynamicindex5/flashlink.htm" target="_top">Flashing
links</a>&nbsp;</small></font></strong><br>
<font face="Verdana"><small>Bring attention to special links, by making them
flash!</small></font></p>
<p align="left"><small><strong><font face="Verdana"><a href="http://www.dynamicdrive.com/dynamicindex13/roamcursor.htm" target="_top">Roaming
Cursor</a>&nbsp;</font></strong></small><br>
<small><font face="Verdana">Display a second, &quot;roaming&quot; cursor on your
page with this fun animation script.</font></small></p>
<p align="left"><font face="Verdana"><strong><a href="http://www.dynamicdrive.com/dynamicindex11/animatedtitle.htm" target="_top"><small>Animated
Document title</small></a><br>
</strong><small>Animate into view your document's title!</small></font>

<!-- END SCROLLER CONTENT -->

</div>

<script type="text/javascript">

/***********************************************
* IFRAME Scroller script- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//Specify speed of scroll. Larger=faster (ie: 5)
var scrollspeed=cache=2

//Specify intial delay before scroller starts scrolling (in miliseconds):
var initialdelay=500

function initializeScroller(){
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
dataobj.style.top="5px"
setTimeout("getdataheight()", initialdelay)
}

function getdataheight(){
thelength=dataobj.offsetHeight
if (thelength==0)
setTimeout("getdataheight()",10)
else
scrollDiv()
}

function scrollDiv(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
if (parseInt(dataobj.style.top)<thelength*(-1))
dataobj.style.top="5px"
setTimeout("scrollDiv()",40)
}

if (window.addEventListener)
window.addEventListener("load", initializeScroller, false)
else if (window.attachEvent)
window.attachEvent("onload", initializeScroller)
else
window.onload=initializeScroller

</script>

</body>
</html>

john
03-14-2006, 07:49 AM
Here is where the initial code was found.

http://www.dynamicdrive.com/dynamicindex2/iframe-scroller.htm

Again, thanks for all your time and assistance, people! It is much appreciated!

djr33
03-21-2006, 06:14 AM
I'll agree with twey... it's not php. php is just a different extension for html, ignoring dynamic content on those pages... it won't affect the functionality of js, I wouldn't think anyway.

I don't know enough about JS to work it out myself.

Thoughts:
check the above code for ".htm" and try switching to ".php"
And... in the first thing you posted, it says 'scrolling=no'... sure that's right? :D

Twey
03-21-2006, 03:00 PM
so which part of the below code must be included into the .php file?Everything except the contents of the <div> should stay the same.