Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Searchform on more pages
keesha
✭
I've got only a single search form on my discussions page, just like here, but is there a simple way to assign the search form to more pages?
i've also found this code below in my hooks.php, is there perhaps something relevant in here?
tia
i've also found this code below in my hooks.php, is there perhaps something relevant in here?
class VFOrgThemeHooks implements Gdn_IPlugin {
public function Setup() {
return TRUE;
}
public function DiscussionsController_Render_Before(&$Sender) {
$Form = Gdn::Factory('Form');
$Form->InputPrefix = '';
$SearchForm = '<div class="SearchForm">'
.$Form->Open(array('action' => Url('/search'), 'method' => 'get'))
.$Form->TextBox('Search')
.$Form->Button('Search', array('Name' => ''))
.$Form->Close()
.'</div>';
$Sender->AddAsset('Content', $SearchForm, 'Content');
}
}
tia
Tagged:
0
Comments
@tim @mark @lincoln @todd
Is there a way? is it possible? not?
Otherwise, you could make copies of DiscussionsController_Render_Before for any other pages you want it on. For instance making a copy called DiscussionController_Render_Before (note the lack of 's') would add it to single discussion views.
Actually i'd like to put the searchbox on top of all pages.
it's pretty simple solved in wordpress , all i need to do there is to put this tag
<?php get_search_form(); ?>
into the header and voila.I was hoping that there is also a simple way to perform something like that.
@Lincoln -
I would appreciate an example code for class.mythemehooks.php for a search form on the Discussions and Profile page.
Would that be possible?
If I am correct about the search box, I think you're overcomplicating it! It is as simple in Vanilla as it is in WordPress
Lincoln described the process already, but I'll clarify:
If you are using a custom theme, go into that theme folder, then the "views" folder within, and open the default.master.php (or default.master.tpl, whichever is there). You have full control to put any html you like in there. So, just find where you'd like the search form to go, and enter this:
I'm an inattentive girl
Thank you @Lincoln.