Page 1 of 1

Adding Javascript to PHP

Posted: Fri Oct 13, 2017 2:06 pm
by BobW55
My knowledge of WEB Page programming stopped at HTML, and I am very rusty at using that.
I am trying to create my own block to track the International space station (ISS).
I know there is a functioning plug in for this, but I wanted a block.
I am trying to insert this Javascript into a block called isstrack.php
The Javascript is:
<script type="text/javascript" src="http://www.satflare.com/export/xvsft.as ... "></script>

It works fin in HTML, but syntax for PHP eludes me.
I think I am missing defining the size of the output from the script, my block shows up, but only as a small band about one character tall.
I have created a few other blocks that work just fine, this one is kicking my butt!

Bob

Re: Adding Javascript to PHP

Posted: Fri Oct 13, 2017 3:29 pm
by Jachym
Make sure you do not put the JS code inside PHP, PHP has to be separate from HTML and JS. The JS and HTML tags must be outside the PHP tags

Re: Adding Javascript to PHP

Posted: Fri Oct 13, 2017 4:42 pm
by BobW55
Jachym

That is what I also thought.

Will play with it more, may just end up using the plug in, but a block on the home page would have been a better look.

Re: Adding Javascript to PHP

Posted: Fri Oct 13, 2017 8:27 pm
by BobW55
Think I am having a problem with my Host Server.
If I save this to an html file:

<!DOCTYPE html>
<html>
<body>

</script>
<script type="text/javascript" src="http://www.satflare.com/export/xvsft.as ... "></script>
</body>
</html>
It runs fine from my Chrome browser.

If I upload the file to my Host server, it loads, starts to run then errors out.
File url: http://melvinweather.com/template/homep ... track.html
Have sent an email to my host Server.