ProcessWire - URL Segments
Aus Wikizone
Version vom 31. März 2021, 07:59 Uhr von 109.192.169.230 (Diskussion) (Die Seite wurde neu angelegt: „URL Segemente kann man in PW ähnlich auswerten wie GET Parameter https://processwire.com/docs/front-end/how-to-use-url-segments/#best-practices Beispiel <sy…“)
URL Segemente kann man in PW ähnlich auswerten wie GET Parameter
https://processwire.com/docs/front-end/how-to-use-url-segments/#best-practices
Beispiel
// we are only using 1 URL segment, so send a 404 if there's more than 1
if(strlen($input->urlSegment2)) throw new Wire404Exception();
switch($input->urlSegment1) {
case '':
// Segment 1 is empty so display main content
break;
case 'photos':
// Display photo gallery
break;
case 'map':
// Display map
break;
default:
// Anything else? Throw a 404
throw new Wire404Exception();
}