User login

Ask Agaric: Views of comments in Drupal 5

how do I make a view that displays only recent comments made on a certain content type?

This is basic views functionality.

Simply filter by node: type to restrict the view to specific content types.

The trick is you have to choose list (or table and possibly other views made possible by the Views Bonus Pack). Then you can select which fields to show: comment subject and time and body and anything else comment related.

If you choose full node or teasers for your view, fields are ignored entirely. And you can't show comments without fields.

Agaric's extra tip:

To edit a default view (a view provided by views module or another module), you click "Add" (rather than enable).

This also lets you see how that view was created, which can be helpful in making or refining your own.

If you change the name and path, at least, you get a copy of the view with any other modifications you made.

So the easiest way to show recent comments by node type would be to go to Administer » Build » Views (admin/build/views) and click add next to recent_comments, add a filter to restrict matches to the relevant content type or types, and save as your own view.

Agaric additional extra tip, on panels:

Views combined with Panels can be used to create a page with two lists, one in each column. (Both these great, essential modules are by merlinofchaos, aka Earl Miles.)

In Drupal terminology we want a two-column panel with a view in each. So you make your views, probably by making one and then easily making a variation of it by clicking "clone" (make sure the clone view module is enabled if it isn't in Views core yet).

Don't forget to change the view name (machine-readable and optional title) and url path (if any) for the new copy of the original view.

how do I make a view that displays only recent comments made on a certain content type?

This is basic views functionality.

Simply filter by node: type to restrict the view to specific content types.

The trick is you have to choose list (or table and possibly other views made possible by the Views Bonus Pack). Then you can select which fields to show: comment subject and time and body and anything else comment related.

If you choose full node or teasers for your view, fields are ignored entirely. And you can't show comments without fields.

Agaric's extra tip:

To edit a default view (a view provided by views module or another module), you click "Add" (rather than enable).

This also lets you see how that view was created, which can be helpful in making or refining your own.

If you change the name and path, at least, you get a copy of the view with any other modifications you made.

So the easiest way to show recent comments by node type would be to go to Administer » Build » Views (admin/build/views) and click add next to recent_comments, add a filter to restrict matches to the relevant content type or types, and save as your own view.

Agaric additional extra tip, on panels:

Views combined with Panels can be used to create a page with two lists, one in each column. (Both these great, essential modules are by merlinofchaos, aka Earl Miles.)

In Drupal terminology we want a two-column panel with a view in each. So you make your views, probably by making one and then easily making a variation of it by clicking "clone" (make sure the clone view module is enabled if it isn't in Views core yet).

Don't forget to change the view name (machine-readable and optional title) and url path (if any) for the new copy of the original view.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.