Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued Products: Article Manager 1 Add-ons:
News ticker

 

 


jo
Novice

Jul 18, 2002, 7:22 AM

Post #1 of 16 (9099 views)
Shortcut
News ticker Can't Post

Hi
I want to use a newsticker on my website. Is it possible to pull data out of the article manager database and use it in my ticker.

For exemple:
I want to rotate the latest headlines. Where can i find the plain txt files for inserting automaticly in the ticker code?

Thanks


dlo_itools
Staff


Jul 18, 2002, 2:03 PM

Post #2 of 16 (9088 views)
Shortcut
Re: [jo] News ticker [In reply to] Can't Post

Although there isn't a plain text file of article headlines, the category index files cat_index_N.html in the publish/ directory is the closest to plain text as you get. A quick filter (in Perl or in your favorite text processing language) can transform that into a text file of headlines. Here's an example filter in Perl:

# usage: perl getheadlines.pl <cat_index_1.html >cat1.txt
while ($line=<>) {
if ($line =~ m|<font class="artname">(.*?)</font>|) {
$line = $1;
$line =~ s|<[^>]*>||g;
print "$line\n";
}
}

The remaining parts of integrating this with the newsticker and running the script regularly is left as a value-add for fellow web developers ;)
/Dave Lo


jo
Novice

Jul 18, 2002, 11:48 PM

Post #3 of 16 (9076 views)
Shortcut
Re: [dlo] News ticker [In reply to] Can't Post

Thanks

I'm gona give it a try.


MalaK_3araby
User

Jul 27, 2002, 6:50 PM

Post #4 of 16 (9026 views)
Shortcut
Re: [dlo] News ticker [In reply to] Can't Post

News Ticker is an awsome idea.

I have never done Perl before, where should this go?

More specific instructions Please.

--------------
Sure you can spell it, but do you get it?


dlo_itools
Staff


Jul 29, 2002, 10:15 AM

Post #5 of 16 (9008 views)
Shortcut
Re: [MalaK_3araby] News ticker [In reply to] Can't Post

To use the above script to generate a text file of headlines, do the following:

---- Saving the script:

1. Save the above script with the filename getheadlines.pl in your artman/publish directory.

2. Edit the script to add the following as the first line

#!/usr/bin/perl

---- Using the script:

1. Go to your article manager directory

chdir artman/publish

2. Run the script with perl, putting in the categories

perl getheadlines.pl cat_index_1.html cat_index_2.html >headlines.txt

Now you will have a text file of the headlines from categories 1 and 2.
/Dave Lo


noza
User

Aug 13, 2002, 8:21 PM

Post #6 of 16 (8908 views)
Shortcut
Re: [MalaK_3araby] News ticker [In reply to] Can't Post

Hi, didi you get this working ? could you tell us where ?

Pat


MalaK_3araby
User

Aug 13, 2002, 11:05 PM

Post #7 of 16 (8902 views)
Shortcut
Re: [noza] News ticker [In reply to] Can't Post

Hi Pat

1- create a file and name it: getheadlines.pl
put this code in it:

Code
#!/usr/bin/perl  
# usage: perl getheadlines.pl cat_index_1.shtml cat_index_n9.shtml > headlines.txt
while ($line=<>) {
if ($line =~ m|<font class="artname">(.*?)</font>|) {
$line = $1;
$line =~ s|<[^>]*>||g;
print "$line\n";
}
}

Make sure the first line of the code points to your perl. Normally shoudl work as it is.

2- Upload the file to your PUBLISH dir.

3- Telnet to your host and head to the Publish dir. Run the above script using this command:

Quote
perl getheadlines.pl cat_index_1.shtml cat_index_9.shtml > headlines.txt

This will pull headlines from ctegory #1 and #9 .. you can add more categories or change that as you wish.
Running the script will create a NEW files called headlines.txt containg the headlines from the specified categories.

Shame you can not specify dates.

4- Now you need to use a TICKER script to read that file and scroll it.
http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&q=news+ticker+script&btnG=Google+Search

If you find a descent one lets know plz.

G-Luck

P.S: you might consider using CRONTAB to automate running the script at specific intervals.

<hr width=50%>

Q to dlo: how can we format the out put so that it would refrence the url?i.e: < a href= " path/article_n.shtml " > artname < /a >

--------------
Sure you can spell it, but do you get it?


dlo_itools
Staff


Aug 14, 2002, 9:23 AM

Post #8 of 16 (8886 views)
Shortcut
Re: [MalaK_3araby] News ticker [In reply to] Can't Post


In Reply To
Q to dlo: how can we format the out put so that it would refrence the url?i.e: < a href= " path/article_n.shtml " > artname < /a >


Try commenting out the fourth-from-last-line by adding a "#" to the beginning of that line:

# $line =~ s|<[^>]*>||g;

That line removes all the tags from the result. By commenting it out, you will get <a href="...">artname</a> in your headlines.txt file.
/Dave Lo


MalaK_3araby
User

Aug 14, 2002, 10:41 AM

Post #9 of 16 (8883 views)
Shortcut
Re: [dlo] News ticker [In reply to] Can't Post

Thank you dave i will try that.

how would i modify the output to add html to achive this:


<table bgcolor=#ECECEC><tr>
<td><a href="...">artname</a>someHTML</td> .:.
<td>someHTML</td></tr></table>

I am totally new to perl Crazy

--------------
Sure you can spell it, but do you get it?


dlo_itools
Staff


Aug 14, 2002, 11:08 AM

