jds43 Posted August 25, 2021 Share Posted August 25, 2021 Hello, I would like to output content on a template at the url /events/, but not /events/?publish_from=2021-08-24&publish_until=2021-08-31. Tried using the wildcard character as referenced here, but no dice. Does anyone know to achieve this? $segmented_events = $input->urlSegment('publish_(*)'); if(!$segmented_events) { // output only on /events/ } Link to comment Share on other sites More sharing options...
Rudy Posted August 25, 2021 Share Posted August 25, 2021 @jds43 urlSegment will not capture URL query strings. If you want something like that, you might want to use $_SERVER['query_string'] output for your if condition. 2 Link to comment Share on other sites More sharing options...
Pixrael Posted August 25, 2021 Share Posted August 25, 2021 59 minutes ago, Rudy said: @jds43 urlSegment will not capture URL query strings. If you want something like that, you might want to use $_SERVER['query_string'] output for your if condition. .. or you can use $input->get() check docs here: https://processwire.com/api/ref/wire-input/get/ if you want to learn how to use ulrSegments, read this: https://processwire.com/docs/front-end/how-to-use-url-segments/ 3 Link to comment Share on other sites More sharing options...
jds43 Posted August 25, 2021 Author Share Posted August 25, 2021 Thanks @Rudy and @Pixrael! I wasn't aware urlSegment would not capture URL query strings. I went this route: if(!isset($_GET['publish_from']) || !isset($_GET['publish_until'])) { // output only on /events/ } 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now