Jump to content

show/hide fields in page editor according to page?


Jennifer S
 Share

Recommended Posts

I like to limit the number of templates I use so that it is easier to format them consistently. I'll use conditional logic within them to present different elements on different pages (usually by ID). The flip-side to this is that as the site gets built out, my "basic page" templates start to contain a lot of extra fields that are only relevant for a particular sub-set of "basic" pages. Is there a way to suppress fields in the editor according to what page they are on, or do I need to think more globally about includes and such and diversify my templates to address this tendency?

Thanks,

Jenn 

Link to comment
Share on other sites

you could create all the different templates you need for each sub-set page, and then tell them to use the basic-page template; that's how i do it; you should also use the rules for parents/children, that helps a lot with keeping things organized in the admin

  • Like 1
Link to comment
Share on other sites

For "simple" websites I use usually with a 3 column design.

First column is for widgets (pages stored in /widgets/ ) with a checkbox to select it's left postion and a template where to render.

I can put as many pages in the widgets folder as I wish. All left widgets wil show up on the left side of the page sorted on the drag'n'drop order if it have the right template.

If there are no widgets to render, the pixel space is given back to the center column. On every page I can check a widget to disable rendering. 

The second column is for the main content.

The third column acts the same as the first. But then for the right column.

Every widget is aware of $page. So I can use widgets for "photoalbums", link to siblings, children or just to show social media urls etc etc. 

Maybe you can have a look at delegate profile. ( the widget system included )

Ps, Documentation doesn't belong to that version anymore. So ignore it (yeah I'm lazy)

For CSS framework I used Gumbyframework.

Maybe this will help you out simplifying your templates. 

  • Like 1
Link to comment
Share on other sites

I like to solve it by having a lot of specific templates, and only 1 basic-page type template. This is in part because I really like to keep pretty strict family settings for each template, so that the client doesn't ever have to decide what template to use when creating a page, and they don't have the option to create pages where they shouldn't. It also opens more options for current or future access control. But the actual template files are pretty spartan, and many of them totally blank, some set or modify a few variables, and others simply include another. I rely on my prepend/append template files to handle all of the common stuff (_init.php and _main.php) leaving the other template files focused purely on any components that are unique for the template. In terms of scalability, I also like having lots of template files, even if there isn't much in them, because future additions and modifications are very simple. So far this way has worked really well for the last few sites I've used it on, but I don't think any one method works best for everyone because we all have slightly different needs. 

  • Like 6
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...