News

This Week in devot:ee #4 - February 9, 2012

February 9, 2012
by Ryan Masuga

New add-on filters, template optimization, and more information in add-on lists.

We're still enjoying all the time we've been able to lavish on devot:ee lately. We made a number of things happen this week, so let's dive in.

Recently Rolled Out

New Filters: Page Views, Favorites, and Ratings

The devot:ee filter can now sort add-ons by page views. The count is currently the "all-time" count (and keep in mind our data only goes back to our August EE2 relaunch).

There are a couple other filter updates that are sure to be fan favorites: you can also now sort by Ratings and Favorites.

We're doing these filters in an interesting way, by storing the counts directly in the add-on entries, saving trips and queries to the third party tables to get this info. Every time a hit is recorded, or an item is favorited, or rated, or unfavorited, the respective add-on not only records the updated info in their own tables, but also stores these counts in custom fields directly in the add-on channel. This has helped us reduce queries on these list pages, which leads us to the next update:

More Information in Add-on Lists

Many moons ago we removed information from search results, tag results, and basically any page where there is an add-on listing because our performance on these pages was terrible. We've now added this info back in (and gave the faves and ratings color!) so it will be easier for you to make a decision about which add-ons you click on from search results, etc. You can now see review counts, favorites, and ratings on the add-on listing pages (search and tag results, filter area, etc.)

More Template Optimization

We deployed a couple updates that remove 4 to 6 embeds on every template sitewide. The homepage no longer has a single embed on it. We've switched to using Snippets where it made sense, and hardcoded other areas. We've also been removing Template Morsels in favor of CE Cache. Both do a fine job of caching content, but with our workflow, we prefer to use CE Cache.

We received a number of questions about why we're making these changes, or comments along the lines that embeds must be the devil or whatever, but the fact is: embeds are awesome...when you need them. We were definitely overusing them, which was hurting site performance. We only recently started using Snippets, which weren't available in EE1, so these changes are just a natural progression in allowing the site to use items native to newer version of ExpressionEngine.

Converted Ads from OpenX to isocket

We were invited into the isocket ad system, which has more responsive ad servers than the system we were using, and our template conversion is complete. Buying advertising on devot:ee will be more self-serve going forward. Existing advertisers will get a detailed email this month about the switch.

.htaccess Update to Force Removal of Trailing Slashes

We noticed we were seeing a lot of duplicate pages in Google Analytics. We found that just as many people would go to an add-on single entry page that ended with a slash as the version ending without a slash. EE2 is in favor of removing trailing slashes, so we updated out htaccess file to enforce the issue. This caused a few problems throughout the site, most notably in the support forums (still working out a few kinks there).

The Orders API was also affected. If you're trying to access the API with a URL that ends in a slash and it's not working for you, just remove the slash. We've updated the Example Usage section on the Orders API page to reflect this.

Noteworthy

EE Garage recently relaunched. Congratulations to the fine team at Newism for making that happen. Maybe one fine day you will be able to purchase their products right here on devot:ee, but until then, well done, friends.

Newism also wrote an add-on called NSM devot:ee Stats to parse information from devot:ee. If you're a developer and want to show information about your add-ons on your site, you might want to check it out.

This Week in Add-ons

  • HTML5 Fields ($, for EE2) by Toby Evans
    This fieldtype adds html5 input types: text, url, email, number, range & tel; as well as the applicable attributes: placeholder, pattern, min/max/step, multiple, required, etc.
  • Wufee ($, for EE2) by Chris Monnat
    The simple way to connect your EE site with your Wufoo account.
  • Authenticate (for EE2) by Objectivehtml
    Authenticate brings proper member authentication into ExpressionEngine with inline error handling, removes the ugly redirect screens, and supports logging in with an e-mail address opposed to a username. Authenticate supports forgot password forms too.
  • Safecracker Registration ($, for EE2) by Objectivehtml
    Safecracker Registration brings member management into your Channels by extending the all-mighty Safecracker. Safecracker Registration is perfect for those sites that just need a simple member registration form, but need to use Channel Fields to store the data.

9 Comments:

Robson Sobral 02.09.12

Robson Sobral

Ryan, why does not use stash aside with snippets? Did you tested it?

Ryan Masuga 02.09.12

Ryan Masuga

Wasn’t aware of Stash and what it can do. We have not tested Stash, but it sounds interesting. We like everything that Mark Croxton does (we use Switchee all over the place).

I may give it a shot in my testing environment. Thanks for the suggestion!

Robson Sobral 02.09.12

Robson Sobral

I asked because I’m doing the same as you right now: improving old templates. Stash was the best solution to use snippets and DRY concept.

Bye!

Natetronn 02.09.12

Natetronn

isocket reminds me of buysellads.com. Let us know how it works out for devot:ee and advertisers.

Adam Khan 02.09.12

Adam Khan

Stash is quite a big deal, much more so to my mind than Switchee.

It lets you create and modify variables within the template that you can then use later on within the same template (subject to parsing order) and embedded ones.

The same thing could be achieved with PHP then passing an arbitrarily long list of variables with the embed, but Stash puts that all behind the scenes. Plus, you can control how the variable is saved, across sessions, etc.

Ryan Masuga 02.10.12

Ryan Masuga

Adam: So Stash is faster, or more flexible, or uses less memory than Snippets?

If I’m understanding correctly, it sounds like one advantage is that you can pass variables to embeds without the need for embed:variables?

For anyone wanting more info on Stash, you can read about it here on devot:ee or check out the README in the repo at Github.

Robson Sobral 02.10.12

Robson Sobral

Not just this, Ryan. you can save data from some tags and use outside them. So you can use this variables later in your template or snippets. I’m using to save the title of the page, per example, and using it into my page_header snippet.

Adam Khan 02.10.12

Adam Khan

Ryan, to amplify what Robson just said, you can save not only the title of the page, you can save _everything_, every bit of content data, so you have more of an MVC setup, with the first template gathering all the data, and the hopefully one-and-only single embedded template just displaying it. And yes, instead of embed:variables.

One major difference from Snippets is that every snippet is loaded for every page throughout the site. So if you have many or large snippets, and they’re not used universally throughout the site (such as being the sitewide header or footer), that is pretty wasteful. Whereas individual stash variables are called only when the stash:get tag appears. So yes, I guess in many circumstances Stash would use less memory than Snippets.

So: Unlike embedded variables, Stash variables can be saved for a set duration, and either to the particular user session or for everyone. And unlike Snippets, they can be manipulated by the template, appending and prepending to them as well as setting and getting them.

Recently Mark has added array functionality as well.

Mark Croxton 02.10.12

Mark Croxton

Snippets are good in that they are all brought into a template with a single query, but bad in that they are loaded for every template even if you don’t use them in that template. They don’t get parsed unless you use them, but even so if you use lots of snippets then all that text gets loaded into the globals array which the template parser iterates through multiple times per template. So lots of snippets = memory overhead.

Of course this is still much better than using embeds for every little bit of your template that requires encapsulation.

Stash gives you a third way to store and reuse bits of template code. Stash template files are worth exploring as an alternative to some embeds, as it allows you to fully or partially parse the template and cache the rendered output. Stash variables with type=“snippet” allow you to create snippets on the fly for use in embedded templates, avoiding the need to pass variables to the embed tag. Stash lists allow you to save rows of data (entries, Playa or Matrix data etc) and re-order, sort, limit and filter the list of items in different ways.

Stash is not a replacement for snippets and embeds it’s really just another tool in your toolbox.

You must be registered member to comment. If you're already a member, log in now.