Developer forum

Forum » Templates » Show random news from a newscategory

Show random news from a newscategory


Reply

Our client has a lot of so-called LEAN-statements that need to "rotate" on their intranets frontpage. These statements has to be editable which makes us want to utilize the news-module.

 

A random statement has to be shown each time the frontpage of the intranet loads or reloads.

 

Can this be done with a javascript randomizing through a set of news-id's ?
Or does anybody have a better idea?

It wouldn't be possible to use the rotation function in Dynamicweb since there's simply too many statements, ie. meaning too many hidden versions of the frontpage.

 

Also, we would like to avoid turning the solution into custom...


Replies

 
Reply

Hi Martin,

 

We use the javascript solution you mention quite a lot and works fine for us. Would also be nice to see if anyone has a better way.

 

Regards,

Nuno

 
Reply

Hi Nuno,

Would it be possible for you to share that code?

It would be greatly appreciated!

 

/morten

 
Reply

Hi Morten,

 

This code publishes 4 random news in random location out of the number of news selected in the paragraph settings.

 

Enjoy :P

 

Nuno

 
Reply
Seems the code is no longer linked to the post - could you please upload it again?
 
Reply
Sure,

Here it goes

 

You must be logged in to post in the forum