Drupal Search in Block View - drupal

i need to create a block View with a search box attach to the header in order to search nodes for one specific content type. I don't know how to achieve this, so i ask for your help. Something like the attached photo.

I'm not exactly sure here, but it sounds to me like you want to:
Create a view;
add a "filter" which limits the view to only your desired content type;
add an "argument," and then expose this argument, for either title, body, or one of your text fields.
Unfortunately:
This alone will not search the whole node. If most of your content is in body, this would probably be a good way to do it. But, for example, if for some reason you have a title like "Bicycles in Timbuktu" with a body that does not contain the word "Timbuktu" - were your users to search for Timbuktu, this item would not appear. That said, it's probably a rather rare case, and if you are simply aiming for happy users, and not rigorous perfection, this will likely be enough.
That said, Kniganapolke's suggestion of checking out Custom Search is excellent. The advice here is more applicable if you want to do this as you've designated and using the power you have with Views (and the other possibilities they offer), rather than a more dedicated-type module. If you don't have other specifications which require you to use Views, I'd guess that Custom Search will likely be the better solution.

Have you tried Custom Search module?

If anybody is interested, i have edited the header block view and load a custom_search_block inside it.
Thanks anyway

create a view with the content you want and then filter it by content. Expose the filter.
http://beeznest.wordpress.com/2011/11/01/create-a-view-to-search-on-content-title-in-7-steps-in-drupal-7/

Related

Does 2sxc have tags and categories?

I've yet to find that 2sxc has facilities for entering, browsing, filtering and otherwise allowing keyword based filtering/sorting. If so, is there documentation about this, or sample code perhaps?
I'd think it might also be likely that one could use DNN's pretty good capabilities for tags and categories, and also razor queries would enable this, but I'd sure love to see some examples/guidance on best practices for doing so from within 2sxc.
This is very easy to do, but it's much more advanced that just tags / categories.
Basically you
Create a new ContentType for the related information - like Tag, Category or whatever. It can have more fields than just a title, as a category could also have an icon
Add some of that data
Go to the content type where you want to use it, create a "Entity / Content-Item" field
Then go to the field settings, give it the name of the related info that is allawed and if 1 or more items may be added (category is often just 1, Tags is often many)
that's it :)
I think I've found a start on this at:
http://2sxc.org/en/Docs-Manuals/Feature/feature/2685
and the demo at
http://2sxc.org/dnn-app-demos/en/Apps/FAQ-with-Categories

Drupal - Show content on specific page

Am I able to add the following field to a content type, so that each piece of content I create can be conditioned to a page?
Or is there a module to extend Publishing Options, where by it adds all the pages I have created (just like 'Promote to Front Page')?
If not, why is no one doing this? As a new user to Drupal this seems like it would be a handy operation. (I have already tried this module but it doesn't achieve the results I'm after).
If none of these solutions are available, what would be the best alternative way of doing this?
I've posted this question on Stack Exchange for Drupal but I need a quick answer and there seems to be a bigger community here :D
You should use Context. With Context, you'll be able to manage contextual conditions and reactions for your drupal like Regions.
Have you used Views? it is one of the most common used drupal modules. It doesn't extend publishing options directly but it does replace it in a way. You can say by example put a list of al content-types: your_own_Content_type that have the publishing options of promoted to front-page. then sort them by title, date, what ever you like.
you could also create only one view and create multiple blocks out of it. you have to understand the logic of drupal: if you want different blocks on different pages, you have to create the different pages AND different blocks
create the view for one type of content-type and make one block out of it. put this block on the desired page. All your other blocks are made with the same view, just adjust a condition in your view and create a new block out of it. You should also put all your blocks in the same region, and set the to the right pages
here you can find a lot of documentation if you run into any problems... drupal.org/project/views
Views is the best at creating a slideshow of images or any type of data on your site.
Used in combination with nodequeue it might offer near or the full functionality you are trying to achieve (check this out ... and this too) - but I don't understand your question entirely.
By my opinion Views is too complicated task for much simple request.
There is a few ideas for solution:
Easy way - You can create a specific template file or add some if statments to the node.tpl.php(specific tpl better)
For minor changes - Create a new context with "path" filter and "theme html" reaction, than hide the field by the css
Best but complicated(large usages) - create a new "view mode" and implement the display by new "hook_menu".
~ Almog

