Click to See Complete Forum and Search --> : Combining languages...is my idea possible?
Still Learning
04-25-2007, 08:27 PM
Good afternoon,
After searching the net, I found this link
(http://javascript.internet.com/miscellaneous/rotating-banner.html)
and I was wondering if it is possible to add a "php include" tag in place of the images that they use in the example...
I have been playing around with it for a few hours, but just can't seem to get it working.
Thank you for any help you may be able to send my way.
Still learning
I might be wrong, but javascript, a client-side script, doesn't work with a server-side script, such as PHP. You might take a look at the php content shuffler at: http://www.hotscripts.com/PHP/Scripts_and_Programs/Randomizing/Random_Text/index.html
KDLA
You can use JS in a PHP script, all you do is serve it up as you would a HTML page, an external file containing the script, as long as the tags are present in the include file, you shouldnt have a problem.
Some banner scripts dont take into account that you may be using one or more technologies but always assume that the script offering that they produce will be the only thing running and compatibility issues are least thing present in mind at the time of conception.
I would suggest that you read the code cover to coever, write your own version of it and learn how it works and taylor the script to your needs instead of having to work to someonelses methods.
I atleast find it quicker to rewrite my own verasion to fit in with the schema of my site coding over chosing what was offered.
I must have misunderstood -- I thought the request was for putting PHP into JS, not the opposite.
Still Learning
04-26-2007, 11:40 AM
Thanks for the replies...
I'm not sure if this would be adding PHP to JS or JS to PHP, but here is the piece of code that is giving me problems...with images in the 3 fields, the code works perfectly...but when I change them to "includes" the page comes up blank:
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
var maxAdNo = 2
var adNo
var myAd = new Array()
myAd[0] = '<?php include("Features/article.htm"); ?>'
myAd[1] = '<?php include("Features/article2.htm"); ?>'
myAd[2] = '<?php include("Features/article3.htm"); ?>'
</script
**if I post anything incorrectly (according to forum rules), please let me know and I will fix it.
Thanks again
As I said before, that's not possible. You're mixing languages that can't "talk" to each other. Javascript is a client-side language -- it can't talk to the server to create the php include.
KDLA
Still Learning
04-26-2007, 12:54 PM
okey dokey...thank you
Back to the drawing board