Wednesday, November 19, 2003 8:50 AM Jan Tielens

DotNetNuke News Module Enhancement: limiting the number of news items

The last few days I toyed a little bit with the DotNetNuke open source portal system. I know this is not SharePoint, but it allows to quickly setup good looking website that can easily be maintained by non-technical people.  Although changing the layout (e.g. colors) of the site, especially the top banner with the menu, is quite hard in the beginning. I had to dive into the code to accomplish what I wanted to do. But once you get to know how the portal is designed, altering just anything is done in a second.

A DotNetNuke site consists of a number or tabs with a number of modules on. There many of these modules, including one that displays and RSS feed. This is intresting because it allows you to provide great dynamic content on your site (e.g. the .NET Weblogs Main Feed), with very little effort. By default the News Module display all the contents of the RSS feed as plain text, so HTML tags become escaped HTML tags, so the feed loses its formatting. This behaviour can be changed quite easy by editing the RSS91.xsl file in the DesktopModules\News directory. In this XSL file, I've added disable-output-escaping="yes" to the value-of tag of the description.

A second modification I've made is to limit the maximum number of news items displayed. This can come in handy when you don't want to display all the 30 or so items of a news feed, but only the last 5 of them. I've solved this by adjusting a copy of the RSS91.xsl file (e.g. RSS91_5.xsl). A new "if test" node is added, that performs a test for each news item. If the position is smaller or equal to 5, the item is displayed. To use the new RSS91_5.xsl, you have to upload the file (e.g. using the File Manager), and set the News module to use the Internal Style Sheet which you can select from the drow down list.

The following xsl displays the last 5 news items of an RSS News Feed, including the HTML formatting.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="TITLE"/>
<xsl:template match="rss">
  <!-- Do not show channel image -->
  <xsl:for-each select="channel/item">
 <xsl:if test="position() &lt;= 5">
  <br>

  <strong><a href="{link}" target="_main"><xsl:value-of select="title"/></a></strong><br></br>

  <!-- only display markup for description if it's present -->
  <xsl:value-of select="description" disable-output-escaping="yes"/>

  </br>
  <br></br>
 </xsl:if>
  </xsl:for-each>
</xsl:template>

<xsl:template match="description">
  <br>
    <xsl:value-of select="."/>
  </br>
</xsl:template>

</xsl:stylesheet>

Comments

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Wednesday, November 19, 2003 4:09 AM by Scott McCulloch

Nice Tip Jan!

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Wednesday, November 19, 2003 4:53 AM by Stefán Jökull Sigurðarson

Since you are looking at that, maybe you'd be interested in my own IBuySpy portal modification. I created it mostly because i felt that these portals lacked customization. My portal is almost completely CSS based regarding it's looks!

A lot of work still to be done, but you can take a look at it at my website, http://www.stebet.com

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Wednesday, November 19, 2003 5:08 AM by Julien CHEYSSIAL

You could improve a little bit your stylesheet by specifying directly at the <xsl:for-each> level, that you want to loop on the first 5 items :

<xsl:for-each select="channel/item[position() &lt;= 5]">
...
</xsl:for-each>

No more need for a nested <xsl:if> ! Hope this helps !

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Wednesday, November 19, 2003 10:05 AM by René

And here's another variant.

This one displays all the titles, but only the description for the first title. On all the other titles the description is shown on mouseover.

René

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="html" indent="yes"/>
<xsl:template match="rss">
<!--Get max 25 articles -->
<xsl:for-each select="channel/item[position() &lt;= 25]">
<!-- Build compete A element -->
<a>
<xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>
<xsl:attribute name="target">_blank</xsl:attribute>
<xsl:attribute name="title"><xsl:value-of select="description"/></xsl:attribute>
<xsl:value-of select="title"/>
</a>
<br/>
<xsl:if test="position() = 1">
<xsl:value-of select="description" disable-output-escaping="yes"/>
<br/><br/>
</xsl:if>
</xsl:for-each>
<!-- Show feed description at the bottom -->
<br/>
<xsl:value-of select="/rss/channel/description"/>
<br/>
</xsl:template>
</xsl:stylesheet>

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Thursday, December 11, 2003 5:22 PM by Paul

Thank you!!

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Friday, December 26, 2003 5:43 PM by Darryl Parker

