Closed (duplicate)
Project:
Views (for Drupal 7)
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Jan 2008 at 14:25 UTC
Updated:
18 Sep 2008 at 01:12 UTC
I was wondering if the solution that is listed at http://drupal.org/node/54815
has been realized for the 5.x release. I would very much like to use the Posted Full Date argument to create daily archives, but it currently behaves exactly as in the link above.
Comments
Comment #1
merlinofchaos commentedThat was marked fixed on March 20, 2006 - 13:07 -- so yes, it's safe to say that something that was fixed two years ago made it into the 5.x release.
Maybe you're being hit by http://drupal.org/node/165611
Comment #2
peterparker commentedIt was marked fixed for the 6.x version, but it persists in 5.x. I hope that I am not completely missing something, but I have narrowed it down quite far.
I have a view set up; as a teaser list, with no fields or filters. It has only 1 argument, "Node: Posted Full Date," which is set to "summary, unsorted."
If I visit the view, with the CCYYMMDD format, it returns zero nodes. If I leave the argument blank, it displays the summary. However, the summary is broken out by month rather than day, and the hyperlinks beneath them are of the CCYYMMD format. As such, they too lead to a page with zero nodes found since the argument is expecting something more.
I followed the 165611 link, but don't feel it pertains to this particular situation since I am not using any filters.
Comment #3
peterparker commentedComment #4
merlinofchaos commentedI can't duplicate what you say you are getting. In tests, the argument is working perfectly; I even have a date that is Jan 9, and the leading 0 shows up in the URL.
Comment #5
peterparker commentedI certainly appreciate your help, and am beginning to wonder if there is a deeper underlying problem that is beyond my grasp.
I set up a test drupal installation, with the views module being the only addition. Still, the argument gives the same results. I have pasted the view export below, if that would help. Also, feel free to visit the page www.bandalag.com/test/test2
I am stuck. Throwing out wild guesses here, but does the PHP version on my server play a role in all of this? Running 5.2.5
Thanks for your help, I will keep tinkering away.
The view:
$view = new stdClass();
$view->name = 'test';
$view->description = '';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = '';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'node';
$view->url = 'test2';
$view->use_pager = FALSE;
$view->nodes_per_page = '10';
$view->sort = array (
);
$view->argument = array (
array (
'type' => 'fulldate',
'argdefault' => '3',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array (
);
$view->filter = array (
);
$view->exposed_filter = array (
);
$view->requires = array();
$views[$view->name] = $view;
Comment #6
merlinofchaos commentedIt would be more likely to be your MySQL server, which is what's doing the date conversion here.
Can I recommend you install the devel module and enable query logging and display queries at the bottom of the page? Since this is a test, if you enable 'access devel information' for anonymous, I can take a quick look and make sure the query is being generated properly.
One other interesting note here is that modifying the argument to be proper, on your test, does not return results. That's very confusing.
Comment #7
peterparker commentedThe MySQL server is 5.0.45. To be honest I don't know what it should be.
I have installed the devel module and set the permissions as you suggested. The part about modifying the argument to be proper is unnerving, to say the least.
Comment #8
merlinofchaos commentedHmm. I'm not seeing the query logs when I go there. Be sure they're visible to anonymous, at least for the moment. Heck, be sure they're visible to you; they're pretty obvious if you scroll down.
Comment #9
peterparker commentedOne additional note. I tried an additional install of drupal by hand since all of my previous installs had been via fantastico. All of the same problems persist.
Comment #10
peterparker commentedOops. I thought I did that. Done now.
Comment #11
peterparker commentedI am going to keep commenting here, if that is OK, just in case somebody else is struggling with the same problem.
After a few tests, I can confirm that the problem lies in the way the date is captured in the views_node.inc file. The last part of "DATE_FORMAT(FROM_UNIXTIME(node.created+$timezone), '%Y%m%%d')", namely %%d, is resolving to zero. Changing it to %Y%m%D fixes the problem, although it obviously adds additional characters to the argument. Not user friendly.
After much fiddling around [I am NOT a programmer] I settled on changing the escape characters a bit. The following has given me the correct results, although I suspect that editing the views_node.inc file is not in my best interest. It will have to do for now, and I will watch this page for alternative solutions.
$fieldinfo['field'] = "DATE_FORMAT(FROM_UNIXTIME(node.created+$timezone), '%Y%m%\d')";
Comment #12
merlinofchaos commentedWell, the query information shows us the problem:
SELECT node.created, DATE_FORMAT(FROM_UNIXTIME(node.created+0), '%Y%m0') AS name, count(node.nid) AS num_nodes FROM node node GROUP BY DATE_FORMAT(FROM_UNIXTIME(node.created+0), '%Y%m0'), name ORDER BY name ASC LIMIT 0, 10That %d is getting translated into a 0 prior to the query being run. Now, that shouldn't happen--and it doesn't on my system. I linked to another issue earlier, that contains a patch that fixes a double replacement problem. I'd appreciate it if you'd try that patch and see if that addresses the issue or not. I'm dubious if it will; it seems like this is unrelated. But I can't figure out why your system would be double replacing and mine does not; however, I *do* have that patch since I checked it in.
Comment #13
ken hawkins commentedJust want to second the issue and am subscribing. gomerpyle's solution/hack of using the escape character worked for me. unfortunately, I haven't mastered the art of patches, so I didn't try your suggestion, merlin.
FYI, system specs of my 5.7 drupal install are:
MySQL database 4.1.11
MySQL database for event module 4.1.11
PHP 5.2.6
PHP register globals Disabled
Unicode library PHP Mbstring Extension
Web server Apache/2.0.54
Though, I also had this problem on my local XAMP windows box.
Comment #14
batbug2 commentedI had exactly the same problem as the original poster, however his solution didn't work for me at all
So, I took a look at the patch that fixes a double replacement problem, that merlinofchaos posted here - http://drupal.org/node/165611#comment-590536 - and it worked 100%, so this is fixed for me :) i'm so happy!!!
Comment #15
sunMarking as duplicate of #165611: 'b...' breaks filters - avoid double query argument replacement