Jump to content

Does PW support organizing Template files in sub Dirs ?


EyeDentify
 Share

Recommended Posts

Hello Fellow PW users and fans.

I have a simple question that needs an answer.

Have been working on a pretty complex site know for a while and lots of template files.

So i was wondering if i could for sake of keeping everything organized could sort my template files in sub directorys and still have PW recognize these template files and find them when needed ?

Or do i have to keep them all in the same "template" dir.

I know how to use include() and all that. So thats not what i am after.

Because i would like to distinguish my main template files and some that are experimental and possibly not going to be used in the finished site.

And there getting to be alot of them at this point and at times a bit confusing to distinguish them.

Well there you have it.

thanks in advance.

 

Link to comment
Share on other sites

By default it's not possible to use subdirs, but you can use the settings for each template to change the file the template is associated with. Either just update it for some of your templates or just associate any template with some kind of routing.php, where you can implement any custom logic to route requests to the correct files.

  • Like 2
Link to comment
Share on other sites

By default it's not possible to use subdirs, but you can use the settings for each template to change the file the template is associated with. Either just update it for some of your templates or just associate any template with some kind of routing.php, where you can implement any custom logic to route requests to the correct files.

Hello LostKobrakai.

Thank you for the fast answer.

I will have to give this some thought how to go about it.

Link to comment
Share on other sites

By default it's not possible to use subdirs, but you can use the settings for each template to change the file the template is associated with. Either just update it for some of your templates or just associate any template with some kind of routing.php, where you can implement any custom logic to route requests to the correct files.

By the way, could you give an example of this "route.php" stuff you mentioned ?

Link to comment
Share on other sites

Because i would like to distinguish my main template files and some that are experimental and possibly not going to be used in the finished site.

You might also want to consider adapting one of these methods:

Probably good for experimental purposes too:

https://processwire.com/talk/topic/9638-different-templates-folder-for-different-usersroles/

Best for replacing (e.g. based on some sort for conditions) complete "front end themes":

http://processwire-recipes.com/recipes/use-different-sets-of-template-files/

And we also have Adrian's Tracy Debugger which supports "hacking" the compiler cache of ProcessWire 3.x for temporay testing purposes. But this is probably not what you need in this case, I just mentiond it for the record.

EDIT: "typo"

  • Like 2
Link to comment
Share on other sites

Because i would like to distinguish my main template files and some that are experimental and possibly not going to be used in the finished site.

For 'experimental templates' I often use Select File Fieldtype, when that field is attached to a template, pages using that template can select a file that will be used as template. See the field settings for the options. 

  • Like 3
Link to comment
Share on other sites

Thank you all for your tips and answers.

I think i might have explained things wrong.

The only purpose i have is for me to have a way to organize things so its more clear.

Like in my Editor or in my FTP client.

Not that i wish to switch certain template files for specific templates and so on.

Its purely a organization issue.

But i thank you anyway.

szabesz seems to come closest to what i was after.
I will have a look.

  • Like 1
Link to comment
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
 Share

×
×
  • Create New...