Drupal 7 - Administration - Find node by it's field value

I'm looking for the way for the site's administrator / moderator to find / filter the list of nodes by some field custom value. Field value could be defined by radio / text / checkbox etc.
Default content listing proposes only few filters, it's not enough for sites with huge amount of custom nodes.
Use an EntityFieldQuery object, documented here:
http://api.drupal.org/api/drupal/includes--entity.inc/class/EntityFieldQuery/7
The documentation has no examples (ugh), but there's a thread here with some:
http://drupal.org/node/916776
EDIT: Ah, you're talking about administration and not actually writing a module to do it. If that's the case, use a view with exposed filters, like the other guy said. :)
Maybe it would help to use a view for it, where you set filters, so that you get the desired listing.
I had to test this, but I've just confirmed. Views in Drupal 7 can indeed filter across multiple content types w/ custom fields, and still have filters apply to those custom fields. They seem to treat the nodes w/o those custom fields as empty or null values.
So for instance, I have article and blog content types. Blog has images, article does not. I can sort or filter on the image field, even though article doesn't have it. It simply assumes the field is null or empty.
This however, may not solve your problem of having a large number of custom fields. If these are dynamic (i.e. they grow over time) you might be in trouble. If, however, they are set, and just a very large number, you could manage this.
So while there is no automatic add all fields, which I believe you mentioned in a previous post, you could feasibly search on a large variety of the fields. Even exposing fields that you don't necessarily display in the table, but can then search on. Or changing the fields you expose or display on a per page basis in the view. All from one view. And then you could export the view to bring it over to the other sites.
I was going to try and attach the exported view, but the export is rather large for inclusion in an answer, I think. Please let me know if you think I should still include it, or if you'd rather I can simply send it to you through a PM. Let me know!
EDIT: I decided to include a link to an export of the view. http://greggalante.com/sites/greggalante.com/files/cross_type_view.txt
http://drupal.org/project/search_api

Drupal—Content Repetition & Consistency

I'm currently working on a Drupal site (I'm fairly new to Drupal) and need to be able to create some blocks of content that appear on multiple pages and remain consistent between those pages. I'll need it so that if I change the content in one place, the change will be reflected in all places it appears.
I've looked around in CCK a bit but can't seem to find a way to accomplish this there. Is there a way to accomplish this?
Thank you!
You can define your own blocks at /admin/build/block/add, just put your content inside a block and then go to "page specific visibility settings" and put the pages, on which the block should appear there.
There are other ways to achieve something like you describe, if the blocks don't do what you need you should provide some more details on what exactly you want to do. Depending on the structure of your site, you could also use a node (set to appear at the top of lists) that is set to appear on those pages.
It would depend of what kind of data you need to display in this block if its static use
/admin/build/block/add
if you intend to fetch some content from your content types use views to create such block and then use "page specific visibility settings".

DRUPAL: combine CCK image and videos in a common ordered list. Possible?

I'm working on multiple videos and images page on Drupal.
I would like to know if I can combine Video and Image CCK fields in back-end content type pages, in order to assign them a common mixed order, when I have multiple images and videos.
ps. I don't want to create a node for each image/video, I prefer to use the CCK fields, since it is easier for my customer to manage the files, change the order and delete them.
thanks
I suppose you can set a generic field type, use filefield module, and in the 'allowed filetypes' setting enter all image and video filetypes (png jpg gif avi flv etc), then also set 'unlimited' for the quantity allowed.
That said, maybe you need to explain your question or situation further, maybe provide a more detailed use case. Everyone seems confused about your question, and your basic structural plan may be flawed.
Usually you want to keep these things in separate fields, then use different views to pull exactly what you want. View1 would pull videos from the video field of the content type, View2 would pull images from the image field of the content type, View3 would pull videos and images, etc. When they are all mixed into one field you have to do extra parsing on the end to get what you want out, and that's more difficult.
But I don't think we understand what you are asking, an example case may help us help you.
If you're just asking if you can have image fields and video fields on the same content type, then the answer is yes.
That said, I have no idea what you mean by "a common mixed order."
You could look at using Views. http://drupal.org/project/views
Set it up to display Nodes and then add in all the fields you want, you can then set the style to be Ordered List. This should give you something similar to what your trying to achieve.

Resources