Use the Flag to mark the essence Comments (change)

flag tag module is a flexible module, this module can be marked using any node, comment, user, etc, can this module will be marked as the essence of the node, the garbage or you want to be labeled. flag modules can be views2 integrated to operate, while flag also support action. the official site has a very detailed document.

Now I will talk about the use of Flag module, to add a comment on the essence.

Flag module installation

And, like all modules, download, install the module settings.

Flag module configuration

Global's flag and private flag, the flag module is divided into global and private labeled Category 2, if the private flag, so each has only to tag the person can go to change it without affecting others, such as of the article for collection, the overall situation after the flag change will affect all users, such as the administrator of the comment to add precision, then everyone will see the essence of signs.

With the admin / build / flags carried on the flag set:

Increase after being at the front desk can comment on the essence of symbol nodes.

Block into the template to specify the location, you can see the essence of comments.

Flag module used in the template.

In front of them complete, of course, not end, how to join the comments and general comments essence no different, it should be some settings for the template. Reference content here

Open the template file in the template.php file, adding phptemplate_preprocess_comment function

static $ flags;
if (! module_exists ('flag')) (
if (! isset ($ flags)) (
$ Flags = flag_get_flags ('comment');
/ / Note: is_flagged () and get_count () use internal cache,
/ / So using them won't result in issuing excessive SQL queries.
$ Classes = array ();
$ Cid = $ vars ['comment'] -> cid;
foreach ($ flags as $ flag) (
$ Css_name = str_replace ('_', '-', $ flag-> name);
if ($ flag-> is_flagged ($ cid)) (
$ Classes [] = 'comment-flagged-'. $ Css_name;
$ Vars ['flag_classes'] = implode ('', $ classes);

Whether this is a sign to obtain the essence, and if so, adding a $ vars ['flag_classes'] class. This stuff can be used in comment.tpl.php file.

<! - Start comment.tpl.php ->
<Div "comment <? Php print $ comment_classes;?> Clear-block">
<? Php print $ picture?>
<? Php if ($ comment-> new):?>
<a> </ a>
<span> <? php print $ new?> </ span>
<? Php endif;?>
<H3 "title <? Php echo $ flag_classes; ?>"><? php print $ title?> </ H3>
<? Php print $ submitted?>
</ Div>
<? Php print $ content?>
<? Php if ($ signature):?>
<? Php print $ signature?>
</ Div>
<? Php endif;?>
</ Div>
<? Php if ($ links):?>
<? Php print $ links?>
</ Div>
<? Php endif;?>
</ Div>
<! - / End comment.tpl.php ->

I joined the red part of the code, if it is the essence of the case, then the title will have a CSS class called comment-flagged-picks, which picks me flag name.

Then in your template CSS file to add

. Comment-flagged-picks (
background: url ('images / raquo.png') no-repeat left 0.833em; / / picture of course, find their own
padding-left: 13px;

Special attention Flag module also supports templates, but the template file is used flag - flagname.tpl.php, is 2 -, A moment's inattention, out for a long.

分类:PHP 时间:2010-09-09 人气:194
blog comments powered by Disqus


  • front desk agent distribution weblogic cluster apache error: error module libhttpd.dll, error analysis and solutions address 0x0001c0a2 2010-04-14

    2003 error: Faulting application Apache.exe, version, faulting module libhttpd.dll, version, fault address 0x0001c0a2 apache's error: [Sat Mar 07 16:10:26 2009] [notice] Parent: Received restart signal - Restarting the server. [

  • JS popular jQuery plug-ins or corner of the (mainly to enrich the front desk to show results) 2010-12-22

    fckeditor Needless to say facebox Jquery plug-in pop-up layer is easy to use, the effect is quite good, and can modify the CSS to modify his style, most important, easy to get started, a small corner of this document jquery.validate I feel very good

  • rewrite url rewrite html page after the front desk of the relevant css, js file can not find a solution path 2011-01-13

    Url rewrite url rewriting configuration path, in the foreground when rendering html page will be lost to the css, js, etc. relative to the directory of the application. Specific solutions are as follows: In <head> </ head> added between <ba

  • ORACLE index table to learn 2010-08-18

    Index difference between tables and standard tables One. Index table ROWID Column is stored [ Logic ] Physical address. While the standard table ROWID Pseudo-column is stored in a real physical address, which is the most essential difference between

  • Oracle database table using the index to improve query speed 2011-02-13

    Oracle database table using the index to improve query speed in the index table stored in the ROWID of the disease is not the actual physical address of record, but the logical physical address. Therefore, some database administrators to index table

  • Index table and the difference between the standard table 2011-03-01

    Index table and the difference between the standard table First, the index table stored in the ROWID column is [logical] physical address. The standard form of the ROWID pseudo column is stored in a real physical address, which is the essential diffe

  • ColdFusion's Ajax call (using the jQuery framework) 2009-04-04

    Front Desk Code: <script type="text/javascript" src="/template/action/jquery.js"> </script> <script type="text/javascript"> function clean() { $.ajax( { type: "get", url: "/cfc/browser_attenti

  • java garbage problem 2011-09-01

    Garbage problem is very common in Java, a variety of reasons, to make a summary here, do not purport to be comprehensive, accurate, please correct me if wrong. 1 result of garbled code file page. Each file (java, js, jsp, html, etc.) has its own codi

  • Linux kernel implementation of the memory cache 2011-01-10

    Copyleft this document owned by yfydz all, the use of GPL, free to copy, reprint, reproduced keep the documents for completeness, Used for any commercial purposes is strictly prohibited. msn: Source: 1. Pr

  • Linux kernel memory cache implementation 2011-01-10

    This document Copyleft owned yfydz all use under the GPL, can be freely copied, reproduced, reprinted, please maintain the integrity of the document, Be used for any commercial purposes is strictly prohibited. msn: Source: http:

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C), All Rights Reserved. 版权所有 黔ICP备15002463号-1

processed in 0.214 (s). 10 q(s)