Hey just one quick question/feature request. There may be an obvious way to do this, but I am stumped.
Documentation only lists a way to put all "left" blocks on the left, and "right" blocks on the right (I already modded xsilver to work for my site's style) - but what if I have a split header for my page (graphics on left, dynamic content on the right) and I want to offer the search block on the right half if a user is logged in, and a login block there if they aren't? I sniped the code out for a search and that appears there now ( linux.trustdevelopment.com ) but I don't want it to appear for users that aren't logged in, since I want searching to be one of the "premium services" that a person would want to register an account for...
Thanks...
Josh
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | search_block_1.patch | 1.61 KB | tangent |
| #13 | search_block_0.patch | 764 bytes | erikhopp |
| #10 | search_block.patch | 1.02 KB | erikhopp |
Comments
Comment #1
al commentedYou need to create a search.module that puts a search box in a block, using the already existing search permission to determine whether users can access it (i.e. it gets displayed) or not.
I'm moving this to a contribs feature request. Maybe someone will want to implement it for you. It would be really trivial to do...
Comment #2
al commentedAfter some thought, I've decided that having the search module able to put a simple search text box in a block with a "search" button would be a useful thing to do. I'm therefore reassigning the project, etc. for this and changing the summary to reflect this.
This would be really very easy to implement. Anyone?
Comment #3
erikhopp commentedhey.
ok, so i don't really know php and i haven't really played with the drupal core too much, so maybe it's not right, but i think i have created a block for the search module.
it works on my site (i think). the only problem is that i just cannot figure out how to change the size of the input box. it is set at 50 for the search page, but i can't seem to figure out where that value is set (and i feel like i have looked everywhere).
so if someone can change that, i think this feature request is done.
oh - and i still have not spent the time to figure out how to add stuff via cvs so the search module is here: http://mediamutiny.org/search.module
and i updated the $id. i'm not sure if i am supposed to do that or not.
i hope this helps...
erik.
Comment #4
al commentedYour module looks like it returns the search results inside the block, which isn't quite what's wanted. This is actually a bit of a mess - the search_form function should be able to do what we want, but you can't actually use it due to various issues (like the width).
I note that the xtemplate theme uses its own search form. I'm sending a patch to the mailing list that does the same thing.
BTW, the $Id: $ field in files is generated automatically by the CVS server. Don't alter it yourself - it'll make us all terribly confused...
Comment #5
al commentedA patch to implement this has been sitting in my sandbox for ages. Dries - is there something wrong with the patch? Or do you just not think this to be a valid feature request? Should it be done with a completely seperate module? Or be theme-specific?
Comment #6
erikhopp commentedso what is the status of this search block patch? i'd like to see it added if it works ok.
erik.
Comment #7
erikhopp commentedone more attempt to get this committed...
the patch is still in al's sandbox...
i have it enabled on one of my sites and it works great...
erik.
Comment #8
kristen polI need a search block so I'm writing one right now, but maybe you guys have one floating around already??? If so, where is it? :)
Thanks,
Kristen
Comment #9
gordon commentedActually when ever I need a search block I actually just create a custom block and I have never had a problem, see below.
Comment #10
erikhopp commentedhere is a patch that adds a search block. works with 4.4.x and should work with HEAD too.
Comment #11
moshe weitzman commentedIn order to mark an issue as 'patch', please submit a patch against HEAD and test it. Moving back to Active.
Also, consider using the form_x functions instead of hard coding HTML into the block.
Comment #12
pfaocleApologies for not including a patch here, but for anyone who's interested, here's my amendment to erikhopp's patch (using drupal's form functions as suggested):
Comment #13
erikhopp commentedok. thanks leafish_paul.
here is a patch that applies to HEAD.
Comment #14
erikhopp commentedforgot to set to patch...
Comment #15
dries commentedThe patch looks incomplete to me. You have to implement 'search_block()' for this work ...
Comment #16
Steven commentedThe patch is incomplete and uses borky code (the whole $var=value thing in the search block function is theoretically correct, but practically stupid). Perhaps the current search_form function should simply be modified with a width parameter so it can be used in the block too?
Comment #17
tangent commentedThe attached patch adds a hook_block and uses search_form to add the form to the block. I've extended the search_form function so that modules can alter the text prompt as having the prompt visible in a block looks bad.
I created this patch prior to searching for this issue to apologies to those who have put in work on this.
Comment #18
Steven commentedI committed a modified patch to HEAD:
- Added doxygen for the $prompt variable
- Changes search block info from "Search" to "Search form"
Comment #19
(not verified) commented