0
votes

I'm working on a magazine page. Therefor I would like the client to be able to select the design type when creating/editing a new post. So I'd like to add a custom field to the "edit news", something like a dropdown where all the news (design) types are listed.

For example: News Types:

  • Normal
  • Interview
  • Date
  • Special Event

etc...

When the client doesn't select anything it should fallback to a default i.e "Normal" and also it would be nice that when the client selects Interview a second input field shows up where he can enter the persons profession/description.

My goal is, that in the fluid template I can add a line where the selected news type will be added as a class to the list item, something like:

<div class="news-item {newsItem.type}"> 
// some code
</div>

will render out as:

<div class="news-item interview">
// some code
<div>

I'm not quite sure what I have to add to my custom extension that I'm using to accomplish that.

I appreciate all the help.

1

1 Answers

1
votes

you need to extend the news data with further fields. This is described in the manual and this blog(ext:news is extended, but filestructure is old) and this article(current fielstructure, but other tabel is enhanced).

For the evaluation and displaying of your fields you need to modify the templates of ext:news. copy the neccessary parts into your extension and provide the modifications to it.
Also set the typoscript to include your templates like described in the manual.