I promised more meat in the next installment of entries peeking behind the curtain of the ExpressionEngine.com redesign, and I shall deliver. Meatier, but still lean: this design decision was low fat. If you subscribe to our feeds, you’ll notice that the URLs all begin as http://expressionengine.com/feeds/atom/ and http://expressionengine.com/feeds/rss/. The reason quite simply is that we have only two templates for feeds, which saved us quite a bit of template creation and cut and pasting.
I’ve gotta tell you, that is damn impressive. You don’t even know how bad I wish I understood it in practice enough to do on my own with our multiple feeds. I get the concept, and it’s stellar…damn me and my lack of PHP knowledge.
Just give a try, Dru. Cut and paste our template into a new RSS type template with PHP parsing set on Input, and get rid of all of the “case ‘segment’:” blocks except for one. Whatever you want to use as the third segment, put that in place of ‘segment’, and then change the other variables to match your custom fields, paths, statuses, etc. Then access that template with the third URL segment that you set the block up for. Then you can cut and paste the working “case block” within the switch { } control structure and begin adding the information for your other feeds.
This looks like another great blog post! Thanks Derek! I am totally looking forward to your next post. I really enjoy seeing how the pros do advanced things in EE.
Keep-up the great work!
Cheers,
Micky
Update: Oooh, this is great! I just setup my atom feed… works perfectly! Many many thanks! Moving-on to the RSS template. Derek, you rock!
parameter in your example isn’t available in EE 1.5.2?
Oh ... and I’d really love to see more BTC parts. Any chance for the mentioned next part in the near future?
-Markus
Sharp eye, Markus, surprised no one remarked on that parameter yet. :-D
My attention has been pulled pretty tightly in the past couple weeks, which is why the next BTC hasn’t been published yet, but they have not been forgotten.
I have been attempting to implement your setup for hours to no avail :-(. I’m sure I’m missing something, and I hate to ask questions when I think I must be missing something simple. I just cant seem to get it. The feed processes, but it comes up with the title and no entries. Any assistance would be appreciated.
well… I figured it out. Maybe it is something that is documented, but I didn’t know any better. Your cases cannot match any existing template group names!
Just changed articles to articles_feed and amazing… it works!
Thanks for the Behind The Curtain posts Derek!! They are excellent.
Template groups will only be in the first, not the third segments, but I see that you have ‘guides’ there and not ‘articles’ nor ‘articles_feed’, so I’m confused. In any case, glad you got it working and found it useful!
Sorry. It was late. I actually have 9 different feeds, articles is another one of the feeds.
It is working great! Well the atom one is at least. Now I need to go figure out what I messed up in the rss template. The feeds that have custom fields and statuses in them are not working at all. I’m sure I just messed something up while trying to figure out why none of them work working.
Also I’m not so sure how I can create a “full” feed? my entry templates are different for each blog. Any ideas?
A “full” feed will only work if you have an acceptable way to list all of the entries together with a weblog entries tag. Whether or not that will work for your site you will have to make that determination.
Just like you have it there, but double check the Troubleshooting Conditionals KB article. You shouldn’t be using a quoted and braced variable in your conditional.
Derek,
Thanks for the heads up on the quoted and braced. I have that issue throughout my site. Cleaning it up now.
With the RSS feed, I’m getting the following error when I run it:
XML Parsing Error: junk after document element
Line Number 2, Column 1:Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /www/eh6627/public_html/XXXXX/core/core.functions.php(635) : eval()‘d code on line 35
You have single quotes within a single quoted string, so you either need to escape them, or what I prefer for code legibility is to consistently use the opposite quote within a quoted string. In other words, if you have a single quoted string, use double quotes for attributes inside. If you have a double quoted string, use single quotes inside.