Theming the teaser display format - AJAX problem

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
ben.hamelin's picture

I have two views.
One uses a relationship to display a node-referenced field of a node-referenced field.
The other view simply includes the node-reference field.

Both are set to display the field using the "teaser" format.

I have a custom node tpl file for the content type in question.

When I run a search (exposed form) on the first view, I lose the custom node tpl HTML output, and instead see the default teaser output.

Performing a similar exposed filter search on view #2 correctly maintains my custom TPL code.

Any ideas on fixing this, my next step is to simply code the view TPL file instead

Comments

ben.hamelin's picture

So I realized this was due to the theme invocation of the AJAX call. This makes perfect sense, of course. The TPL file from my original theme was not called after the AJAX request, as the AJAX request to "/views/ajax?filter...." was not passed to my current theme, but rather picked up by the sites default theme. Encountered a similar issue using the flags module, which I finally applied to this problem. Of course, this makes sense, as the TPL file for the current view is the one used. I neglected to observe this initially as my assumption was the view knew which TPL file to use.

So, be conscious of which theme is invoked during your AJAX requests. It is most often your default site theme, but could be different based on a theme manipulation module (such as themekey) set of rules. Hope this helps someone!

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week