PeterRod Posted October 1, 2009 Share Posted October 1, 2009 Hi, very new to php. I have a windows platform website on GoDad. The index files are in .php I tried a simple 'todays date' script that works. I am trying to code a ticker tape type display in php, could not find any php examples only java. Can anyone suggest how to approach this in php so that the ticker will be a running display without affecting the normal web page loading / display Thanks Peter Quote Link to comment Share on other sites More sharing options...
Alex Posted October 1, 2009 Share Posted October 1, 2009 Ticker tape? You want to display a method of transmitting stock market prices over telegraph lines? Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted October 1, 2009 Share Posted October 1, 2009 if you want it to be dynamic, then you are trying with the wrong language. However, could you elaborate, im not entirely sure what you mean Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 1, 2009 Share Posted October 1, 2009 Php is a server side scripting language. The web server/php outputs a web page to the browser. Once a web page has been sent, the web server/php has no direct connection with what occurs on that web page. If you want to dynamically do something on a web page after it has been output by the web server/php, you need to use javascript. Do you have an example of what your web page looks like and what information you want to scroll on it and where and how often you want to get and change that information? Quote Link to comment Share on other sites More sharing options...
PeterRod Posted October 1, 2009 Author Share Posted October 1, 2009 if you want it to be dynamic, then you are trying with the wrong language. However, could you elaborate, im not entirely sure what you mean I dont want stock market quotes. I was hoping for a simple horizontally scrollling text display like ... we are the best ... best restaurant in town ... eat here for less ... that kind of stuff. The scroliing text would be at the top and the rest of the page info would be normal. There is no user interaction with the scrolling text. Quote Link to comment Share on other sites More sharing options...
Maq Posted October 1, 2009 Share Posted October 1, 2009 I don't think the results you saw were Java, I believe they were Javascript, which is an entirely separate language. Which is actually what you need to accomplish this. There are plenty of examples as you should already know. Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted October 1, 2009 Share Posted October 1, 2009 you can use HTML marquees too. they are very basic, so if you want more advanced behavior use javascript. <marquee direction="up"> Your text here </marquee> that will make it go up. you can similarly make it go down, left, right, etc. inside the marquee tags can go any valid HTML (idk what happens when you have nested marquee tags though) Quote Link to comment Share on other sites More sharing options...
PeterRod Posted October 1, 2009 Author Share Posted October 1, 2009 I don't think the results you saw were Java, I believe they were Javascript, which is an entirely separate language. Which is actually what you need to accomplish this. There are plenty of examples as you should already know. Sorry for the typo, yes the examples were in Javascript. Ok, So it looks like javascript is the way to go on the ticker-text display. How do I activate the Javascript from php without the visitor having to click a button? what php functions do I use? I tried a few unsuccessfully. Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted October 1, 2009 Share Posted October 1, 2009 if you want to call javascript in PHP, then you have to define the javascript before the PHP, and do something like echo "<script type='text/javascript'>functionToCall()</script> beware though, calling javascript in PHP has unexpected results, since javascript is parsed client side, and php server side. Quote Link to comment Share on other sites More sharing options...
thebadbad Posted October 1, 2009 Share Posted October 1, 2009 if you want to call javascript in PHP, then you have to define the javascript before the PHP, and do something like echo "<script type='text/javascript'>functionToCall()</script> beware though, calling javascript in PHP has unexpected results, since javascript is parsed client side, and php server side. Eh? You don't and can't call javascript in PHP, you simply output it. I realize that's what you probably mean, I'm just making it clear to the OP. Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted October 1, 2009 Share Posted October 1, 2009 you output a call to a function i guess is the correct way of saying it... but who cares... Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 1, 2009 Share Posted October 1, 2009 I'll second that. You are not defining javascript before the php because php simply outputs content to the browser. That content can be HTML, CSS, Javascript, media... If the content that you happen to be outputting contains some javascript, than that is what the browser receives at that point on the page. You are also not calling javascript in php, for the same reason. The HTML, CSS, and Javascript that appears in a .php file are just a bunch of inert characters. They don't have any meaning until they are received by the browser and the browser renders them. Ummm. The novice programmers that are looking for information care. Quote Link to comment Share on other sites More sharing options...
haku Posted October 2, 2009 Share Posted October 2, 2009 you can use HTML marquees too. they are very basic, so if you want more advanced behavior use javascript. <marquee direction="up"> Your text here </marquee> inside the marquee tags can go any valid HTML (idk what happens when you have nested marquee tags though) The marquee tag has been deprecated. Also, I recommend avoiding marquees altogether, since they are so '90s Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.