[TYPO3-german] DCE Typolink Parameter variabel füllen

Dr. Dieter Porth web37p2 at web59550.greatnet-hosting.de
Thu Aug 17 19:26:17 CEST 2017


Hallo Ben

Fluid-Konvertierungsregeln, die man meines Wissens so nicht in der 
Dokumentration findet. Es gibt einen Online-Service, glaube ich, einen 
Service zur Konvertierung von Fluid-Ausdrücken. Aber ich habe den Link 
leider vergessen, wvielleicht kann dazu einer der Mitleser hier helfen.

0. Regel Tags ohne Inhalt <a></a> konvertiert man zu <a/>

1. Inhalte werden zu Attributen subject="" (Kann bei Viewhelper 
unterschiedlich sein - Am besten in den Sourcode die Kommentare lesen

2. aus < >wird {}

3. Attribute werden in () aufgezählt

4. a="b" wird zu a:'b'

5. Regel findet man in ' '-String  noch ein ' so ist das zu escapen zu \'


Start

<dce:typolink class="link_to" 
parameter="https://www.facebook.com/sharer/sharer.php?u=<f:format.urlencode><f:cObject 
typoscriptObjectPath="lib.pageUrl"> 
</f:cObject>#c429!<f:format.raw>{field.category}</f:format.raw>!<f:format.raw>{contentObject.uid}</f:format.raw>-<f:format.raw>{iterator.cycle}</f:format.raw>-<f:format.raw>{eintrag.content}</f:format.raw></f:format.urlencode>" 
target="_blank">teilen</dce:typolink>

0. regel

<dce:typolink class="link_to" 
parameter="https://www.facebook.com/sharer/sharer.php?u=<f:format.urlencode><f:cObject 
typoscriptObjectPath="lib.pageUrl" /> 
#c429!<f:format.raw>{field.category}</f:format.raw>!<f:format.raw>{contentObject.uid}</f:format.raw>-<f:format.raw>{iterator.cycle}</f:format.raw>-<f:format.raw>{eintrag.content}</f:format.raw></f:format.urlencode>" 
target="_blank">teilen</dce:typolink>

1. Regel

<dce:typolink class="link_to" 
parameter="https://www.facebook.com/sharer/sharer.php?u=<f:format.urlencode><f:cObject 
typoscriptObjectPath="lib.pageUrl" /> #c429!<f:format.raw 
subject="{field.category}" />!<f:format.raw 
subject="{contentObject.uid}" /><f:format.raw 
subject="{iterator.cycle}"><f:format.raw 
subject="{eintrag.content}"></f:format.urlencode>" 
target="_blank">teilen</dce:typolink>

2. Regel

<dce:typolink class="link_to" 
parameter="https://www.facebook.com/sharer/sharer.php?u=<f:format.urlencode>{f:cObject 
typoscriptObjectPath="lib.pageUrl" } #c429!{f:format.raw 
subject="{field.category}" }!{f:format.raw subject="{contentObject.uid}" 
]{f:format.raw subject="{iterator.cycle}"]{f:format.raw 
(subject="{eintrag.content}"}</f:format.urlencode>" 
target="_blank">teilen</dce:typolink>

3. Regel

<dce:typolink class="link_to" 
parameter="https://www.facebook.com/sharer/sharer.php?u=<f:format.urlencode>{f:cObject 
(typoscriptObjectPath="lib.pageUrl" )} #c429!{f:format.raw 
(subject="{field.category}" )}!{f:format.raw ( 
subject="{contentObject.uid}") ]{f:format.raw 
(subject="{iterator.cycle}")}{f:format.raw 
(subject="{eintrag.content}")}</f:format.urlencode>" 
target="_blank">teilen</dce:typolink>

4. Regel

<dce:typolink class="link_to" 
parameter="https://www.facebook.com/sharer/sharer.php?u=<f:format.urlencode>{f:cObject(typoscriptObjectPath:'lib.pageUrl' 
)} #c429!{f:format.raw (subject:'{field.category}' )}!{f:format.raw ( 
subject:'{contentObject.uid}') ]{f:format.raw 
(subject:'{iterator.cycle}')}{f:format.raw 
(subject:'{eintrag.content}')}</f:format.urlencode>" 
target="_blank">teilen</dce:typolink>

Wenn noch <x:... in <y: enmthalten sind, die regel nochmal

0. regel

----

1. Regel

<dce:typolink class="link_to" 
parameter="https://www.facebook.com/sharer/sharer.php?u=<f:format.urlencode 
subject=" {f:cObject(typoscriptObjectPath:'lib.pageUrl' )} 
#c429!{f:format.raw (subject:'{field.category}' )}!{f:format.raw ( 
subject:'{contentObject.uid}') ]{f:format.raw 
(subject:'{iterator.cycle}')}{f:format.raw 
(subject:'{eintrag.content}')}" />" target="_blank">teilen</dce:typolink>

2. Regel

<dce:typolink class="link_to" 
parameter="https://www.facebook.com/sharer/sharer.php?u={f:format.urlencode 
subject=" {f:cObject(typoscriptObjectPath:'lib.pageUrl' )} 
#c429!{f:format.raw (subject:'{field.category}' )}!{f:format.raw ( 
subject:'{contentObject.uid}') ]{f:format.raw 
(subject:'{iterator.cycle}')}{f:format.raw 
(subject:'{eintrag.content}')}"}" target="_blank">teilen</dce:typolink>

