Forums Archive Index > Cool free scripts > Help with newsticker and php updating

Author: hameld

Date: 1 Jun 2004 12:52 pm

I checked this post already --> http://www.smartmenus.org/forum/viewtopic.php?t=10 concerning updating this newticker with dynamic information. I still could not get the script to work by just changing the extension to .php.

What I would like to do is have the news ticker read a record from a table and use that as the content to display.

Here's a quick rundown of what I want to use this for.
1. You load the page
2. Information is loaded from a table and put into an array, say the most current five records created
3. I would then like to pass that array to the news ticker script and have it displayed

This way, the most current news is always displayed without updating code or a text document, just information within a table.

I don't know if I should have the index in php with jscript embedded, or should I change the jscript file extension to php? If I change the original vnews ticker jscript to php, how would that work? Would I echo "" all the non php code? I know HTML and PHP enough to understand and code but I know nothing about jscript. Sorry about my ignorance but this is one of the nicest scripts out there (and its FREE!) and I would really like to get this to work.

Any help would be greatly appreciated.

-hameld


Author: smartmenus

Date: 1 Jun 2004 2:37 pm

hameld wrote:
Would I echo "" all the non php code?
No, of course. :)

You don't have open your PHP tag at the beginning of the file and echo all the content. For example you can make it like this:
Code:
. . .

v_textAlign='left';// left/center/right
v_textVAlign='middle';// top/middle/bottom - won't work in Netscape4

// === 2 === THE CONTENT - ['href','text','target']
// Use '' for href to have no link item
v_content=[<?php

YOUR PHP CODE HERE

?>];

. . .


You have to use PHP to output the items of the v_content array but you don't have to output the whole file.


Author: hameld

Date: 1 Jun 2004 3:39 pm

Vasil,

First off, thanks for such a prompt response. While I didn't expect one so quick I keep the browser window open so I can keep track of what I'm supposed to keep track of(confusing, I know).

Anyways, the problem I'm having is this. My index page is in php. Can I integrate the script into the page or is it best to load it as an outside script? I've tried integrating the script into the html/php code like so:

Code:
<html>
(--- code ---)
<?php
(--- code ---)
?>
<script>
Vasil Dinkov's script here <?php (--- code ---) ?>
</script>
(--- code ---)
</html>


and also calling the jscript as an outside script like above to no avail. Any suggestions Vasil?

-hameld


Author: hameld

Date: 1 Jun 2004 10:42 pm

Thank you for your help Vasil. After I said to myself, 'rtfm idiot' I realized what I was doing wrong (and also a little help from my friend Venk!). Thanks guys for everything.

-hameld