Jump to content

ticker tape php


PeterRod

Recommended Posts

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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  ;D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.