<small id='u4bb0'></small><noframes id='u4bb0'>

    <tfoot id='u4bb0'></tfoot>
  1. <i id='u4bb0'><tr id='u4bb0'><dt id='u4bb0'><q id='u4bb0'><span id='u4bb0'><b id='u4bb0'><form id='u4bb0'><ins id='u4bb0'></ins><ul id='u4bb0'></ul><sub id='u4bb0'></sub></form><legend id='u4bb0'></legend><bdo id='u4bb0'><pre id='u4bb0'><center id='u4bb0'></center></pre></bdo></b><th id='u4bb0'></th></span></q></dt></tr></i><div id='u4bb0'><tfoot id='u4bb0'></tfoot><dl id='u4bb0'><fieldset id='u4bb0'></fieldset></dl></div>
  2. <legend id='u4bb0'><style id='u4bb0'><dir id='u4bb0'><q id='u4bb0'></q></dir></style></legend>

      • <bdo id='u4bb0'></bdo><ul id='u4bb0'></ul>

    1. 如何在 drupal 中打印单个评论?

      How do I print a single comment in drupal?(如何在 drupal 中打印单个评论?)
    2. <legend id='BgpNT'><style id='BgpNT'><dir id='BgpNT'><q id='BgpNT'></q></dir></style></legend>
      <i id='BgpNT'><tr id='BgpNT'><dt id='BgpNT'><q id='BgpNT'><span id='BgpNT'><b id='BgpNT'><form id='BgpNT'><ins id='BgpNT'></ins><ul id='BgpNT'></ul><sub id='BgpNT'></sub></form><legend id='BgpNT'></legend><bdo id='BgpNT'><pre id='BgpNT'><center id='BgpNT'></center></pre></bdo></b><th id='BgpNT'></th></span></q></dt></tr></i><div id='BgpNT'><tfoot id='BgpNT'></tfoot><dl id='BgpNT'><fieldset id='BgpNT'></fieldset></dl></div>
        <tbody id='BgpNT'></tbody>
        <bdo id='BgpNT'></bdo><ul id='BgpNT'></ul>

        • <small id='BgpNT'></small><noframes id='BgpNT'>

        • <tfoot id='BgpNT'></tfoot>

              1. 本文介绍了如何在 drupal 中打印单个评论?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想根据评论 ID 在 drupal 中打印单个评论.我怎样才能做到这一点?谷歌和其他来源没有给我任何结果.谢谢你.

                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.

                推荐答案

                Eaton 的建议很好(除了它是 {comments},而不是 {comment})如果你需要像 core 一样显示评论,包括来自节点的信息.除了 modules/comment/comment.tpl.php 中的默认 theme_comment 实现不使用 $node.

                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 in modules/comment/comment.tpl.php makes no use of $node.

                但是,我的做法略有不同,因为如果您需要提取单个评论,以comment.tpl.php 提供的正常内容格式显示它可能是不合适的.

                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.

                function print_comment($cid) {
                  $sql = "SELECT * FROM {comment} c WHERE c.cid = %d";
                  if ($comment = db_fetch_object(db_rewrite_sql(db_query($sql, $cid), 'c'))) {
                    return theme('my_special_comment_formatting', $comment);
                  }
                }
                

                当然,受 comment.tpl.php 的启发,在模块的 hook_theme() 实现中定义这种特殊的注释格式.

                And of course, define this special commment formatting in your module's hook_theme() implementation, inspired by what comment.tpl.php does.

                2014-02 更新:请注意,这是 2009 年的问题/答案.在 Drupal 8 中,您只是不想访问假设的底层 SQL 数据库(无论如何都不会这样做,而是使用 DBTNG),而只是使用类似的东西:

                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:

                if ($comment = entity_load('comment', $cid)) {
                  return entity_view($comment, $view_mode);
                }
                

                这篇关于如何在 drupal 中打印单个评论?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <tfoot id='iZz9M'></tfoot><legend id='iZz9M'><style id='iZz9M'><dir id='iZz9M'><q id='iZz9M'></q></dir></style></legend>

                  <small id='iZz9M'></small><noframes id='iZz9M'>

                        <bdo id='iZz9M'></bdo><ul id='iZz9M'></ul>
                        <i id='iZz9M'><tr id='iZz9M'><dt id='iZz9M'><q id='iZz9M'><span id='iZz9M'><b id='iZz9M'><form id='iZz9M'><ins id='iZz9M'></ins><ul id='iZz9M'></ul><sub id='iZz9M'></sub></form><legend id='iZz9M'></legend><bdo id='iZz9M'><pre id='iZz9M'><center id='iZz9M'></center></pre></bdo></b><th id='iZz9M'></th></span></q></dt></tr></i><div id='iZz9M'><tfoot id='iZz9M'></tfoot><dl id='iZz9M'><fieldset id='iZz9M'></fieldset></dl></div>
                          <tbody id='iZz9M'></tbody>