[ZDP] updating ZDP General news to news classes of Maik

Maik Roeder roeder@berg.net
Wed, 12 Jan 2000 19:24:55 +0100


Hi !



> 1. As title of the news-items I use the date, however, I want to display it
> another format. How to transform a string to a date and use it in dtml-var?

Just some snippets for ideas. (Untested)

snippet1:
<dtml-var "_.DateTime(adatestring) + 5" fmt="%m/%d/%y">

snippet2:
<dtml-call "REQUEST.set('varDate',ZopeTime())">
<dtml-var varDate fmt=day>

snippet3:
<dtml-call "REQUEST.set('varDate', ZopeTime().Day())">
ZopeTime() returns the current time as a DateTime object.
The Day() method returns the name of the day of the week.
The DateTime methods are in Appendix A of the DTML Guide.

> 2. The news items are now displayed on html basis... this means now that
> I've to put everyware <p>, <br> tags. Is it possible to change the news
> class in such a way that both displays are possible? (Eg without <html>
> tags and one with <html> tag? This without overriding the news class
> everytime!

This will have to be handled in DocumentFolder, because there is generally
a need to differentiate between the type of the content.

Solution 1:

* The default is html. The name of the content DTML method is: "content"
* If you have structured text, you place a "content.stx" file in the
  DocumentFolder, and refer to this from the "content" file like:
  <dtml-var content.stx format=structured-text>

But this means putting two documents into the Documentfolder. Not very
elegant.

Solution 2:

* The default is "content" for html
* For structured text, just use "content.stx" and remove "content"
  This means upon creation of a NewsFolder you have to decide that
  you want structured text, and the constructor places the content.stx
  inside the instance.

Now we have to look in the DocumentFolder whether there is a content
file or a content.stx file, and decide how we want to display it. This
also is not so very elegant, because when someone decides to use HTML
instead, you have to copy the file.

Solution 3:

* > Possible with an extra property in the News Class ie. if property is 'html'
  > the n show it like an html, if property is 'stx' then show it as structured
  > text etc?

I would say that we need a property in DocumentFolder called "content_type".
This is the type of the content DTML method, which is in every DocumentFolder.
I like this solution best. I'll add the property in a moment with default
value "html".

Greetings, 

Maik