ExpressionEngine - the disable all global variable

It’s a common technique for EE developers to use a DRY global variable for the disable= Channel entries parameter, where the variable disables categories, member data and pagination. But what if you need to allow say pagination but not categories or pagination?

Here’s a quick tip for you: set up multiple global variables to cover all eventualities!

{gv_disable} - disable categories, member_data and pagination
{gv_disable-c} - disable member_data and pagination but allow categories
{gv_disable-m} - disable categories and pagination but allow member_data
{gv_disable-p} - disable categories and member_data allow pagination
{gv_disable-c-m} - disable pagination but allow categories and member_data
{gv_disable-c-p} - disable member_data but allow categories and pagination
{gv_disable-m-p} - disable categories allow member_data and pagination

Now when you’re writing Channel entry tags in your templates you have instant access to anything you want to disable or enable.

You might also like

You don't know unless you ask

Contact me today