After HOURS of trying to find a solution to the limiting the number of headlines, there you have it in two lines of code. THANK YOU!

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Thursday, January 08, 2004 4:13 PM by Robert

Thanks - great help :)

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Thursday, July 22, 2004 1:15 PM by b

AWESOME!

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Thursday, May 25, 2006 3:03 PM by Luigi

Thanks to everybody...
Any idea about how to resize NewsModule? If I place it on the right(or left) pane it becomes very long and very thin and each title (or description)  takes three or more lines!!!
Luigi
(Sorry for my bad and rusty english)

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Sunday, January 21, 2007 6:21 AM by i730motorolaringtone

http://2site.com/xzmeap

<a href="http://2site.com/xzmeap">download wwe ringtone for free</a>

[URL=http://2site.com/xzmeap]download wwe ringtone for free[/URL]

http://2site.com/ctvhqe

<a href="http://2site.com/ctvhqe">download free ringtone for verizon phone</a>

[URL=http://2site.com/ctvhqe]download free ringtone for verizon phone[/URL]

http://2site.com/efbhjs

<a href="http://2site.com/efbhjs">download free ringtone for verizon cell phone</a>

[URL=http://2site.com/efbhjs]download free ringtone for verizon cell phone[/URL]

http://2site.com/gjrhbz

<a href="http://2site.com/gjrhbz">download free ringtone software</a>

[URL=http://2site.com/gjrhbz]download free ringtone software[/URL]

http://2site.com/mbjhrz

<a href="http://2site.com/mbjhrz">download free ringtone wap</a>

[URL=http://2site.com/mbjhrz]download free ringtone wap[/URL]

http://2site.com/srbfjh

<a href="http://2site.com/srbfjh">cingular download free ringtone wireless</a>

[URL=http://2site.com/srbfjh]cingular download free ringtone wireless[/URL]

http://2site.com/ejphca

<a href="http://2site.com/ejphca">ringtone and wallpaper free download</a>

[URL=http://2site.com/ejphca]ringtone and wallpaper free download[/URL]

http://2site.com/bjevxg

<a href="http://2site.com/bjevxg">download free real music ringtone</a>

[URL=http://2site.com/bjevxg]download free real music ringtone[/URL]

http://2site.com/wzhtgd

<a href="http://2site.com/wzhtgd">download free ringtone telus</a>

[URL=http://2site.com/wzhtgd]download free ringtone telus[/URL]

http://2site.com/xvghqb

<a href="http://2site.com/xvghqb">ringtone and blackberry and download and free</a>

[URL=http://2site.com/xvghqb]ringtone and blackberry and download and free[/URL]

http://2site.com/tbfqhm

<a href="http://2site.com/tbfqhm">download free ringtone motorola v60i</a>

[URL=http://2site.com/tbfqhm]download free ringtone motorola v60i[/URL]

http://2site.com/ctqgab

<a href="http://2site.com/ctqgab">download free i730 motorola ringtone</a>

[URL=http://2site.com/ctqgab]download free i730 motorola ringtone[/URL]

http://2site.com/uncibm

<a href="http://2site.com/uncibm">download free kyocera ringtone</a>

[URL=http://2site.com/uncibm]download free kyocera ringtone[/URL]

http://2site.com/mhagjf

<a href="http://2site.com/mhagjf">download free nokia 3595 ringtone</a>

[URL=http://2site.com/mhagjf]download free nokia 3595 ringtone[/URL]

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Friday, March 23, 2007 6:56 AM by Lucy! Please call me,Jonny

Lucy! Please call me,Lucy! Please call me

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Saturday, March 24, 2007 4:05 AM by Lucy! Please call me,Jonny

Lucy! Please call me,Lucy! Please call me

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Friday, April 20, 2007 10:39 PM by Britneysjvag

<a href= http://www.angelfire.com/punk/qajeva >a living prayer krauss</a> <a href= http://www.angelfire.com/poetry/cezuqa >aapg bookstore</a> <a href= http://www.angelfire.com/droid/pywawi >a to z street maps</a> <a href= http://www.angelfire.com/hiphop/dofobi >a tout a l heure</a> <a href= http://www.angelfire.com/indie/jypufa >a rumor of war philip caputo review</a>

# re: DotNetNuke News Module Enhancement: limiting the number of news items

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Sunday, April 22, 2007 8:16 PM by Britneyiyngq

<a href= http://www.angelfire.com/droid/sihobe >a scanner darkly teaser trailer</a> <a href= http://www.angelfire.com/poetry/jucegi >a pattern to make a quilted jacket</a> <a href= http://www.angelfire.com/punk/kogome >a/c condenser trane</a> <a href= http://www.angelfire.com/crazy/dukype >a z inventors</a> <a href= http://www.angelfire.com/funky/dyjoca >a song for mama by boyz 2 men</a>

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Monday, April 30, 2007 11:10 PM by Britneykmtwn

<a href= http://www.angelfire.com/crazy/jupici >a girl's guide to hunting and fishing</a> <a href= http://www.angelfire.com/droid/vebova >a1 homes new zealand</a> <a href= http://www.angelfire.com/crazy/zyxelo >a female escort</a> <a href= http://www.angelfire.com/poetry/padofe >a new look</a> <a href= http://www.angelfire.com/poetry/sukepo >a plusmath</a>

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Tuesday, May 01, 2007 1:14 PM by Kurikos

<a href=" http://lipitor.ovp.pl ">buy lipitor</a>

<a href=" http://singulair.ovp.pl ">buy singulair</a>

<a href=" http://allegra.ovp.pl ">buy allegra</a>

<a href=" http://zovirax.ovp.pl ">buy zovirax</a>

<a href=" http://famvir.ovp.pl ">buy famvir</a>

<a href=" http://prilosec.ovp.pl ">buy prilosec</a>

<a href=" http://tenormin.ovp.pl ">buy tenormin</a>

<a href=" http://fosamax.ovp.pl ">buy fosamax</a>

<a href=" http://zylopim.ovp.pl ">buy zylopim</a>

<a href=" http://buspar.ovp.pl ">buy buspar</a>

<a href=" http://cozaar.ovp.pl ">buy cozaar</a>

<a href=" http://bontril.ovp.pl ">buy bontril</a>

<a href=" http://aristocort.ovp.pl ">buy aristocort</a>

<a href=" http://vioxx.ovp.pl ">buy vioxx</a>

<a href=" http://celebrex.ovp.pl ">buy celebrex</a>

<a href=" http://testosterone.ovp.pl ">buy testosterone</a>

<a href=" http://didrex.ovp.pl ">buy didrex</a>

<a href=" http://premarin.ovp.pl ">buy premarin</a>

<a href=" http://prozac.ovp.pl ">buy prozac</a>

<a href=" http://norvasc.ovp.pl ">buy norvasc</a>

<a href=" http://vaniqa.ovp.pl ">buy vaniqa</a>

<a href=" http://neurontin.ovp.pl ">buy neurontin</a>

<a href=" http://rogaine.ovp.pl ">buy rogaine</a>

<a href=" http://naprosyn.ovp.pl ">buy naprosyn</a>

<a href=" http://plavix.ovp.pl ">buy plavix</a>

<a href=" http://echinacea.ovp.pl ">buy echinacea</a>

<a href=" http://condylox.ovp.pl ">buy condylox</a>

<a href=" http://nexium.ovp.pl ">buy nexium</a>

<a href=" http://deltasone.ovp.pl ">buy deltasone</a>

<a href=" http://wellbutrin.ovp.pl ">buy wellbutrin</a>

<a href=" http://celexa.ovp.pl ">buy celexa</a>

<a href=" http://mesterolone.ovp.pl ">buy mesterolone</a>

<a href=" http://danazol.ovp.pl ">buy danazol</a>

<a href=" http://zocor.ovp.pl ">buy zocor</a>

<a href=" http://desyrel.ovp.pl ">buy desyrel</a>

<a href=" http://prevacid.ovp.pl ">buy prevacid</a>

<a href=" http://ionamin.ovp.pl ">buy ionamin</a>

<a href=" http://tylenol.ovp.pl ">buy tylenol</a>

<a href=" http://zyrtec.ovp.pl ">buy zyrtec</a>

<a href=" http://claritin.ovp.pl ">buy claritin</a>

# re: DotNetNuke News Module Enhancement: limiting the number of news items

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Friday, May 04, 2007 3:23 PM by [*01names.txt*],[*01names.txt*],[*01names.txt*],[*01names.txt*],[*01names.txt*],[*01names.txt*],Hi http://interactive.colum.edu/students/MMorales/marcomorales/free-music.html free music :: http://interactive.colum.edu/students/MMorales/marcomorales/music.html mp3 downloads :: http://interactive.colum.edu/students/MMorales/marcomorales/free-mp3-downloads.html free mp3 sites :: http://interactive.colum.edu/students/MMorales/marcomorales/shakira-mp3.html shakira mp3 :: http://interactive.colum.edu/students/MMorales/marcomorales/music-search-engines.html music search engines :: <a href= http://interactive.colum.edu/students/MMorales/marcomorales/limewire.html >limewire</a> ; <a href= http://interactive.colum.edu/students/MMorales/marcomorales/free-music-downloads.html >free music downloads</a> ; <a href= http://interactive.colum.edu/students/MMorales/marcomorales/downloadable-music.html >classical music downloads</a> ; <a href= http://interactive.colum.edu/students/MMorales/marcomorales/mp3-songs.html >free mp3 songs</a> ; <a href= http://interactive.colum.edu/students/MMorales/marcomorales/free-mp3.html >free mp3 ringtones</a> ; [url=http://interactive.colum.edu/students/MMorales/marcomorales/free-mp3-songs.html]free mp3[/url] .. [url=http://interactive.colum.edu/students/MMorales/marcomorales/free-music-videos.html]limewire[/url] .. [url=http://interactive.colum.edu/students/MMorales/marcomorales/free-music.html]free music to download[/url] .. [url=http://interactive.colum.edu/students/MMorales/marcomorales/free-mp3-music.html]mp3[/url] .. [url=http://interactive.colum.edu/students/MMorales/marcomorales/listen-to-music.html]listen to music[/url] ..

Hi

http://interactive.colum.edu/students/MMorales/marcomorales/free-music.html free music :: http://interactive.colum.edu/students/MMorales/marcomorales/music.html mp3 downloads :: http://interactive.colum.edu/students/MMorales/marcomorales/free-mp3-downloads.html free mp3 sites :: http://interactive.colum.edu/students/MMorales/marcomorales/shakira-mp3.html shakira mp3 :: http://interactive.colum.edu/students/MMorales/marcomorales/music-search-engines.html music search engines ::

<a href= http://interactive.colum.edu/students/MMorales/marcomorales/limewire.html >limewire</a> ; <a href= http://interactive.colum.edu/students/MMorales/marcomorales/free-music-downloads.html >free music downloads</a> ; <a href= http://interactive.colum.edu/students/MMorales/marcomorales/downloadable-music.html >classical music downloads</a> ; <a href= http://interactive.colum.edu/students/MMorales/marcomorales/mp3-songs.html >free mp3 songs</a> ; <a href= http://interactive.colum.edu/students/MMorales/marcomorales/free-mp3.html >free mp3 ringtones</a> ;  

[url=http://interactive.colum.edu/students/MMorales/marcomorales/free-mp3-songs.html]free mp3[/url]  .. [url=http://interactive.colum.edu/students/MMorales/marcomorales/free-music-videos.html]limewire[/url]  .. [url=http://interactive.colum.edu/students/MMorales/marcomorales/free-music.html]free music to download[/url]  .. [url=http://interactive.colum.edu/students/MMorales/marcomorales/free-mp3-music.html]mp3[/url]  .. [url=http://interactive.colum.edu/students/MMorales/marcomorales/listen-to-music.html]listen to music[/url]  ..  

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Monday, May 07, 2007 3:24 AM by ino naruto hentai

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Tuesday, June 05, 2007 8:55 AM by Dimitri

Nice

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Wednesday, June 06, 2007 6:02 PM by Aleda

Cool!

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Sunday, June 10, 2007 12:05 AM by Manolis

Cool!

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Sunday, June 10, 2007 8:25 AM by Eleftherios

Sorry :(

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Sunday, June 10, 2007 9:42 AM by Doxiadis

Cool...

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Tuesday, June 12, 2007 2:28 AM by Yiannos

Sorry :(

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Tuesday, June 12, 2007 11:29 PM by Carolos

Cool.

# re: DotNetNuke News Module Enhancement: limiting the number of news items

Thursday, August 09, 2007 9:12 AM by siriuslek

Hi here how are you? I am newbie in weblogs.asp.net so i hope i will get some friends here :)