Hi All,
I have a view that presents a list of people to the user. I'd like to have a search box that allows you to search all fields. Currently, I'm using an "Exposed Filter" on one of the fields, but it'd be nice if I could apply this filter to all fields.
If this isn't the proper place for this kind of support, I apologize, and would appreciate if someone could point me in the right direction.
Thanks!
Hi,
Actually you can use the search module, and search the node using the Drupal search module to access the nodes.
I User this as an exposed filter to access allow a full text based search of the nodes.
Gordon.
Dave Sullivan wrote:
Hi All,
I have a view that presents a list of people to the user. I'd like to have a search box that allows you to search all fields. Currently, I'm using an "Exposed Filter" on one of the fields, but it'd be nice if I could apply this filter to all fields.
If this isn't the proper place for this kind of support, I apologize, and would appreciate if someone could point me in the right direction.
Thanks!
On 1/24/07, Gordon Heydon gordon@heydon.com.au wrote:
Actually you can use the search module, and search the node using the Drupal search module to access the nodes.
I User this as an exposed filter to access allow a full text based search of the nodes.
Just to clarify Gordon's response (because it was new to me when I figured out how this worked and it took me a second).
If you enable the search module then Views has a "search index" field that you can have as a filter (including exposed filter). This then searches the drupal search index and returns items in the view based upon the search index from the search module.
It's amazing all the little features in different modules that I miss during my first (and second and third) use of them.
Greg
On Thursday 25 January 2007 09:23, Greg Knaddison - GVS wrote
On 1/24/07, Gordon Heydon gordon@heydon.com.au wrote:
Actually you can use the search module, and search the node using the Drupal search module to access the nodes.
I User this as an exposed filter to access allow a full text based search of the nodes.
Just to clarify Gordon's response (because it was new to me when I figured out how this worked and it took me a second).
If you enable the search module then Views has a "search index" field that you can have as a filter (including exposed filter). This then searches the drupal search index and returns items in the view based upon the search index from the search module.
It's amazing all the little features in different modules that I miss during my first (and second and third) use of them.
Greg
-- Greg Knaddison | Growing Venture Solutions Denver, CO | http://growingventuresolutions.com Technology Solutions for Communities, Individuals, and Small Businesses
Thanks for your suggestions. Just to clarify -- are you referring to the stock search module that comes with Drupal? I have that enabled, but I don't see a search index field and/or filter in my views configuration.
On 1/25/07, Dave Sullivan dave@dave-sullivan.com wrote:
Thanks for your suggestions. Just to clarify -- are you referring to the stock search module that comes with Drupal? I have that enabled, but I don't see a search index field and/or filter in my views configuration.
Perhaps you have an older version of views, but it's right there in "Add Filters" dropdown "Search: Index." That's using views 5.x-1.5.
Regards, Greg
hi folks, any idea how to create a block of recent blog posts by one user?
thanks -- will
Create a custom block with input format "PHP" with PHP code in it that looks something like this:
<?php $result = db_query("SELECT nid, title, uid, '' FROM node WHERE uid = ## AND type = 'blog' ORDER BY created LIMIT 10");
$content = node_title_list($result, "Joe Bob's Blog"); echo $content; ?>
You'll need to change ## to the numeric user id of the user's blog you want.
I recognize this problem has been solved for the poster of the original question, but I want to strongly suggest that this option not be used for others who may be considering it.
My reasons include:
The SELECT query here ignores any unpublished nodes (needs a "AND published = 1").
The SELECT query will show the first 10 posts, not the last 10 (needs a DESC after the "ordered by created").
The query also assumes the tables have no prefixes, but I'll assume anyone who uses it can adjust that value.
Similary, the query might assume MySQL with the limit, depends on whether or not you use an offset. It isn't cross DB safe (db_query_limit might have been better).
The block also cannot be later edited by any user who doesn't have the PHP input filter permission (any saved edits will revert to a filter HTML by default).
But the real, most important reason I think it's questionable is because it doesn't include any way to check the user reading the post has permissions to read the content the title will link to. Even if the title is all the user without permissions can see, showing a link without access to the main content is bad practice. Some permission checking modules (og, node_privacy_by_role (for < Drupal 5)) need the db_rewrite_sql hook calls to limit what nodes are being displayed based on role, node type or other permission limits.
Yes, it is possible to construct a query that handles all of these issues. Instead of such a query, I highly recommend using the views module, as others have suggested, to minimize the need to worry about them, or any other issues that might arise (like the PHP filter requirement).
Kitt.
Create a custom block with input format "PHP" with PHP code in it that looks something like this:
<?php $result = db_query("SELECT nid, title, uid, '' FROM node WHERE uid = ## AND type = 'blog' ORDER BY created LIMIT 10"); $content = node_title_list($result, "Joe Bob's Blog"); echo $content; ?>
You'll need to change ## to the numeric user id of the user's blog you want.
hi, i used the views module and checked 'provide as a block'
Kitt Hodsden wrote:
I recognize this problem has been solved for the poster of the original question, but I want to strongly suggest that this option not be used for others who may be considering it.
My reasons include:
The SELECT query here ignores any unpublished nodes (needs a "AND published = 1").
The SELECT query will show the first 10 posts, not the last 10 (needs a DESC after the "ordered by created").
The query also assumes the tables have no prefixes, but I'll assume anyone who uses it can adjust that value.
Similary, the query might assume MySQL with the limit, depends on whether or not you use an offset. It isn't cross DB safe (db_query_limit might have been better).
The block also cannot be later edited by any user who doesn't have the PHP input filter permission (any saved edits will revert to a filter HTML by default).
But the real, most important reason I think it's questionable is because it doesn't include any way to check the user reading the post has permissions to read the content the title will link to. Even if the title is all the user without permissions can see, showing a link without access to the main content is bad practice. Some permission checking modules (og, node_privacy_by_role (for < Drupal 5)) need the db_rewrite_sql hook calls to limit what nodes are being displayed based on role, node type or other permission limits.
Yes, it is possible to construct a query that handles all of these issues. Instead of such a query, I highly recommend using the views module, as others have suggested, to minimize the need to worry about them, or any other issues that might arise (like the PHP filter requirement).
Kitt.
Create a custom block with input format "PHP" with PHP code in it that looks something like this:
<?php $result = db_query("SELECT nid, title, uid, '' FROM node WHERE uid = ## AND type = 'blog' ORDER BY created LIMIT 10"); $content = node_title_list($result, "Joe Bob's Blog"); echo $content; ?>
You'll need to change ## to the numeric user id of the user's blog you want.
Good grief.
It was just a rough sketch of a suggestion, not a fully developed solution.
View is its own can of worms. There is no free lunch.
Will,
On 1/25/07, will hall will@theicarusproject.net wrote:
hi folks, any idea how to create a block of recent blog posts by one user?
You could use the views module to create a block view of recent posts. In the views admin, tell it to create a block with x nodes, filter it by user and node type and then sort by date created (descending).
Cheers, Dan
Quoting Dan Karran dan@karran.net:
Will,
On 1/25/07, will hall will@theicarusproject.net wrote:
hi folks, any idea how to create a block of recent blog posts by one user?
You could use the views module to create a block view of recent posts. In the views admin, tell it to create a block with x nodes, filter it by user and node type and then sort by date created (descending).
Or just create a menu named Blogs and add menu items for blog/<uid>.
Earnie
thanks all for the suggestions, i am going to give the views module a try as i'm a bit comfortable with that. peace will
Earnie Boyd wrote:
Quoting Dan Karran dan@karran.net:
Will,
On 1/25/07, will hall will@theicarusproject.net wrote:
hi folks, any idea how to create a block of recent blog posts by one user?
You could use the views module to create a block view of recent posts. In the views admin, tell it to create a block with x nodes, filter it by user and node type and then sort by date created (descending).
Or just create a menu named Blogs and add menu items for blog/<uid>.
Earnie
ok so i did it with views and it works perfectly. thanks again.
-- will
will hall wrote:
thanks all for the suggestions, i am going to give the views module a try as i'm a bit comfortable with that. peace will
Earnie Boyd wrote:
Quoting Dan Karran dan@karran.net:
Will,
On 1/25/07, will hall will@theicarusproject.net wrote:
hi folks, any idea how to create a block of recent blog posts by one user?
You could use the views module to create a block view of recent posts. In the views admin, tell it to create a block with x nodes, filter it by user and node type and then sort by date created (descending).
Or just create a menu named Blogs and add menu items for blog/<uid>.
Earnie
On Thursday 25 January 2007 12:03, Greg Knaddison - GVS wrote:
Perhaps you have an older version of views, but it's right there in "Add Filters" dropdown "Search: Index." That's using views 5.x-1.5.
Regards, Greg
-- Greg Knaddison | Growing Venture Solutions Denver, CO | http://growingventuresolutions.com Technology Solutions for Communities, Individuals, and Small Businesses
I'm running Drupal 4.7 -- not sure which version of views. I'll have to check, and upgrade accordingly.
Thanks for your assistance.
Op donderdag 25 januari 2007 01:10, schreef Gordon Heydon:
Actually you can use the search module, and search the node using the Drupal search module to access the nodes.
I User this as an exposed filter to access allow a full text based search of the nodes.
This has some serious limitations though. First: you cannot search for just a wildcard (without any keys). Therefore this will only work when someone types somethign in that search-keyword field. Very confusing if used with other exposed filters, because your view will show no results untill someone provides a keyword. Second: search index has hardcoded: comments, tags/terms, title, teaser and body additions to the index of a node. This may, or may not be what you want. If its not, search index is not an option. Third: Search index in views requires search in core to be anabled. You may find this core search ugly confusing or whatever. If you have a serious reason not to want to have this search screen enabled at all, then you cannot enable only the views part of the search index: the interfaces come with it, wether you want them or not.
Bèr