I needed to create a news lister and publishing capability for a client and used NewsEditor/Publisher. I’ll try to put everything down here - at the very least it might make for some diversionary reading and prevent the whole head-exploding thingy from happening ...
So the the goal was to have a page show news events summaries, with pagination and links to "More..." if someone wanted to go directly to the entry. And the news items would be entered by a logged in web user, via a menu entry that would only appear to them. Here goes ...
Created a document called - predictably - "News" and made it a published, shown in the menu, container. The content was this call
<h2>[*longtitle*]</h2>
[[Ditto? &parents=`5` &tpl=`news_tpl` &display=`4` &paginate=`1` &paginateAlwaysShowLinks=`0`]]
<p class="ditto_pages"><span class="hspace">[+previous+]</span> <span class="hspace">[+pages+]</span> <span class="hspace">[+next+]</span></p>
"5" happens to be the page itself, "news_tpl" a chunk that formats the summaries, display 2 stories at a time, yup-I-want-pagination, and then placeholders.
Create another document, which I call NewsEditor. The call that the client site is using is this one :
[!idw_NewsEditor? &folder=`5` &rtcontent=`content` &template=`newstemp` &cacheable=`0` &showinmenu=`0` &clearcache=`1` &makefolder=`1` &formtpl=`idw_newsItem_tpl` &headertpl=`newsHeader` &footertpl=`newsFooter`!]
[!WebLogin!]
"idw_NewsEditor" is my version of NewsEditor (v1.0, since superceded), which I amended to make sure a published page was cacheable/non-cacheable. This was needed because Ditto (if I recall) because Ditto is called cacheable on an non-cached page. I think. In all honesty, I’d have to fish through everything to figure out why I stumbled on that as a solution. I also changed it to change <cr><lf> to HTML
because the client has a habit of cut and pasting from other apps. Anyway, pressing on ...
The template is what is used to display the full item and the formtpl formats the entry of the item. We also wanted to have a chunk for a header and a footer, the latter containing a "Return to news" button.
The chunk referred to by formtpl is this
<form name="NewsEditor" method="post">
<input name="NewsEditorForm" type="hidden" value="on" />
<input name="editid" type="hidden" value="[+editid+]" />
Page title:<br /><input name="pagetitle" type="text" size="40" value="[+pagetitle+]"
/><br />
Long title:<br /><input name="longtitle" type="text" size="40" value="[+longtitle+]"
/><br />
<!--COMMENTING OUT, NOT NEEDED Description:<br /><input name="description" type="text" size="40"
value="[+description+]" /><br />-->
Published date:<a onClick="nwpub_cal1.popup();" onMouseover="window.status=\'Select
date\'; return true;" onMouseout="window.status=\'\'; return true;" style="cursor:pointer;
cursor:hand"><img align="absmiddle" src="manager/media/style/MODxLight/images/icons/cal.gif"
width="16" height="16" border="0" alt=" Select " /></a>
<a onClick="document.NewsEditor.pub_date.value=\'\'; return true;"
onMouseover="window.status=\'Remove date\'; return true;" onMouseout="window.status=\'\';
return true;" style="cursor:pointer; cursor:hand"><img align="absmiddle"
src="manager/media/style/MODxLight/images/icons/cal_nodate.gif" width="16" height="16"
border="0" alt=" Remove "></a><br /><input name="pub_date" type="text" value="[+pub_date+]"
size="40" readonly="readonly" /><br />
Unpublished date:<a onClick="nwpub_cal2.popup();" onMouseover="window.status=\'Select
date\'; return true;" onMouseout="window.status=\'\'; return true;" style="cursor:pointer;
cursor:hand"><img align="absmiddle" src="manager/media/style/MODxLight/images/icons/cal.gif"
width="16" height="16" border="0" alt=" Select " /></a>
<a onClick="document.NewsEditor.unpub_date.value=\'\'; return true;"
onMouseover="window.status=\'Remove date\'; return true;" onMouseout="window.status=\'\';
return true;" style="cursor:pointer; cursor:hand"><img align="absmiddle"
src="manager/media/style/MODxLight/images/icons/cal_nodate.gif" width="16" height="16"
border="0" alt=" Remove "></a>
<br /><input name="unpub_date" type="text" value="[+unpub_date+]" size="40"
readonly="readonly" /><br />
Summary:<br /><textarea name="introtext" cols="40" rows="5">[+introtext+]
</textarea><br />
Content:<br /><textarea name="content" cols="40" rows="8">[+content+]</textarea><br />
<input name="send" type="submit" value="Submit" />
</form>
<script language="JavaScript" src="manager/media/script/datefunctions.js"></script>
<script type="text/javascript">
var elm_txt = {}; // dummy
var pub = document.forms["NewsEditor"].elements["pub_date"];
var nwpub_cal1 = new calendar1(pub,elm_txt);
nwpub_cal1.path="[(base_url)]manager/media/";
nwpub_cal1.year_scroll = true;
nwpub_cal1.time_comp = true;
var unpub = document.forms["NewsEditor"].elements["unpub_date"];
var nwpub_cal2 = new calendar1(unpub,elm_txt);
nwpub_cal2.path="[(base_url)]manager/media/";
nwpub_cal2.year_scroll = true;
nwpub_cal2.time_comp = true;
</script>
The footer chunk looks like
<div class="nm_button" align="center">
<form name="returntonews" method="post" action="[~5~]">
<input type="submit" class="button" name="returntonews" value="Return to News" />
</form>
</div>
The header chunk is
<h2>[*longtitle*]</h2></br><p>
The chunk referred to by Ditto is
<h4><a href="[~[+id+]~]">[+longtitle+]</a></h4>
[+introtext+]
<a href="[+url+]"><b>read more...</b></a>
And newstemp was a stripped down template used to show the individual articles.
I’ve been looking at the latest version of NewsEditor (v1.4) which I think has been amended to deal with TVs. But I haven’t really made any progess on it yet, having just downloaded the code from Google (I think) yesterday.
Hope this helps. And if anyone sees things I shoulda/coulda done differently, I’d appreciate hearing about it.
MattC