Moved search to header, lost search functionality

You made an own skin or theme for phpMyFAQ. You can share it here with others!

Moderator: Thorsten

Post Reply
timcappalli-lyndon
Posts: 13
Joined: Thu Dec 15, 2011 4:13 am

Moved search to header, lost search functionality

Post by timcappalli-lyndon »

I moved the search code from the main content area to the header and now the search functionality has been lost. Instead of showing the proper text in the button (Search) and below the bar (Advanced search), the text displays the variables. When I click the search button, I get a page cannot be displayed because the variable isn't being replaced. Does this piece of code not get processed until the content area?
JochenS
Posts: 121
Joined: Wed Feb 16, 2011 3:51 pm
Location: Schönaich
Contact:

Re: Moved search to header, lost search functionality

Post by JochenS »

I think yes.
If you check the index.php in line 484, there is a if clause searching for main.

Thorsten, could you comment?
Our public FAQ is proudly powered by phpMyFAQ: http://vhtfaq.ge51.honeywell.de/
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Moved search to header, lost search functionality

Post by Thorsten »

Hi,

yes, it cannot work because the template variables are not parsed.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
timcappalli-lyndon
Posts: 13
Joined: Thu Dec 15, 2011 4:13 am

Re: Moved search to header, lost search functionality

Post by timcappalli-lyndon »

Is there any workaround to get this to work?
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Moved search to header, lost search functionality

Post by Thorsten »

Hi,

I need to know exactly what you've changed.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
timcappalli-lyndon
Posts: 13
Joined: Thu Dec 15, 2011 4:13 am

Re: Moved search to header, lost search functionality

Post by timcappalli-lyndon »

I literally took the code from the main content area in the index and moved it to the header. Code below:

Code: Select all

<!-- <div id="searchBox-header">
        [globalSearchBox]
		<a href="http://www.lyndonstate.edu/" target="_blank">Lyndon Home</a>
            <form id="search" action="{writeSendAdress}" method="get">
                <input type="hidden" name="searchcategory" value="{categoryId}" />
                <input type="hidden" name="action" value="search" />
                <input type="search" name="search" id="searchfield" size="30" placeholder="Search ITS" />
               <input type="submit" name="submit" value="Go" /> 
				<!-- <input type="image" size="16" src="/template/lyndonits/images/search.gif" value="{searchBox}"/> 
            </form>
            {msgSearch}
        [/globalSearchBox]
        </div> -->
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Moved search to header, lost search functionality

Post by Thorsten »

Hi,

in which file did you placed that? index.tpl?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
timcappalli-lyndon
Posts: 13
Joined: Thu Dec 15, 2011 4:13 am

Re: Moved search to header, lost search functionality

Post by timcappalli-lyndon »

Correct. Here is the entire section of the index.tpl (right now the search is commented out)

Code: Select all

<div id="header-wrapper">
<header id="header">
<div id="header-logo">
    <a href="http://it.lyndonstate.edu"><img src="/template/lyndonits/images/ITS-Header-Logo.png" alt="Lyndon ITS Logo"/></a>
</div>

<div id="header-search">
<!-- <div id="searchBox-header">
        [globalSearchBox]
		<a href="http://www.lyndonstate.edu/" target="_blank">Lyndon Home</a>
            <form id="search" action="{writeSendAdress}" method="get">
                <input type="hidden" name="searchcategory" value="{categoryId}" />
                <input type="hidden" name="action" value="search" />
                <input type="search" name="search" id="searchfield" size="30" placeholder="Search ITS" />
               <input type="submit" name="submit" value="Go" /> 
				<!-- <input type="image" size="16" src="/template/lyndonits/images/search.gif" value="{searchBox}"/> 
            </form>
            {msgSearch}
        [/globalSearchBox]
        </div> -->
</div>

</header>
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Moved search to header, lost search functionality

Post by Thorsten »

Hi,

this should work. Did you enabled the Ajax Instant Search on the start page in the admin configuration? If yes, please disable it.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
timcappalli-lyndon
Posts: 13
Joined: Thu Dec 15, 2011 4:13 am

Re: Moved search to header, lost search functionality

Post by timcappalli-lyndon »

Instant Search on the home page is not enabled. Still can't seem to get this work.

This is how it appears: Image
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Moved search to header, lost search functionality

Post by Thorsten »

Hi,

could you please send me your templates by e-mail, I can check it on my testsystems. My e-mail address is thorsten AT phpmyfaq DOT de

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Moved search to header, lost search functionality

Post by Thorsten »

Hi,

I found the issue: you have to remove the second [globalSearchBox], because only the last template block is parsed. If you remove it, it works.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
timcappalli-lyndon
Posts: 13
Joined: Thu Dec 15, 2011 4:13 am

Re: Moved search to header, lost search functionality

Post by timcappalli-lyndon »

That seemed to work for the most part. The new issue seems to be that on certain pages, the search portion of that box does not appear. I added custom text above the search box and that seems to stay. The pages I noticed that the search box didn't appear were the actually FAQ pages, the contact pages, and any custom pages I added.

Image
Post Reply