Zum Inhalt springen

pi_getPageLink 2 Variablen anhängen

Erstellt am 29. April 2012 · 3 Antworten · letzte Antwort am 2. Mai 2012

Tags: Links, Frage

typo3_hp ·

Guten abend!

Ich bekomme mittels unten angehängtem Code bereits erfolgreich eine URL wie folgt.

domain.de/ueber-uns/team/?location_id=1

Nun möchte ich aber noch 2 zusätzliche Variablen mit dran hängen und bekomme das nicht hin.

So soll es dann aussehen:
domain.de/ueber-uns/team/?location_id=1&var2=2&var3=3

Wie muss ich es vom Syntax her machen?

$content4 .=    '<option value=" '.  $this->pi_getPageLink($GLOBALS['TSFE']->id,'',array($this->empty.'location_id'=> $basis_location_temp['uid'])) . ' "> ' . $basis_location_temp['locationname_de'] . '</option>';

Eine andere Frage in diesem Zusammenhang:

Es ist möglich eine Variable auszuwählen, oder auch alle 3! Die die noch nicht ausgefüllt sind haben den Wert 0.
Wie kann ich es in einem anderen Bereich der Seite hinbekommen, dass in der where-Clausel der Abfrage nur die Where-Klauseln ausgeführt werden, wo die Variable einen Wert <> 0 hat?

D.h. es würde 3 where/and - Klauseln geben, für alle 3 o.g. Variablen. Sofern nur eine ausgefüllt ist, sollte dies im Select berücksichtigt werden!

Danke und Grüße!

vince ·

hallo,

domain.de/ueber-uns/team/?location_id=1&var2=2&var3=3

z.B. so:

$this->pi_getPageLink($GLOBALS['TSFE']->id,'',array('location_id'=> $basis_location_temp['uid']),'var2'=>'2','var3'=>'3')

der dritte Parameter von pi_getPageLink ist ein array, das alle URL-Parameter enhält.

zur zweiten Frage:
Du könntest mit if-Abfragen schauen welche Varibalen gesetzt sind und dementsprechend die where-clause ändern.

Gruß,
Vince.

typo3_hp ·

Danke!
Habe ich so probiert!

Jedoch bekomme ich dann einen Fehler:

parse error: syntax error, unexpected T_DOUBLE_ARROW

Hier mein Versuch:

$content4 .=    '<option value=" '.  $this->pi_getPageLink($GLOBALS['TSFE']->id,'',array($this->empty.'location_id'=> $basis_location_temp['uid']) ,'competition_id'=>'2','service_id'=>'3' ) . ' "> ' . $basis_location_temp['locationname_de'] . '</option>';

Was passt da noch nicht?

Danke und Grüße

vince ·

sieht aus, als wäre da eine Klammer zu viel oder an der falschen Stelle.
Die runde Klammer nach $basis_location_temp['uid'] muss hinter 'service_id'=>'3'
also so:

$content4 .=    '<option value=" '.  $this->pi_getPageLink($GLOBALS['TSFE']->id,'',array($this->empty.'location_id'=> $basis_location_temp['uid'] ,'competition_id'=>'2','service_id'=>'3')) . ' "> ' . $basis_location_temp['locationname_de'] . '</option>';