0

Expression Engine's channel entry tag has a parameter called disable for which we can choose to disable various data from being returned and it is supposed to be better for performance to do so. I quote the documentation:

The disable= parameter allows you to turn off aspects of the tag that you might not be using in order to improve performance.

For example:

{exp:channel:entries channel="content" disable="categories|category_fields|member_data|pagination"}

Well, we use this disable tag on nearly all of our templates on all of our websites. We of course do not disable them for a news or blog page.

So it has occurred to me, why are they enabled by default? Is it possible to disable these somewhere globally so we do not need to keep using the disable parameter?

It is a waste of space and time for us to add it all the time, and there are likely many developers not using this parameter and not needing the extra data.

It would be better if there was an enable option to add in what you need rather than take away what you dont.

Thanks

2
  • Just a FYI: when disabling categories, you're automatically also disabling category_fields, so disable="categories|member_data|pagination" would suffice.
    – Low
    Commented Mar 7, 2014 at 9:05
  • Hi Low, when I copied my code from my site, category_fields was not in it, and so I thought I would add it as its in the documentation, so now I know why it wasn't there in first place! thanks :) Commented Mar 7, 2014 at 10:04

2 Answers 2

1

There isn't a 'disable the disable' config variable.

I imagine come the next major EE release (as in 3.0) they'll swap the behaviour though.

In the meantime, have you considered having a snippet for disable all? {disable} which could just include...

categories|category_fields|member_data|pagination
1
  • No I haven't considered that but I can do now! Thanks. Commented Mar 7, 2014 at 10:05
1

Further to Andrews answer sometimes you don't want to disable everything so it can be handy to set up several snippets (or global variables) for each disable pattern, eg

{disable} - categories|category_fields|member_data|pagination - disable all
{disable-c} - category_fields|member_data|pagination - disable all except categories
{disable-p} - categories|category_fields|member_data - disable all except pagination
{disable-c-p} - category_fields|member_data - disable all except categories and pagination

...and so on.

1
  • I can consider that thanks. Although it just shortens the code, rather than removes it, so it would still be necessary to add it in, and sometimes people may forget and so have them enabled without knowing. Commented Mar 7, 2014 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.