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

keeshakeesha
edited November 2010 in Vanilla 2.0 - 2.8
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?

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:

Comments

  • I hate to do this but i'd like to proceed from localhost to live ...

    @tim @mark @lincoln @todd

    Is there a way? is it possible? not?
  • LincLinc Detroit Admin
    edited December 2010
    I'm not sure what "assign the search form to more pages" means. You just want a search box on other pages? If you put it in the header in default.master.php (like the default theme) it would be on every page.

    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.
  • MarkMark Vanilla Staff
    @keesha - I don't see a reason not to proceed from localhost to live! What questions do you have, specifically, that you need to get answered to make that happen?
  • @Mark -

    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?

  • MarkMark Vanilla Staff
    @keesha - I guess I misunderstood your meaning in "moving from localhost to live". I thought you meant you wanted to move your forum from a local development machine to a live server. Now I think you were actually talking about something completely different: putting a search box on all pages?

    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:




  • Ok thank's i'll give it a try :)
  • @Mark damn you're right i've overlooked Lincolns second paragraph.
    I'm an inattentive girl :/

    Thank you @Lincoln.
Sign In or Register to comment.