Create a news entry list

Posted by Helmut_pdorf on 20 Feb 2011 09:13, last edited by Helmut_pdorf on 20 Feb 2011 09:15

: news notice

rating: 0

Original Question cames from http://community.wikidot.com/forum/t-303831/news-entry-to-my-website#post-1006569

Here I copied the answer from RobElliott RobElliott

To display the notices on the noticeboard page you need to add a ListPages module. The full steps I used to display the notices on the page here are shown below. I always use a dataform for notices.

1. new page button

1) on an admin page where you want to place a button to add a new notice add the following new page button code:

[[table class="newpage-button" style="width: 215px;"]][[row]][[cell style="text-align: center;"]]
[[[[!----]/[!----]noticeboard:[!----]notice/edit/true[!----][!--/tags/notags[!----][!----]/parentPage/noticeboard[!----][!----]|Add a new noticeboard item]]][[/cell]][[/row]][[/table]]
[!----]
[[module CSS]]
@import url(http://snippets.wdfiles.com/local--code/code:newpage-button);
[[/module]]
[!----]

2. Category Autonumbered

2) in the site manager make the noticeboard category autonumbered.

3. Dataform to _template

3) add the following dataform syntax to the noticeboard:_template page:

[[form]]
fields:
 noticetext:
 label: Notice text
 type: text
 width: 100
 height: 5
 download:
 label: Open file
 type: file
 download2:
 label: Open file
 type: file
 download3:
 label: Open file
 type: file
 url:
 label: Related website link
 type: url
 default-schema: http://
[[/form]]

4.Show most recent 5 News entrie

4) On the page where you the notices are to be displayed add the following ListPages module which calls the relevant fields from the dataform. The most recent 5 notices only are displayed:

[[module ListPages category="noticeboard" order="created_at desc" limit="5"]]
+++ %%title_linked%%
%%form_data{noticetext}%%
File: %%form_data{download}%%
File: %%form_data{download2}%% 
Related Website: %%form_data{url}%%
Go to %%linked_title%%
//Posted by RFPG on %%created_at|%e %B %Y%%//
[[div style="border-bottom:2px solid #223773;"]]
[[/div]]
[[/module]]

5. Show "old" News in Summary

You need to use the offset parameter in the ListPage module. So if you are displaying the most recent 5 notices then to display older items than the most recent 5 your offset will be 5, that is it will not include the most recent 5 entries, as in the example below:

[[module ListPages category="noticeboard" perPage="10" order="created_at desc" offset="5" limit="6" separate="false" prependLine="||~ Date ||~ Title ||" appendLine="||||||~ ||"]]
|| %%date|%d/%m/%y%% || %%title_linked%% ||
[[/module]]

Hope that helps.

Thanks to RobElliott for the codes!

Related

Author

RobElliott RobElliott . Please visit his/her userPage.



Related articles

Comments

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).
Notify administrators if there is objectionable content in this page.
Something does not work as expected? Find out what you can do.
General Wikidot.com documentation and help section.
Wikidot.com Terms of Service - what you can, what you should not etc.
Wikidot.com Privacy Policy.

AltStyle によって変換されたページ (->オリジナル) /