Previewtext and archive for newslist Options
Animal
Posted: Monday, October 06, 2008 7:03:31 PM
Rank: Newbie

Joined: 10/1/2008
Posts: 10
Location: Sweden
Hi!

I´m working on the company site and we´r using Umbraco. Very nice CMS, but I´m stuck. I need tips and code for two things:

- A date archive for the newslist

- How to set the length of the bodyText in each item.

I will be glad for all the help I can get...:)
Dirk
Posted: Monday, October 06, 2008 7:13:40 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi,

Great choice :)

Ok, you want some tips and code!

Quote:
A date archive for the newslist

What exactly do you want? An archive of news items that are older than a date specified? Be a bit more specific please, as this is a rather vague description

Quote:
How to set the length of the bodyText in each item

Do you wish to specify how long each item's bodyText can be? If so, I'm afraid this is not available out-of-the-box! But, you could at least limit the number of characters on the front-end to 300 chars for example. If you wish to inform the users about this limit, use the 'Description' field when creating the document type's property.

If you need more info, shout!

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Animal
Posted: Monday, October 06, 2008 7:25:35 PM
Rank: Newbie

Joined: 10/1/2008
Posts: 10
Location: Sweden
I want a traditional newsarchive that archives newsitems after month/year so the user can get a good view over all the newsitems. So an archive of news items that are older than present date should work.

Yes, I want to limit the number of characters on the front-end to let´s say 255 chars.

Very quick reply are u the Umbraco lightning support...Angel
Dirk
Posted: Monday, October 06, 2008 8:06:03 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi,

Here's the umbraco lightning support... ;)

Limiting the numbers of characters can be done using the xslt substring() function (Assuming you're using xslt to display the info).

And, limiting the items that are shown in the news section is also just a matter of having the right constraint on a for-each statement.

For example: if you only want the news items, you'd write:

Code:
<xsl-for-each select="$currentPage/node [@alias = 'NewsItem']">
  blabla...
</xsl:for-each>


Limiting the news items to only show those that are no older than 7 days, you'd use one of the built-in xslt extensions methods. Extension methods are available from the right side dropdown when opening the 'Insert xslt:value-of' dialog. Look for the date functions in there. At least one should be a good choice for you to use.

Hope that helps.

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Animal
Posted: Monday, October 06, 2008 9:32:20 PM
Rank: Newbie

Joined: 10/1/2008
Posts: 10
Location: Sweden
I will give these tips a try at work tomorrow. I dont´n know how I could miss the substring() function...d'oh!

Regarding the archive function I really want a dedicated page where all the newsitems will be sorted by date(year/month)...
Dirk
Posted: Monday, October 06, 2008 9:53:27 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi,

Quote:
Regarding the archive function I really want a dedicated page where all the newsitems will be sorted by date(year/month)...


Have a look at Tim Geyssens Datefolder package. Not sure if it suit your needs...

Hope that helps.

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Animal
Posted: Tuesday, October 07, 2008 1:59:53 PM
Rank: Newbie

Joined: 10/1/2008
Posts: 10
Location: Sweden
Now I have solved the news previewText so thanks for the tip. One down one to go...

I will give the datefolder a try and see if I can bake a archive script from that.
Dirk
Posted: Tuesday, October 07, 2008 2:04:58 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi,

Just a side note: using Tim's datefolder would make it much easier to work with news items in the backend, you'd still need some xslt to create the front end functionality.

But as you've got the structure already in place then, it should be more obvious to list the news items per year/month/day.

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Animal
Posted: Friday, October 10, 2008 12:05:51 PM
Rank: Newbie

Joined: 10/1/2008
Posts: 10
Location: Sweden
Well, I tried the datefolder packed and it moved my news content to a very strange node structure. So now I wounder if there is anyway to do a rollback on this?
Dirk
Posted: Friday, October 10, 2008 12:17:09 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi,

Hope that isn't on a production server? I'm not aware of a reverting scenario, so in my humble opinion... you're stuck there.

Can you elaborate on the 'strange' node structure?

Regards,
/Dirk

level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Animal
Posted: Friday, October 10, 2008 1:01:50 PM
Rank: Newbie

Joined: 10/1/2008
Posts: 10
Location: Sweden
No not on a production server, But I have a complete backup of the whole structure and the database. So it should be possible to revert the action that way? Or just create a new datatype that are not affected by the datefolder script?
Dirk
Posted: Friday, October 10, 2008 1:16:18 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi,

Great to have a backup. Not sure if you really need to create a new datatype to avoid it being 'Datefied'. But it wouldn't hurt if you do.

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Animal
Posted: Friday, October 10, 2008 1:20:36 PM
Rank: Newbie

Joined: 10/1/2008
Posts: 10
Location: Sweden
hmmm, maybe it will be enough with a new news document type. Do you know if one can control and change wich of the dcocument types that will be affected?
Animal
Posted: Monday, October 13, 2008 9:32:38 AM
Rank: Newbie

Joined: 10/1/2008
Posts: 10
Location: Sweden
I solved it. Created new documentTypes and republished the site. Now it´s as good as new. But I still have the possibility to use DateFolder. So in the end it worked out to be a positive thing. Thanks for the help.
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.