3443 Posts in 1030 Topics by 871 members
|Go to End|
3 February 2010 at 5:27am Last edited: 3 February 2010 5:28am
I have a teaser section on many pages, including 4 teaser boxes next to each other. There will be many different teaser boxes and the editor of the site should be able to select in the backend which teaser boxes should be shown in the frontend.
I had the idea to create the teaser boxes as template files in the Includes Folder. Then somehow make the names of the teaser ss.Files selectable via checkboxes in the backend for each Page. Then I would need some logic to check which teaser boxes should be shown. But the most important thing is to know how I can add includes dynamically in the template.
Is this a general good idea or should I try to write widgets?
3 February 2010 at 12:07pm
the templates are the "view" part of MVC. To do this you should create a controller method.Why donÂ´t you just upload images.
3 February 2010 at 10:42pm Last edited: 3 February 2010 10:43pm
there should be actually different types of teaser boxes. one box contains news managed via the cms, other boxes contain swfs or images.
now I try this: every teaser has a type set in the backend. Then the frontend checks for the type:
<% control Teaser %>
<% if TeaserType = News %>
<% include NewsTeaser %>
<% else %>
<% end_if %>
<% end_control %>
the only problem then is that the NewsTeaser is not getting its data anymore. I think this is because NewsTeaser is included in a control. Including the NewsTeaser after the control works fine and the News are shown correctly. I know to use $Top to access variables at top level. But this does not work in a control like <% control Top.News %>. MMh.
NewsTeaser.ss looks like this:
<% control News %>
<p> $Header </p>
<% end_control %>
6 February 2010 at 6:08pm
Why don't you just create widgets? Sounds like basically what you're looking for.
8 February 2010 at 10:45am
heee Hamish! widgets sound great. thats actually the thing i need. but iÂ´m just running into this problem:
|Go to Top|