Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-10-15 19:58:13

holli.p
Member
From: Pinneberg/Germany
Registered: 2004-04-21
Posts: 83
Website

[de-de] Kategorien durch Komma getrennt

Kleines Problem

Ich möchte über dem Artikel gerne schreiben:

“Aufgeschrieben von “Autor” am “Datum” in “Kategorie 1” und “Kategorie 2”

Das sehe dann ja so aus:

Aufgeschrieben von <txp:author link="1" /> am <txp:posted /> in <txp:category1 title="1" link="1" wraptag="span" class="cat" /> und <txp:category2 title="1" link="1" wraptag="span" class="cat" />

Was mache ich aber mit dem “und” wenn der Artikel nur einer Kategorie zugeordnet ist?

Dank schon mal im Vorraus

Holger


Visit my Textpattern sites:
Northerndelight | Hasenbude
Curiculum Vitare | Rezepteblock

Offline

#2 2009-10-16 09:30:08

trenc
Plugin Author
From: ⛵️, currently Göteborg, SE
Registered: 2008-02-27
Posts: 574
Website GitHub

Re: [de-de] Kategorien durch Komma getrennt

Hi Holger,

Du kannst vorher abfragen, ob Kategorie2 überhaupt vergeben wurde:

<txp:variable name="has_cat2" value='<txp:category2 />' />

Aufgeschrieben von <txp:author link="1" /> am <txp:posted /> in <txp:category1 title="1" link="1" wraptag="span" class="cat" /><txp:if_variable name="has_cat2" value="" /><txp:else /> und <txp:category2 title="1" link="1" wraptag="span" class="cat" /></txp:if_variable>

Last edited by trenc (2009-10-16 09:30:51)


Digital nomad, sailing the world on a sailboat: 32fthome.com

Offline

#3 2009-10-17 16:09:49

holli.p
Member
From: Pinneberg/Germany
Registered: 2004-04-21
Posts: 83
Website

Re: [de-de] Kategorien durch Komma getrennt

Hmm, wenn ich das so bei mir reinkopiere zerschießt es das ganze Layout..


Visit my Textpattern sites:
Northerndelight | Hasenbude
Curiculum Vitare | Rezepteblock

Offline

#4 2009-10-17 17:44:29

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [de-de] Kategorien durch Komma getrennt

Aufgeschrieben von <txp:author link="1" /> am <txp:posted /> in <txp:category1 title="1" link="1" wraptag="span" class="cat" /><txp:if_article_category number="2"> und <txp:category2 title="1" link="1" wraptag="span" class="cat" /></txp:if_article_category>

Offline

#5 2009-10-18 01:02:48

trenc
Plugin Author
From: ⛵️, currently Göteborg, SE
Registered: 2008-02-27
Posts: 574
Website GitHub

Re: [de-de] Kategorien durch Komma getrennt

holli.p schrieb:

Hmm, wenn ich das so bei mir reinkopiere zerschießt es das ganze Layout..

Erm ‘tschuldigung. Da war ein Slash zuviel drin:

<txp:variable name="has_cat2" value='<txp:category2 />' />
Aufgeschrieben von <txp:author link="1" /> am <txp:posted /> in <txp:category1 title="1" link="1" wraptag="span" class="cat" /><txp:if_variable name="has_cat2" value=""><txp:else /> und <txp:category2 title="1" link="1" wraptag="span" class="cat" /></txp:if_variable>

Aber die Variante von Els ist eleganter. Würde ich bevorzugen, da umgehst Du die zusätzliche Variable.


Digital nomad, sailing the world on a sailboat: 32fthome.com

Offline

#6 2009-10-18 08:01:52

holli.p
Member
From: Pinneberg/Germany
Registered: 2004-04-21
Posts: 83
Website

Re: [de-de] Kategorien durch Komma getrennt

@ Els
Danke, so klappts auch!


Visit my Textpattern sites:
Northerndelight | Hasenbude
Curiculum Vitare | Rezepteblock

Offline

Board footer

Powered by FluxBB