Sten Posted August 22, 2018 Share Posted August 22, 2018 Hi, 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(); } $langue_str=$toutesleslangues[$langue]; include_once "../langues/".$langue_str.".php"; $cat=${"cats_".$langue_str}[$page->cat]; $view->set("posts",$elements); ?> 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. Link to comment Share on other sites More sharing options...
Sten Posted August 23, 2018 Author Share Posted August 23, 2018 Hi, I solved my problem, it was a regex problem in the template. 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