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')) (
return;
)
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>
<div>
<? Php print $ submitted?>
</ Div>
<div>
<? Php print $ content?>
<? Php if ($ signature):?>
<div>
<? Php print $ signature?>
</ Div>
<? Php endif;?>
</ Div>
<? Php if ($ links):?>
<div>
<? 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.
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Use the Flag to mark the essence Comments (change)

  • jQuery / Ajax / PHP / Json example of an integrated collection

    jQuery excellent Javascript is a framework for a good js packaging, provides a lot of convenient features. jQuery for ajax packaging can be called outstanding. jQuery can json file transfer protocol to transmit data (similar to xml, but also significant t

  • Verification Code Rails implementation continued

    http://sanyking.javaeye.com/blog/120339 Connect with the address above on this website are one of the other way regarding the implementation Verification Code article, my article are based on the above completed, and the world is one big copy article, loo

  • Play flash page 3 (javascript script swfobject.js1)

    / ** * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/ * * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License: * Http://www.opensource.org/licenses/mit-license.php * * / if (typeof deconc ...

  • Struts Spring Hibernate test Noodles

    Hibernate working principle and why to use? Principle: 1. To read and parse configuration file 2. Read and analytic mapping information, create a SessionFactory 3. Open Sesssion 4. Create Affairs transation 5. Persistence operation 6. Submitted Services 7

  • Hibernate's cache management

    Carried ] [http ://www.cnblogs.com/eflylab/archive/2007/01/11/617276.html Cache is the cache, it is often to improve system performance are the most important means to serve as a reservoir of data and the role of a buffer. Cache for the substantial r ...

  • javascript built-in functions Info

    48. In the old browsers do not perform this JS :<!-- //--> 49. To quote a document-style JS: <script type="text/javascript" src="/blog/aaa.js"> </ script> 50. Specified in the script does not support the browser displ

  • Imitation Java type HashMap implementation of JavaScript

    Imitation Java type HashMap implementation of JavaScript

  • Javascript object inheritance

    Javascript object inheritance

  • Javascript Object Model

    Javascript Object Model

  • Hibernate II Study Notes

    11. Many-to-many Of many that can be converted to two one-to-many <set name="students" table="teacher_student"> <key column="techer_id"/> <many-to-many column="student_id"/> </set> many-to-many data only from one end of the mainten

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries