I’m having sort of a dilemma and since I never actually used channels in EE (yes, that is strange) except for a blog section I was curious what the real benefit is. I just don’t see it.
Let me make one example and maybe someone with more experience can answer this with a technical approach on why they are better.
I need to create documentation. So assume /help is a (template) which then embeds for example another intro template. So now you have /help/intro and of course you write your usual help documentation on intro or any other template files.
In the index of the group templates “help” I can just create if segments calls, for example:
{if segment_3 == 'to-super-product'}embed="help/some-other-template "}{/if}
And now we have something nice like:
example.com/help/intro/to-super-product
Now, of course the proper way is to use channel entries for each article so instead of using a segment_3 you create a channel entry for each chapter.
The problem with that approach is that now you are limited to the constraints on the channel entries boxes. Unless you use a plugin from Ellis Lab you cannot use EE variables inside a content anymore and they advise against it for security.
For example with the templates approach I could have a variable called {version_number}
and use this on all my documentation, I change that variable and its changed everywhere. I can edit and design everything as I want with HTML and the help articles are completely dynamic.
But if you go the channel entry route, you are constrained to making the content static. You cannot use the {version_number}
anymore, or if you want to change colors, fonts or other things help wide you cannot do this unless you go to the Expression Engine control panel and edit each channel entry individually.
I’m surprised why everyone is using channels when it seems inferior. The only advantage I see here is if you need to let users that are not coders/designers to edit the content and you don’t want them messing any code. But to achieve the same visual effects in a page, you would have to create a lot of different channel entries which they need to edit one by one.
What I’m approaching wrong here? Editing HTML files seems like cleaner and I can make them dynamic vs having static channel entries. When I mean static, I mean the content inside. For example changing fonts, notes, version numbers, product names...
UPDATED:
I don’t use it to create static HTML and this is exactly what channels do. When you get content from a channel, that content of HTML block is constrained by only the HTML that someone saved from the control panel.
Let me try to clarify this. I don’t let anyone else edit the content now. I create the content. Maybe that is why I see little use with channels today. I can completely understand how useful they are to separate content from code if you are allowing other people to edit or add content text or images to pages.
Let me make a simple example. Do you see the yellow box on your reply that you quoted? Lets assume this is pulled from a channel entry. That text is all you get in terms of formatting. If you want to change letters to BB or change something dynamically with CSS you can’t.
But if the same text is directly saved in a template, and I have the correct EE variables around the content or code I want, I can modify it on the fly, site wide. This is exactly why EE is so great. You can make sites dynamic. But channels are static content. Yes, you can limit how may entries, sort them by date, category, and many other things but the content you get from a channel entry is fixed and limited by the fields you allowed someone to save from the control panel.
I'm not new to EE. I used it since version 2 but just never had to use channels because I feel constrained by them vs just editing templates directly which seems cleaner and faster. All the examples and tutorials are the same. They show how to create a news section, a blog, or other simple blocks of texts entries you would add to a database. Nobody seems to create a very advanced use or case scenario example. I can also see channels being useful in that regards, if you need to enter a lot of items which are similar and then need to classify or sort them. In that case, a channel entry is a database entry so its very useful for data organization/classification. But I'm referring to unique web page content that is completely different but you still need to change it automatically or dynamically on a site.