Closed (fixed)
Project:
Printer, email and PDF versions
Version:
5.x-3.4
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Mar 2008 at 21:58 UTC
Updated:
23 May 2008 at 12:42 UTC
Jump to comment: Most recent file
Comments
Comment #1
jcnventuraHi,
I have just tried printing comments and using the fivestar module, and it works.. My guess is that the reason that it no longer works is because of your customizations.. Just so that you know, the fivestar rating is reduced to a number.. :)
Since it is working for me, I can't help you anymore.. I tried to look into your example's source code and I can't find a smoking gun.. Try looking into all the print.module code, and comment out all the preg_replace calls.
Try also to use
var_dump($comments);right after the$comments = comment_render($node, $cid);line.If you can, PM me, the output of this var_dump.
Thanks,
João Ventura
Comment #2
jcnventuraHi,
Thanks for the info you in your PM. I imported the contents of the dump into my test site, and using the current code, the comments were correctly output. Have you modified the print module in any way, except for adding the var_dump?
João
Comment #3
joe4 commentedNo I have not modified the print module.
Comment #4
jcnventuraHave you tried commenting out all the preg_replace functions around line 760?
With the var_dump contents as they are now.. It MUST be for sure one of those lines that's preventing the comments from being output.
João
Comment #5
joe4 commentedI commented all the preg_replace function now I get this.
Parse error: syntax error, unexpected $end in /adoptionagencyratings.com/modules/print/print.module on line 874
Comment #6
jcnventuraI wish I could help you more, but something is strange in your setup and I can't understand your problem..
Comment #7
sgdev commentedHave a similar problem ... we have a custom design for our comments layout and they are not printing using 5.x-3.4.
I added the
var_dump($comments)after$comments = comment_render($node, $cid);, and I did receive a dump of the comments. I then proceeded to comment out each of the preg_replace functions around 760.If I comment the first function for removing the form tag, everything is good. If I comment out the second function for 'Post new comment' title, I get the same error message as joe4:
Parse error: syntax error, unexpected $end in /web/sites/all/modules/print/print.module on line 894.If I comment out any combination of any of the preg_replace functions *other than* only commenting out the first one for the form tag, I get the error message. Any suggestions?
Comment #8
jcnventuraThanks for resurrecting this.
I think that I have found the culprit. Regarding the 'unexpected $end' error, it's actually due to an obscure PHP bug that if you use // in a line containing '?>', the comment will stop there ('?> is the end of PHP marker). To successfully comment out those lines you have to use /*... */.
With that in mind, the real source of the problem revealed itself later...
Can you try to apply the following patch and tell me if it works for you?
Thanks,
João
Comment #9
sgdev commentedI tried applying the patch ... it did not like that. :) Commenting out the line for "comment author link" causes me to receive
Parse error: syntax error, unexpected $end in /web/sites/all/modules/print/print.module on line 894all the time. In fact I can't even load a Drupal page without receiving the error.I'm not sure but commenting out any of the preg_replace functions other than the first one for the form immediately causes the parse error message.
Comment #10
sgdev commentedMeant to update the status too ... sorry about that.
Comment #11
jcnventuraWhat exactly was your problem in applying the patch? Try downloading the attached file, and then inside the print module directory, call
patch < print_comments.patch.As to the commenting out of the line, as I explained before, you can't comment it with //. It's a PHP bug and doing it will basically stop all PHP scripts (i.e. Drupal). If you want to comment it, you must use /* at the start of the line and */ at the end of the line.
João
Comment #12
sgdev commentedSorry about that, I applied the patch incorrectly at first since I wanted to comment out and used // rather than /*. Once I applied the patch the comments are displayed! This does seem to fix the problem ... nice work.
Comment #13
jcnventuraHi,
I applied the patch to dev version in April 22. it will be in the (forthcoming) 3.5 version.
João
Comment #14
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.