Page 1 of 1

Is there a way to add a search bar to the master page?

Posted: Tue Oct 07, 2014 1:32 pm
by HedgeHog
I'm wanting to skip over the default page, and the toc pages generated by Flare, and send people to a home page that I specify (and can customize). The problem with that is the search bar only shows up on the Flare generated default page. Has anyone had any success adding one to the master page?

Thanks!

Re: Is there a way to add a search bar to the master page?

Posted: Wed Oct 08, 2014 12:46 am
by NorthEast
I'd give some more detail about what output/target you're using, and what you mean by "skip over the default page, and the toc pages generated by Flare".

If you mean that you don't want to use the skin (Default.htm) at all, and only want to display the topic files stand-alone; then that's going to be difficult.

If you are using the skin, and just want a secondary search box to appear in topics, then add a form with an input box to enter the search term, and then use the term that's entered in a CSH call which reloads the page. You can use a search term in the CSH URL, e.g. a search for "developers" on the Flare WebHelp: http://webhelp.madcapsoftware.com/flare10/Default.htm#search-developers

Re: Is there a way to add a search bar to the master page?

Posted: Wed Oct 08, 2014 6:54 am
by HedgeHog
I'm using a mobile output and target. Sorry for not being more specific, I thought this section was just for mobile help.

When Flare generates a mobile output, the default landing page has a search bar and a link to the TOC. I want to direct users to a different page in the help (that I've already created). This page has a mini-toc proxy in it, so that users won't have to click on a link to arrive at the TOC, and so that the header and footer from my master page will show up. The only problem with this method is the search bar only shows up on the default landing page.

Re: Is there a way to add a search bar to the master page?

Posted: Wed Oct 08, 2014 7:42 am
by NorthEast
Sorry, I didn't notice the forum area.

I think you can re-use the code for the in-built search in mobile; try adding this to your master page:

Code: Select all

        <form method="get" action="../Resources/Search.htm" id="searchForm">
            <input type="text" name="query" id="searchField" />
            <input type="submit" alt="Search" value="Search" id="searchSubmit" />
        </form>
That should work provided the topic is in the root content folder; i.e. in the output, the path from the topic to the search results page path is ../Resources/Search.htm

If you're hosting this on a server, you could use an absolute path to the search results page, so it works from any topic.

Re: Is there a way to add a search bar to the master page?

Posted: Wed Oct 08, 2014 7:53 am
by HedgeHog
Yeah, I've got this working:

<form onsubmit="location.href='file:///C:/Users/sadixon/Desktop/Flare/Output/sadixon/Mobile_Responsive_Test/Advanced/Resources/Search.htm?query=' + document.getElementById('myInput').value; return false;">
<input type="text" id="myInput" />
<input type="submit" />
</form>

And I can change the path once it's published. I was just hoping there was a way to do this without a redirect. Thanks!

Re: Is there a way to add a search bar to the master page?

Posted: Wed Oct 08, 2014 8:00 am
by NorthEast
That's the code the Flare home page uses for the search; it displays the results in the Search.htm page.

If you want it to do anything different, you'd have to write the code yourself.

Re: Is there a way to add a search bar to the master page?

Posted: Wed Oct 08, 2014 8:02 am
by HedgeHog
Good to know, thanks!