Jump to content

404 page with 2 urlSegments

Recommended Posts

I allowed urlSegments in my config and for the template I use in this case.
My page doesn't give data outside title and name. This is my template :

  GNU nano 2.7.4                                                                                                         File: liste.php                                                                                                                    

<?php  namespace ProcessWire;
if (preg_match('/^[a-z]{2}$/',$input->urlSegment1)){
$langue=array_search($input->urlSegment1, $toutesleslangues);
$elements = $pages->find("template=enseignement, langue=$langue, sort=-id");
elseif(in_array($input->urlSegment1,$cats_slug) AND preg_match('/^[a-z]{2}$/',$input->urlSegment2)){
$langue=array_search($input->urlSegment2, $toutesleslangues);
$categorie=array_search($input->urlSegment1, $cats_slug);
$elements = $pages->find("template=enseignement, cat=$categorie, langue=$langue, sort=-id");
} else {
 // throw a 404
 throw new Wire404Exception();
include_once "../langues/".$langue_str.".php";

I use twig.
My page works with one urlSegment works but not with two. With two, it is a 404 page. I tested every value. I don't see what goes bad.

This page displays a list of urls.

Thank you for any help.






Share this post

Link to post
Share on other sites


I solved my problem, it was a regex problem in the template.



Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...