1

I want to setup a bunch of snippets (or even embeds?) and give users the ability to place these within their pages, but without having to create special templates or pre-defining where in the template each item should be. I know I can setup channel fields that simply toggle them, but I want users to have more control in terms of where they go. For example, I want all 'pages' to use a single template {pages/index} which has 3 columns, where the user has the flexibility to pull in different snippets in different places. Here's few examples of the snippets I'd want users to be able to place themselves:

  • sitemap: user should be able to add page copy then pull in the snippet in whichever column they see fit
  • latest news/blogs: user may want to show these on some pages and not others - maybe in different places
  • call to action/advertisements: some pages may need these, some not, again maybe in different places, perhaps to 'fill' blank space depending on how long their main content is
  • newsletter signup/quick contact forms: the user should be able to put these wherever they want

It would be awesome if you could just add {snippet_name} inside a WYSIWYG, but clearly it doesn't work. Does anyone know how to achieve this?

1 Answer 1

3

Snippets are not intended to be used by / known by end users. They are developer tools for making your code more DRY - not so much to hold content. This is why the access to them is through the Templates area of the CP rather than the Content area.

Here is one approach to allowing users to create different sidebars - note that you could use the native relationship tools to do this now as they have added features since this was written: http://www.train-ee.com/courseware/free-tutorials/comments/flexible-sidebars-using-playa/

I have built upon that approach by using a large Matrix/grid field that allowed the end user to build out a page in a lego-building block fashion, but the vocabulary of blocks was relatively limited.

Overall though what you describe is a system that assumes much more control on the part of users than what I have usually built in ExpressionEngine. EE is a content management system that assumes a pretty controlled layout and lets users manage content within that layout.

You may want to investigate a more "page-based" CMS that allows users to create pages vs. just manage content.

Or, there are tools like http://devot-ee.com/add-ons/content-elements that swing EE back towards a more page centric system.

3
  • Thanks for the reply Mike. I previously have used a more page-based CMS, but I'm now with a company already using EE and having to pick it up, so it is new to me. I actually used your tutorials to help learn, so thank you for those. We're committed to EE for this project and I can't see our company changing in the long run either. But to think there's no way of setting up reusable content that the users can drop where they want is crazy to me. I'll check out Playa and Content Elements and see if those help. From what I'm finding with EE though, everything seems to need an add-on. :(
    – JustinXyn
    Jun 6, 2014 at 18:09
  • Again - you shouldn't need Playa now to make relationship-driven sidebars. The native field would do the trick. Jun 6, 2014 at 18:26
  • I'll echo Michael, content buckets that are end-user editable should 99.9% of the time live in Channels. Giving a client access to edit a Snippet, Template, or Global Variable, is analogous to giving them FTP access with instructions to edit .html files. Jun 6, 2014 at 23:39

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.