/    Sign up×
Community /Pin to ProfileBookmark

Combining languages…is my idea possible?

Good afternoon,

After searching the net, I found this link

([url]http://javascript.internet.com/miscellaneous/rotating-banner.html[/url])

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

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@KDLAApr 26.2007 — 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
Copy linkTweet thisAlerts:
@rootApr 26.2007 — 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.
Copy linkTweet thisAlerts:
@KDLAApr 26.2007 — I must have misunderstood -- I thought the request was for putting PHP into JS, not the opposite.
Copy linkTweet thisAlerts:
@Still_Learning2authorApr 26.2007 — 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
Copy linkTweet thisAlerts:
@KDLAApr 26.2007 — 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
Copy linkTweet thisAlerts:
@Still_Learning2authorApr 26.2007 — okey dokey...thank you

Back to the drawing board
×

Success!

Help @Still_Learning2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...