
canvey
User
Sep 27, 2002, 4:10 PM
Post #16 of 16
(10883 views)
Shortcut
|
I have been asked by a few people if I would share my modified file for grabbing the headlines..... No problem. 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 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.....
|