I want to print a individual comment in drupal based on it's comment ID. How can I do this? Google and other sources have yielded me nothing. Thank you.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Eaton's suggestion is good (except it's
{comments}
, not{comment}
) if you need to display the comment like core does it, including the info coming from the node. Except the default theme_comment implementation inmodules/comment/comment.tpl.php
makes no use of $node.However, I'd do it slightly differently, because if you need to extract a single comment, displaying it with the normal content formatting provided by
comment.tpl.php
is likely to be inappropriate.And of course, define this special commment formatting in your module's
hook_theme()
implementation, inspired by whatcomment.tpl.php
does.2014-02 UPDATE: note that this is a 2009 question/answer. In Drupal 8, you just don't want to access the hypothetical underlying SQL database (and would not do it like this anyway, but use DBTNG), but just use something like:
No reason to use any sql to do this, two drupal api function calls is all it takes.