One approach that I’ve seen large, mainstream news organizations like CNN use is to publish a scrolling “breaking news” banner across the top of the web page. This allows editors to publish a news headline even before the writer is finished researching and publishing the article. When you’re writing about breaking news, being first to print is really important, and having a ticker content like this can give you an advantage.
The one problem with banners like this is that traditionally you had to go in and edit the web page in order to update the banner content. I wanted to implement this on my own website, but I thought it would be really cool to have the ability to upload the updates directly from my mobile phone so that it automatically updates the scrolling banner.
I developed a very simple ticker content management approach to doing this using PHP and a free Android FTP client called AndFTP. Although, you can also use just about any FTP client for this approach, such as the USB ones Aibek listed, or even the web-based FTP clients I wrote about for when you’re on the road. Wherever you can FTP, you can update the banner.
Installing the Banner on Your Website
Many of you that are familiar with basic HTML will recognize the old Marquee code that initiates the scrolling text along the top of your webpage. The code looks like this:
<div align="center"><FONT color="#F00000" size="+1"> <MARQUEE bgcolor="#FFCC33" direction="left" loop="20" width="75%"> <STRONG>THIS IS A TEST</STRONG> </MARQUEE></FONT></DIV>
You’ll need to edit the background and text color, and font styles to match your website and to give it a professional look and feel. I quickly chose colors that sort of match my website format, but it could use some tweaking – as an example, it will do! In its simplest form, the Marquee scrolls the text that you’ve typed into the code. As you can see above, my script has a bold “THIS IS A TEST” in it, so that’s exactly what gets displayed.
This would require you to edit that code snippet in your page in order to update the scrolling text. To automate this, I replaced the text with a PHP include, and had the PHP script pull text right out of a text file that I called “test.txt”, stored in a subdirectory on the public HTML folder of my web account. This is what that PHP include looks like.
<div align="center"><FONT color="#F00000" size="+1"><MARQUEE bgcolor="#FFCC33" direction="left" loop="20" width="75%"> <STRONG><?php include("/ftpdocs/test.txt"); ?></STRONG> </MARQUEE></FONT></DIV>
Now, instead of static text stored on your webpage, you’ve got PHP pulling the content of a file stored on your web server. That means that any time the file content changes, your website banner text will also change.
This is great – but again, I don’t want to have to be at my home PC to update the banner text. So, using a text editor on my mobile phone, I created a text file and saved it with the same name as the file stored on my web server. The text file will contain the latest news updates.
Any time you make changes to the text file on your mobile device, just fire up your mobile FTP client, such as AndFTP, and upload the new file to the subdirectory on the server where you pointed the PHP include.
The old file gets written over, and the new text gets displayed on your website. Now, to update the scrolling banner on your site, just change the text stored in the file on your mobile phone, upload it to your web server, and you’ll see the new text show up.
There are a few more ways you could improve the functionality of this approach, such as syncing a DropBox directory to your web server, and then just dropping the new file to DropBox will update the Marquee. This approach is a little more complicated though, and requires some configuration changes on the web server that you may not have permissions to make.
This solution is fast and easy, and it gives you the freedom to update scrolling text on your site from any location that you have access to FTP and a text editor. Updating your site with the latest news really couldn’t get much easier than that.
Did you try this approach, and did it work on your website? How would you improve the process – is there any way to improve the PHP script? Share your thoughts in the comments section below.
Image Credit: Wally Gobetz
More articles about: