Jump to content

Concept problem - reduce number of templates


OLSA
 Share

Recommended Posts

Hello,

in my project I have about 20 different content types eg:

- basic item
- news item
- publication (image, description, view restriction etc.)
- gallery
- video file
- document (file pdf, docx...)
- project (project start date, project end date...)
- manager profile (image, CV, position...)
- company (company profile, products category...)
- event (event date, location ...)
- etc...

Also there are shared content with additional templates ("widgets/blocks") where I have about 15 types of widgets (weather module, image banner, text banne, slider, header, link button, notification popup etc...).

To reduce number of templates I create "category" template (for main content), and category template can show "list of news", "list of publications", "list of documents", "list of galleries" etc... Also category can have as child another category.

Problem is that on some "list" need to show or hide some fields, need different number of items/per-page, need different sorting etc.

If I use Ryan "Skyscrapers" concept and create pairs of templates eg:

news -> news_item
events -> event
notifications -> notification
galleries -> gallery
videos -> video
documents -> document
publications -> publication
projects -> project
managers -> manager
companies -> company
discounts ->discount
etc...

In that case I will have very big number of templates/files (~40) but don't need many switches/flags.

I really like option with "category" template, because it reduces number of templates, but on the other need to have switches ("show date", "sort (front) by..." "number of items"). Also additional "price" for that is bigger number of fields (page select).

Also as small note, I don't use "hard core" checks in code (eg. by ID, template name, parent etc..) because I want to avoid administration mistakes/errors, and also to get much as possible flexible management in backend.

What is your suggestion to reduce number of templates when you have many totally different content types?

Right now I can see these options:

1. templates without files and "include/layouts"concept ->  "fat logic" / "_func.php"
2. use files for everything -> "fat templates folder"
3. combination 1+ 2 -> chaotic (my current situation) :)

Thanks and regards,
Sasa

Link to comment
Share on other sites

To reduce number of templates I create "category" template (for main content), and category template can show "list of news", "list of publications", "list of documents", "list of galleries" etc... Also category can have as child another category.

For such things i use URL Segments to have all together....if the urls fitting.

This tip from Horst is even great to have additional "layouts" with one template:

https://processwire.com/talk/topic/9476-new-project-a-nice-growing-kindergarten/#entry91259

regards mr-fan

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...