create new tag
, view all tags

NewsPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on NewsPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below

Discussions on the NewsPlugin

-- ColasNahaboo - 18 Feb 2003

This is a neat plugin, but it doesn't quite do what I want it to.

I'm looking for something that will behave more like a typical CMS/Portal articles module, e.g.:

  • I add news to a page
  • Another page can pick up the most recent n articles from that page, and format them (if needs be)
  • I can update the second page by changing the first

An example of the sort of thing I'm going for would be the left hand panel on http://www.annandaleroad.org/cgi-bin/view/Campaign/WebHome (my website). I've got this effect by editing the page directly, although this is clearly a pain. I've tinkered a bit with regexp too but didn't get very far.

Colas... is this how you perhaps see the plugin developing? I'd muck in if I knew the first thing about Perl smile

-- AndrewGambier - 17 May 2003

I use this plugin all the time, to build simple progress reports, but I find myself doing a lot of clumsy typing to get what I need. I'd appreciate any advice an how to simplify my method here :

I use a section called 'Latest News', which displays a number of short headlines in the top right of the page. I do this using a tiny topic called LatestNewsTable which gets included by other topics that need this mechanism. The NewsPlugin does this as intended. However, I want these short headlines to link to anchors in the News topic. To make this happen, I find that I have to manually put anchors in above every news item, then link each item using TopicName#AnchorName syntax. You can't even use the %TOPIC% veriable in this case. An example News topic has to look like this :

<!-- %NEWS{count="10" presep="<br>   "}% -->
---+Latest News

   * [[NewsTopic#HeadLine3][ ==29 Sep 04== Ready for internal review]]
      * Blah blah.

   * [[NewsTopic#HeadLine2][ ==24 Sep 04== Added workplan & project list]]
      * Blah blah.

   * [[NewsTopic#CHeadLine1][ ==15 Sep 04== CADWeb moves to TWiki]]
      * Blah blah.

It all works OK, but it's just very verbose, and difficult to get adopted by new users. Does anyone else want to use the plugin to have the headlines link to the correct place in the News topic ? It seems a useful addition to me. For info, the LatestNewsTable topic looks like this :

<table align="right" border="0" >
<td bgcolor="%WEBBGCOLOR%" align="center">[[%INCLUDINGWEB%.%BASETOPIC%News][<font size="+1"> *Latest News...* </font> ]] </td>

This gives a section like this in the top right of the page :

Any advice on how to simplify this is really appreciated.

-- SteveJonesST - 29 Mar 2005

Steve - here's a couple of quick thoughts that aren't a complete solution but might get you closer:

  • Use CommentPlugin to provide an HTML-form for adding new items so that the workings of this solution are invisible to the average user.
  • Design a CommentsTmpl (or UserTemplates) that generates the anchor and formats associated link. Perhaps the anchor could be generated using the %GMTIME{"format"}% variable.

Why does the =%TOPIC% variable not work? Would one of the variations BASETOPIC or INCLUDINGTOPIC work?

-- LynnwoodBrown - 29 Mar 2005

I liked the idea of using CommentPlugin. Here is a sample template that works. It creates a unique anchor based on the time, instead of the numeric increment used in the example above. Also note that I have modified NewsPlugin to look for ---+++ (instead of a bullet). I found that to be too restrictive. Plus this lets me create a TOC for all the headlines automatically. You may want to change the corresponding line below.

<input type="hidden" name="anchor" value="%GMTIME{$day$month$year$hour$min$sec}%">
%TABLE{ sort="off" tableborder="0" cellpadding="5" cellspacing="3" databg="white"}%
|  Headline:| <input %DISABLED% type="text" size="50" name="headline" />                    |
|      Text:| <textarea %DISABLED% rows="10" cols="40" name="news" wrap="soft"></textarea>  |
|           | <input %DISABLED% type="submit" value="Submit"/>                              |

<a name="%URLPARAM{anchor}%"></a>
---+++ [[%TOPIC%#%URLPARAM{anchor}%][ ==%DATE%:== %URLPARAM{"headline"}%]]

Submitted by: %WIKIUSERNAME%

-- PankajPant - 13 May 2005

checked .zip into CVS

-- WillNorris - 19 Jul 2005

I just checked in and uploaded a new version that implements the idea that PankajPant mentioned above --- allowing items to be specified by something other than a bullet list.

I added a "pattern" parameter to the %NEWS{}% tag that specifies how to find the items. By default, it is (\t|   )*\s (i.e., a first-level bullet) to maintain backward compatibility. This should work with both Cairo and Dakar releases.

-- DavidBright - 08 Feb 2006

Not Quite.

David's example in the and COMMENT template Pankaj givs don't play well together.

First, the template doesn't seem to expand the %TOPIC%

Secondly, David's pattern in NewsPlugin is for a H2 not a H3.

Put them together and what ends up in the Headlines topic is:

* + [[%TOPIC%#11Mar2006001217][ ==11 Mar 2006:== Test 1 2 3]]

-- AntonAylward - 11 Mar 2006

Well, I said the "idea", not that I implemented exactly what Pankaj described. The example in NewsPlugin for picking up items based on headers is for H2, but could easily be adapted to H3. As far as the template, I looked at the template I'm actually using and see that I used a slightly different technique, no doubt due to discovering that %TOPIC% wasn't expanded. I have this for my template:

<input type="hidden" name="anchor" value="%SERVERTIME{$day$month$year$hour$min$sec}%">
<input type="hidden" name="postingdate" value="%SERVERTIME{$day $mon $year}%">
<input type="hidden" name="newstopic" value="%TOPIC%">
%TABLE{ sort="off" tableborder="0" cellpadding="5" cellspacing="3" databg="white"}%
|  Headline:| <input %DISABLED% type="text" size="50" name="headline" />                    |
|      Text:| <textarea %DISABLED% rows="10" cols="40" name="news" wrap="soft"></textarea>  |
|      Note:| Your news text should follow the standard TWiki.TextFormattingRules. However, please do not use level 1 ("---+") or level 2 ("---++") headers to sub-divide your article; you can use levels 3 ("---+++") and higher. |
|           | <input %DISABLED% type="submit" value="Submit"/>                              |

<a name="%URLPARAM{anchor}%"></a>
---++ [[%URLPARAM{"newstopic"}%#%URLPARAM{anchor}%][%URLPARAM{"headline"}%]]
Posted on %URLPARAM{"postingdate"}% by %WIKIUSERNAME%



Note that I use a %URLPARAM% that gets set to %TOPIC% in the input template.

-- DavidBright - 11 Mar 2006

Please consider adding the use strict; pragma to this plugin. Its use is important to ensure the quality of TWiki plugins, enables catching certain errors, and helps to avoid unpleasant surprises. See UseStrict for more.

-- MeredithLesly - 02 Jul 2006

WARNING: Zip file has .txt files in data/Plugins, not correct directories for data/TWiki or data/Sandbox. Is there a development page for this?

-- ChuckEhrlich - 13 Sep 2006

IMPORTANT: As of today, the zip file has an old version (1.4) that is incompatible with versions 4.x of TWiki, not the newer version (1.5). The newer version is in the tgz file, though.

-- MarkBearden - 18 Oct 2006

I fixed the problem by re-uploading the zip file.

-- PeterThoeny - 21 Oct 2006

Topic attachments
I Attachment History Action Size Date Who Comment
GIFgif latest_news.gif r1 manage 8.2 K 2005-03-29 - 16:11 SteveJonesST screenshot of latest news
Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r14 - 2006-10-21 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.