3. Regel

<dce:typolink class="link_to" 
parameter="https://www.facebook.com/sharer/sharer.php?u={f:format.urlencode( 
subject=" {f:cObject(typoscriptObjectPath:'lib.pageUrl' )} 
#c429!{f:format.raw (subject:'{field.category}' )}!{f:format.raw ( 
subject:'{contentObject.uid}') ]{f:format.raw 
(subject:'{iterator.cycle}')}{f:format.raw 
(subject:'{eintrag.content}')}")}" target="_blank">teilen</dce:typolink>

4. Regel

<dce:typolink class="link_to" 
parameter="https://www.facebook.com/sharer/sharer.php?u={f:format.urlencode( 
subject:'{f:cObject(typoscriptObjectPath:'lib.pageUrl' )} 
#c429!{f:format.raw (subject:'{field.category}' )}!{f:format.raw ( 
subject:'{contentObject.uid}') ]{f:format.raw 
(subject:'{iterator.cycle}')}{f:format.raw 
(subject:'{eintrag.content}')} ')}" target="_blank">teilen</dce:typolink>

5. Regel

<dce:typolink class="link_to" 
parameter="https://www.facebook.com/sharer/sharer.php?u={f:format.urlencode( 
subject:'{f:cObject(typoscriptObjectPath:\'lib.pageUrl'\ )} 
#c429!{f:format.raw (subject:\'{field.category}\' )}!{f:format.raw ( 
subject:\'{contentObject.uid}\') ]{f:format.raw 
(subject:\'{iterator.cycle}\')}{f:format.raw 
(subject:\'{eintrag.content}\')} ')}" target="_blank">teilen</dce:typolink>

So ungefähr könnte dein Kram aussehen, wobei ich nicht weiß, ob subject 
richtig ist.


Grundsätzlich gilt, dass du dir

{f:format.raw (subject:\'{iterator.cycle}\')}

genauso anzeigen lassen kannst wie

<f:format.raw>{iterator.cycle}</f:format.raw>


Wenn dir das ganze zu unübersichtlich ist, könntest du auch f:alias zur 
Strukturierung verwenden Oft kann man gemäß auch eine Regel 6 anwenden. 
(Gilt z.B. nicht in Conditions vom if-Viewhelper)

Regel 6. Werden reine Objekte als String übergeben, wie in {f:format.raw 
(subject:\'{eintrag.content}\')}, so kann man '{ }' weglassen und 
{f:format.raw (subject:eintrag.content)} schreiben.

<f:alias map="{ myLinkstart: 
'https://www.facebook.com/sharer/sharer.php?u=',
   paraOne :{f:cObject(typoscriptObjectPath:'lib.pageUrl' )},
    paraTwo: ' #c429!{f:format.raw (subject:field.category )}',
    paraThree:'!{f:format.raw ( subject:contentObject.uid) 
}{f:format.raw (subject:iterator.cycle)}{f:format.raw 
(subject:eintrag.content)}'
}">

<dce:typolink class="link_to" 
parameter="{myLinkstart}{{f:format.urlencode( 
subject:'{partOne}{partTw}{partThree}')}

</f:alias>


Du könntest natürlich auch, was ich früher gerne gemacht habe, dir die 
String per TypoScript zusammenbauen lassen und das Typoscript inklusive 
der Argumente per cObject ausgebene lassen. Man muss nur wissen, was in 
der Dokumentation von TYPO3 leider nicht zu finden ist, dass man über 
'field' auf die Werte in den Benannten Argumenten zugreifen kann.

Aber TypoScript ist eher doof, weil es schwer zu debuggen ist.

Mit besten Grüßen

    Dieter



Am 17.08.2017 um 09:31 schrieb Ben Ner:

> ich habe ein DCE und dazu ein Template, in dem Template versuche ich 
> via <dce:typolink> einen Link zu erzeugen. Als Parameter wird mir 
> überall immer nur "{link}" genannt der den fertigen String enthält mit 
> der URL. Wie aber kann ich diesen Link innerhalb des DCE Templates 
> zusammen setzen?
>
> Mein aktueller Versuch:
> <dce:typolink class="link_to" 
> parameter="https://www.facebook.com/sharer/sharer.php?u=<f:format.urlencode><f:cObject 
> typoscriptObjectPath="lib.pageUrl"> 
> </f:cObject>#c429!<f:format.raw>{field.category}</f:format.raw>!<f:format.raw>{contentObject.uid}</f:format.raw>-<f:format.raw>{iterator.cycle}</f:format.raw>-<f:format.raw>{eintrag.content}</f:format.raw></f:format.urlencode>" 
> target="_blank">teilen</dce:typolink>
>
> Hier meckert er mir sofort das innerhalb kein <f: ... > vorkommen 
> darf, kann ich den Rückgabewert von urlencode in einer eigenen 
> Variable speichern und diese dann an typolink übergeben?
> _______________________________________________
> TYPO3-german mailing list
> TYPO3-german at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german

-- 
----
Dr. Dieter Porth - Web-Entwickler



More information about the TYPO3-german mailing list