Closed (fixed)
Project:
Semantic Views
Version:
6.x-1.0-beta1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Feb 2010 at 19:39 UTC
Updated:
17 Feb 2010 at 21:50 UTC
Jump to comment: Most recent
Comments
Comment #1
Anonymous (not verified) commentedWhen you call dpm() in the template, the page template's messages variable has likely already been generated by the time dpm($id) is called. dpm() stores its output in the user's session by calling drupal_set_message. The output of the dpm() function calls is not seen until the next page request.
To test this, start on the first page of your view. You'll see only the printed $id in the page. Page forward. You'll see the second page of $ids printed but the first page's $ids in the message area of the page. Then navigate to a page where your view is not displayed (maybe /admin ?) and you will see the second page's $ids in the message area of the page.
If this is the problem, you need to put the dpm($id) function somewhere outside the template. There are views hooks that can peek in on the id, but I can't advise you on that. The best resource is http://views.doc.logrus.com/ where the Views 2 hooks are documented. I suspect if you try with the preprocess function for the semantic views template, you will see the same result that brought you here, but it could be worth a shot. (I can't test it meself.)
Mark the issue "fixed" when you're done unless you determine that this isn't the problem you're having.
Comment #2
Anonymous (not verified) commentedSilly me. The most obvious solution is to use HTML comments in the template to print the information. dpm() is just not a suitable option for debugging templates like this.
Comment #3
karlsheaI read up a bit more on this, and I don't think the line I referenced is the issue.
But the base issue here hasn't changed... the fields are getting rendered twice.
Here's a field template I'm using that shows the behavior:
The first comment never prints, and rows shown all print 11-20. But if I'm using dpm($id), I get 20 prints, from 1-20, so the template is being called 20 times. And if I comment out that line of code I referenced, I still get the 1-10 prints from dpm($id) even when there's nothing else on the page.
If I turn off semantic views and just use the Unformatted/Fields style, everything works fine, I only get 10 messages from 1-10.
This really wouldn't matter, except I need to output some things in the first item differently.
Comment #4
karlsheaHey I fixed it!
It was that line. In semanticviews.module, change line 26 from
$field_output = $view->field[$id]->theme($variables['row']);to
$field_output = $view->style_plugin->get_field($view->row_index, $id);and everything works fine!
I found the correct line in the views module in theme/theme.inc on line 170.
Comment #5
Anonymous (not verified) commentedThanks Karl. I think you're onto something here. I can't test it, but I am looking at it tonight.
Comment #6
Anonymous (not verified) commentedCommitted. See commit message for background on the change in Views 2.
Commit #323932 by bangpound at 16:36