Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
2.5k views
in Q2A Core by
In my site, very few people register--it's sort of "public asks, experts answer", so most questions are anonymous. Sort of an FAQ/knowledge base. So with the Snow theme I moved the login bar to the bottom of the page, since it is not relevant to most users. But this also puts the search box where few will see it. It would be better in the sidebar. I don't really understand PHP very well so I dont know what to do with the advanced theme. How would I tell it to put the search box in the sidebar, or, alternatively, plug some HTML into the sidebar text widget (what would that HTML look like?). thanks a bunch for any help.
Q2A version: 1.5.3

1 Answer

+4 votes
by

 

Add the following as is to Your /qa-theme.php in your snow folder.
 
In the first function //$this->search(); indicates that the search will not appear, and in the second function $this->search(); indicates that it has to appear. I f You want it somewhere else in the sidepanel and not in the sidebar (what is nothing else then the welcome box), you can copy from qa-include/qa-theme-base.php the sidepanel function to your advanced theme qa-theme.php and add the search instruction there.
 
function nav_user_search()
{
$this->nav('user');
//$this->search();
}
 
function sidebar()
{
$sidebar=@$this->content['sidebar'];
 
if (!empty($sidebar)) {
$this->output('<DIV CLASS="qa-sidebar">');
$this->search();
$this->output_raw($sidebar);
$this->output('</DIV>', '');
}
}

 

by
Thank you, but I don't know how to use it. There is already a long "function nav_user_search" statement in Snow's qa_theme.php file, and I don't understand how to combine this one with it... I tried simply preceding it with this and the site became inaccessible.
by
I will downoad it and look into it. Please wait.
by
OK

Replace in SNOW qa-theme.php function nav_user_search() the line

qa_html_theme_base::nav_user_search();

with

$this->nav('user');

Thats all

________________________________________________________

Explanation:

The line qa_html_theme_base::nav_user_search(); does load the original function from qa-theme-base.php
We are replacing the line with all that what is left of this original function.

The original function was :
function nav_user_search()
        {
            $this->nav('user');
            $this->search();
        }
but we only need the first part  $this->nav('user');

I hope it works now.

The function in SNWO qa-theme.php shpoud ook ike that:

function nav_user_search() // outputs login form if user not logged in
        {
            if (!qa_is_logged_in()) {
                $login=@$this->content['navigation']['user']['login'];
               
                if (isset($login)) {
                    $this->output(
                        '<!--[Begin: login form]-->',               
                        '<form id="qa-loginform" action="'.$login['url'].'" method="post">',
                            '<input type="text" id="qa-userid" name="emailhandle" placeholder="'.trim(qa_lang_html('users/email_handle_label'), ':').'" />',
                            '<input type="password" id="qa-password" name="password" placeholder="'.trim(qa_lang_html('users/password_label'), ':').'" />',
                            '<div id="qa-rememberbox"><input type="checkbox" name="rememberme" id="qa-rememberme" />',
                            '<label for="rememberme" id="qa-remember">'.qa_lang_html('users/remember').'</label></div>',
                            '<input type="submit" value="'.$login['label'].'" id="qa-login" name="dologin" />',
                        '</form>',               
                        '<!--[End: login form]-->'
                    );
                   
                    unset($this->content['navigation']['user']['login']); // removes regular navigation link to log in page
                }
            }
           
            $this->nav('user');
        }
by
It worked, thanks so much. I now have the search box where I want it, and it is no longer where I don't need it to be. Perfect.
...