4

Is there a way to limit channel entries to a specific number? For example, what if I had a "Company Details" channel (company name, address, telephone number, etc.). Generally, a site would only need one of those. If I use Channels, the user can add multiple Company Details, which is not right.

So, it there a way to limit Channel entries? Or should I be using something else?

7 Answers 7

8

There are two add-ons that are very useful for single-entry channels:

Either of these will remove the given channel from the Content > Publish menu, making it less likely for the end-user to be confused and publish additional entries in a channel that isn't made for that.

1
  • 1
    +1 for Single Entry. It's a great, easy to use solution for exactly what you're describing. Dec 14, 2012 at 4:20
5

As mentioned already, Single Entry is brilliant to do this sort of thing. A great example would be your 'home' page entry. You might have a channel called 'home' with a single 'home' entry. The Single Entry add-on is great for that.

For Company Details (which is the example given) that are used in the site, I would tend to go NOT having them in a single entry, but as either Global Variables (built-in to EE), or even better, use Low Variables. Whilst this is a commercial add-on, it is WELL worth the money, and I find it gives better performance then using an entry (particularly when used across multiple pages/templates).

3
  • Global Variables are set in code, right? That's not something easily editable by users, is it? Dec 14, 2012 at 3:59
  • 1
    User-defined Global variables (sorry I should have been clearer) can be edited via the CP ... they are just not easy to find by the editors/authors - Design -> Templates -> Global Variables. My recommendation whether using UD Global Variables, or Low Variables would be to add them as a 'tab' for your users. Check out ellislab.com/expressionengine/user-guide/templates/globals/… for more info on User-Defined Global Variables. Dec 14, 2012 at 4:07
  • Even if you create a tab in the CP that goes directly to the global variables area, without permission to access the design section, which holds not only global variables but all template settings, they will get a permissions error when trying to access it. If you're not confident about providing the client with access to the templates area, Low Variables or Republic Variables give you editability of variables within their own module that you can grant access to separately OUTSIDE of the templates menu. Dec 14, 2012 at 13:05
2

Even in instances in which logically the client might only need one of something, I sometimes still wind up having a desire to avoid limiting the channel to a single entry for one simple reason - if I do that, all the power of EE's publish and expiry date is lost.

When I know for sure that I don't need to provide some of those entry-specific functions, global variables or better yet, low variables, are ideal. But for something like a homepage's welcome message, as another example of which you may figure there's only the need for one - consider that the client may wish to take advantage of the publish and expiry dates to have a new version of that entry self-publish on a given date/time, while expiring the previous entry. A retailer, for example, may have seasonal versions of their homepage welcome.

I know your example referred to contact details - which would certainly be even less likely to change, and when you need the full range of available fieldtypes, channel entries are helpful. The reason I chimed in here is to remind you that there are some circumstances in which there may be some advantage, evaluated on a case by case basis, in avoiding limiting the entry to a single item. So an add-on like single entry is excellent for those times when you need the power of channel entries but you can saw with certainty that some of the publishing features that come with a channel entry (like publish and expiry) are not needed.

2

I use Zoo Flexible Admin as part of my EE builds and so I simply don't include a link in the menu to publish for the given channel - just allow them to edit. Whilst this doesn't restrict the user from adding another entry they would have to know the exact URL to do so.

I use this strategy on the home pages of sites. Our home pages normally feature several matrix fields to control sliders, tabbed panels and the like. Probably a little too much to store in Low Variables - also for a consistent user experience it still feels the same as editing a page for the client.

I normally have a top level menu options of 'home page' and then 'pages', 'entries' (listings like news), 'fragments' (link to Low Variables) etc.

Works for me and the client.

However, for company details and the like I would store these under what I call 'fragments' - basically Low Variables - why use any other method?

1

I find that creating front-end edit links (visible to logged-in site editors only) prevents site editors from adding a duplicate entry.

0

If you set limit="1" in the channel:entries tag EE will call your most recent entry in the channel.

If you want to call a specific channel entry you set entry_id="ID_NUMBER_HERE" in the channel:entries tag.

Links to channel:entries parameters in EE docs:

3
  • 1
    I don't want to limit what's being displayed. I want to limit what's being entered. Any other options? Dec 14, 2012 at 3:21
  • 2
    You might check out Single Entry (devot-ee.com/add-ons/single-entry), a commercial add-on which is designed specifically for working with channels that will only have one entry. Dec 14, 2012 at 3:34
  • Ah, that wasn't clear in your question. Alex offers the correct solution in his answer.
    – Anna_MediaGirl
    Dec 14, 2012 at 3:46
0

Another addon to look at, that has a bit more functionality is Zoo Flexible Admin. You can fully customize the control panel (hiding channels from publish so no new entries can be created) and user experience.


"Admin lets you fully customize the control panel menu per membergroup. Insert custom links, rename, re-order and remove menu items in order to create a more intuitive menu."

Your Answer

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

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