Post #10 of 16 (8881 views)
Shortcut
Re: [MalaK_3araby] News ticker [In reply to] Can't Post


In Reply To
how would i modify the output to add html to achive this:

<table bgcolor=#ECECEC><tr>
<td><a href="...">artname</a>someHTML</td> .:.
<td>someHTML</td></tr></table>


Add the following code before doing the print "$line":


Code
   $line = <<END_DATA;     
<table bgcolor=#ECECEC><tr>
<td>$line</td>
<td>someHTML</td></tr></table>
END_DATA


So the new getheadlines.pl script would look like this:


Code
   #!/usr/bin/perl     
# usage: perl getheadlines.pl <cat_index_1.html >cateogory1.txt
while ($line=<>) {
if ($line =~ m|<font class="artname">(.*?)</font>|i) {
$line = $1;
$line = <<END_DATA;
<table bgcolor=#ECECEC><tr>
<td>$line</td>
<td>someHTML</td></tr></table>
END_DATA
print "$line\n";
}
}

/Dave Lo


MalaK_3araby
User

Aug 14, 2002, 11:22 AM

Post #11 of 16 (8880 views)
Shortcut
Re: [dlo] News ticker [In reply to] Can't Post

Aaah .. you are so kind.Cool

I greatly apprecaite the help.

THANK YOU.

--------------
Sure you can spell it, but do you get it?


roi
User

Sep 11, 2002, 5:20 PM

Post #12 of 16 (8273 views)
Shortcut
Re: [jo] News ticker [In reply to] Can't Post

Hi folks,

Read all the post on this thread.

I wondered if there is anyway a news ticker system be intergrated into AM. By this I Mean for AM staff themself to write some java news ticker to go along with AM.

If possible with the ability for it to only choose headlines from freshly posted articles which are one day old.

That be really nice. OR even just by catogry.

Thanks! :)


canvey
User

Sep 16, 2002, 3:28 AM

Post #13 of 16 (8225 views)
Shortcut
Re: [dlo] News ticker [In reply to] Can't Post

For anyone struggling to get this to work - it may be because the stylesheet names have been changed from earlier versions to the newer templates.

The stylesheet from 1.05 to 1.21 are totally different/

Will this change of stylesheet names affect anything else in AM?


canvey
User

Sep 16, 2002, 6:53 AM

Post #14 of 16 (8219 views)
Shortcut
Re: [canvey] News ticker [In reply to] Can't Post

Okay - I am now generating the file - but the data needs to be a slightly different order....

Could anyone help me to get from say

<a href="http://www.domain.com/artman/publish/article_0314.shtml">article headline</a>
to
<a href="http://www.domain.com/artman/publish/article_0314.shtml" target="_blank" value="article headline">

So far I am using the script as, but I haven't quite got the headline & url bits correct. essentially I was trying to make two variables headline & url and insert them into some html text.


Code
 #!/usr/bin/perl   
# usage: perl getheadlines.pl cat_index_1.shtml cat_index_n9.shtml > headlines.txt
while ($line=<>) {
if ($line =~ m|<font class="artname">(.*?)</font>|) {
$headline = $line;
$url = $line;
$line = $1;
$headline =~ s|<[^>]*>||g;
$url =~ s|<[^>]*>||g;
$line = <<END;
<a href="$url" target="_blank" value="$headline">
END
print "$line\n";
}
}






canvey
User

Sep 17, 2002, 12:34 PM

Post #15 of 16 (8181 views)
Shortcut
Re: [canvey] News ticker [In reply to] Can't Post

Not to worry - my news ticker is working just fine now - and being updated every 15 minutes - maybe a bit of an overkill - but at least the stories will hit the ticker almost as fast as the syndicate Smile


canvey
User

Sep 27, 2002, 4:10 PM

Post #16 of 16 (8118 views)
Shortcut
Re: [dlo] News ticker [In reply to] Can't Post

I have been asked by a few people if I would share my modified file for grabbing the headlines.....

No problem.Smile As usual - neither I nor anyone else will be responsible if your site crashes or your Mother-in-law comes to stay as a direct result of using this script Sly

To recap

The line that I am extracting from the index file is

<font class="artname"><a href="$detail_link$">$art_name$</a></font>

(see also Font Class Change below)

getheadlines.pl script

by using.....

#!/usr/bin/perl
# usage: perl getheadlines.pl cat_index_1.shtml cat_index_n9.shtml > headlines.txt
while (<>) {
if (m!<font class="artname"><a href="([^"]+)">([^<]+)</a></font>!) { print qq(<a href="$1" target="_blank"
value="$2"> \n); } }


Output

This produces a file with the data looking like...

<a href="http://url/to/article/am_0338.shtml" target="_blank" value="Headline Is Here">
<a href="http://url/to/article/am_0342.shtml" target="_blank" value="Second Headline Is Here">
then repeated for all the other articles shown on that index page.

An extra tip:

On some of my index pages, I am now using pop-ups (so the link changes), and in fact on some I do not even show the headline - if you find that your $art_name$ link changes or is not even present, and you still want that article to appear in the news ticker - all you need do is to put

<!-- <font class="artname"><a href="$detail_link$">$art_name$</a></font> -->

In the <!-- templatecell : row --> section of the index template - it will not show on the index page, yet will still get grabbed using the script above.

This enables you to alter your index page template whilst still keeping the ticker working.

Font Class Change

If the script fails - it may be because your font class is wrong in version 1.05 and before of AM, IT used a different stylesheet name for this $art_name$ placeholder.

Target

The target part is optional, depending upon how you wish for the article to open up.

Enjoy..... Smile

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4