[TYPO3-english] best practise for multiple layouts (layout selector) with tx_news?

Stephan Schuler Stephan.Schuler at netlogix.de
Fri Aug 1 16:39:51 CEST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hey there.

What about this:
<f:layout name="my-layout-{settings.templateLayout}" />

There are two drawbacks of this:

1: You need to have every possible layout available as a distinct layout file. If you miss one of those which gets called there is no "default" but your FE will end up in an exception.
1.1: The "my-layout-1.html" to "my-layout-99.html" files are pretty obvious, but just in case there is no templteLayout setting at all, you need a "my-layout-.html" file as well.
2: And obviously this is only possible once per template.

If you want to switch rendering per news type, just drop the singleNewsElement fragment to partials.

<f:render partial="single-news-{news.type}" arguments="{_all}" />

I don't know if the "type" property is supported by default tx_news. I don't refer to specific tx_news mechanisms but to fluid in general.

If you have lots of different options, like ~30 different result types of solr results in a search result, this becomes very handy. My most recent projects always had search result types like news-default, news-internal, news-special-events, page-default, page-product-details, location, fal-default, fal-special-publication, whatever. The result types where decided when indexing records, obviously there are subtypes. Instead of creating a huge if/else thingy I always split those up into individual partial files. I find this much easier to understand and maintain.

Regards,


Stephan Schuler
Web-Entwickler

Telefon: +49 (911) 539909 - 0
E-Mail: Stephan.Schuler at netlogix.de
Website: media.netlogix.de



- ----------------------------
netlogix IT-Training Sommerspecial 2014
Buchen Sie eines unserer Aktionsseminare und Sie erhalten ein Apple iPad oder Dell Tablet.
Eine Übersicht finden Sie unter http://it-training.netlogix.de/angebote/training-specials/netlogix-sommerspecial-2014
- ----------------------------



- --
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Neuwieder Straße 10 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Internet: http://www.netlogix.de

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt



- -----Ursprüngliche Nachricht-----
Von: typo3-english-bounces at lists.typo3.org [mailto:typo3-english-bounces at lists.typo3.org] Im Auftrag von bernd wilke
Gesendet: Freitag, 1. August 2014 11:37
An: typo3-english at lists.typo3.org
Betreff: Re: [TYPO3-english] best practise for multiple layouts (layout selector) with tx_news?

Am 28.07.14 08:45, schrieb bernd wilke:
> not much traffic on typo3.projects.news so I try it here anew:

no response here either

everyone uses the given templates?
or only in slight modification?


bernd
- --
http://www.pi-phi.de/cheatsheet.html
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english

-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 3.3.2 (Build 15238)
Charset: utf-8

wpUDBQFT26a4pp0IwsibV8MBCPCVBACI1TxPYuwu9CQYTYKVGDz1F366t4X6YuH2
OrQc9Rp0kf9zS9Mc1FyGcgwNU03t03jyJ26w8qDVbC6v0rYHLtZhgNvhkWZzzYBS
XhUK1J/sVJNkroLqG0wKOGZjWp397gDCyd2ihko01WVuktk0JEgwt+MacRslmdCj
G2fCjlTdRQ==
=wbaV
-----END PGP SIGNATURE-----


More information about the TYPO3-english mailing list