Zeka Posted September 1, 2016 Share Posted September 1, 2016 Hi. I am really sorry if my question was answered somewhere already, but i can not find this place) Is there some selector like " template_file_exists" which will indicate that I am looking only for pages without template file? Link to comment Share on other sites More sharing options...
LostKobrakai Posted September 1, 2016 Share Posted September 1, 2016 The state "does a template have an existing templatefile" is never kept anywhere. Even the filename itself is constructed at runtime. So you need to do this a bit more manually. $all = $templates->getArray(); $withoutFiles = array_filter($all, function(Template $t) { try{ $filename = $t->filename(); } catch(WireException $e) { return null; // Couldn't construct filename, return } return file_exists($filename); }); array_walk($withoutFiles, function(Template $t) { return $t->id; }); $pages->find("template=" . implode('|', $withoutFiles); 3 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted September 1, 2016 Share Posted September 1, 2016 I guess you can use this method to check the existence of a filename: $page->template->filenameExists(); But it will probably not cover all cases. For example, when there is only one controller-like template for all templates. And I did not find a selector for that, so only in a foreach loop. 4 Link to comment Share on other sites More sharing options...
BitPoet Posted September 1, 2016 Share Posted September 1, 2016 I just had a déjà vu. 3 Link to comment Share on other sites More sharing options...
Zeka Posted September 1, 2016 Author Share Posted September 1, 2016 @LostKobrakai @Ivan Gretsky Thanks for suggestions. @BitPoet 1 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