cool tech graphics

Drupal snippets #1 (Views exposed filters, F5 tweaks)

While I'm certain that I could never work up to the standards of Peter Cooper his "Interesting Ruby Tidbits That Don't Need Separate Posts" series was a great help to me when I was a ruby developer. You can see the original here: IRTTDNSP #1. I've not found similar for the Drupal community but I believe a lot of the things I do during the week are interesting but not at all worthy of a complete post of their own. So this will be my attempt to categorize and commit those very thoughts to memory. I hope that even one of these things sparks something for you.

How to get Views' exposed filters to display in a block

Emmys taxonomy exposed filter

If you create a block display and have some exposed filters you may have trouble getting them to actually show up. The problem is that blocks don't seem to like to display their exposed filters unless two prerequisites are met: there must be a full page display somewhere and it must have a path, the block must be set to use ajax. I would have never guessed this either but if you look at the requests that are going across the wire they're going to that page display and the results are coming back over ajax.

How to reorder taxonomy terms in Views' exposed filters

On that same page we realized that we needed to order the dropdown in a reasonable way in part just to keep people from using it on the awards day to stave off some of the traffic. Analysis of traffic suggests we actually got the ordering wrong but whatever, you just want to know how to reorder taxonomy terms in an exposed filter.

Emmys reordered taxonomies

Despite the ordering that Views seems to be suggesting below, the actual display order of terms is determined by the taxonomy weights page at /admin/content/taxonomy/. So you can feel confident that even though views doesn't have a means to order your taxonomy selections, they will be ordered for you. Now the real question is though, is it possible to reorder those terms on just one page and not on another? I don't know, maybe I'll get to post about that later.

Views exposed filter settings for taxonomy

How to get an F5 Load Balancer to stop putting the Vary headers on your responses

When you're using a CDN like Akamai having a Varies header in your response absolutely kills your caching despite all the hard work drupal puts into getting things right. We were seeing about 50-75% cachability through Akamai because of it. Mostly this was because Akamai couldn't cache the JS/CSS which was clearly incorrect. After we figured out that it was the Varies header (props to Grendzy as usual :P), it was a hop skip and a jump to figure out which settings could be causing the actual problem.

Turns out the Varies header setting isn't the culprit though it does in fact fix the problem we were having it also introduces some others. The culprit is in fact having Browser Workarounds on which fixes IE6 and gzip and not having HTTP/1.0 Requests on. Of course the manual doesn't really describe what's going on so massive props out to spark on the F5 forums for answering this question before I had the chance to ask it.

F5 settings for fixing the Varies header

Conclusion

I've run out of time but I'd be grateful for any feedback. If people don't find this useful I'll not post it on planet but if you do please keep reading and encouraging me with your great comments.

Date posted: July 9, 2010

Comments

I'm confused about your explanation about the Vary headers. You want vary headers so that browsers that support compression and those that don't all get a cached page. Correct?

@dalin Yes, to some degree this is correct. You want to keep the Vary: Accept-Encoding so that browsers that don't accept gzip won't ask for it, but Vary: User-Agent apparently tells Akamai and Limelight to just pass the request straight on the the origin because it has no idea what to do with it. So yeah, you're right that we really want to keep the Vary header, but in the case of the Vary: User-Agent we have to get rid of it for cache utilization.

Late to the game here, but just for posterity: you can also change your Akamai config so that it ignores Vary entirely. In the "Header Handling Rules" section, set a "Default Rule" to "Ignore Vary headers".

Might you have any suggestions on how to reorder a select list for an exposed filter that comes from a CCK field?

Has anyone worked out how to re-order the items in the exposed select list? I have one that I need to order alphabetically.

You could re-order your allowed values in the CCK field itself, or use hook_form_alter to change the form.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Metal Toad is an Advanced AWS Consulting Partner. Learn more about our AWS Managed Services

Schedule a Free Consultation

Speak with our team to understand how Metal Toad can help you drive innovation, growth, and success.