torf Posted February 10, 2022 Share Posted February 10, 2022 For onpager navigation I'm trying to get the name of all template php files so I can include them based on their status (hidden/shown). But I cannot get the names without the path. So foreach($page->children() as $child) { echo $child->template->filename()."<br/>"; } gives me the whole path for each file. In https://processwire.com/api/ref/template/filename/# it is stated, that the argument $filename can omit the path, but without examples I'm to dumb to find out how to use it... PS: of course I could strip it with vanilla php, but if there is already a function for that I'd rather use it. Link to comment Share on other sites More sharing options...
horst Posted February 10, 2022 Share Posted February 10, 2022 $child->template->name or basename($child->template->filename) 1 Link to comment Share on other sites More sharing options...
torf Posted February 10, 2022 Author Share Posted February 10, 2022 basename($child->template->filename) does the job of course, thanks. But I still do not understand how the function in Processwire is used. The reference is not very clear. 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