Hello!
i don't know if this is possible and how to do it - but I would like to change the places of the vB-Style-Login and the search.
In my opinion, they don't look nice placed in the forums header and they are not this nessesary on the top, because there is a button to log in and a search as well, if you are using the dropdown. But I also think, the vB-Style-Login and this search are useful and should be somewhere.
Could they be displayed as a part of the infocenter? On the bottom there? So they can collapsed together with the infocenter, if you don't want to use or to see them?
I thought I answered to that one... oh no, I wanted to get to my (main) computer first and then it slipped out of sight.
Due to a change I made recently is slightly less easy to obtain the change, but is somehow "logical"... and actually is not
that difficult either.
Let me see...
The log in and search bars are in two functions:
template_th_login_bar
and
template_th_search_bar
that you can find in index.template.php.
The name is quite important, because just changing it they will stop to appear at the top.
So, if you for example change it to:
template_login_bar
and
template_search_bar
the two boxes will disappear.
Now you have to make them show in the IC.
The IC is shown only on the BoardIndex, so the code is in BoardIndex.template.php.
The exact result depends on how "exactly" you want to show them, let's say you want to create a single block for both, then add to the end of the page:
function template_ic_show_tools()
{
global $context, $txt, $settings;
echo '
<li class="board_row">
<h3 class="ic_section_header">
<img class="icon" src="', $settings['images_url'], '/icons/online.png', '" alt="" />Users tools</a>
</h3>';
if ($context['user']['is_guest'])
template_login_bar();
if ($context['allow_search'])
template_search_bar();
}
and, just before the line:
call_template_callbacks('ic', $context['info_center_callbacks']);
add this:
if ($context['user']['is_guest'] || $context['allow_search'])
$context['info_center_callbacks'][] = 'show_tools';
It should work... I think. O:-)
There may be issues with the css of course...
Thank you very much, emanuele... it don't looks very difficult... ;)
But I am not sure that I understood it all...
In
index.template.php I couldn't find this functions to change their names as you said:
Are they somewhere else? I didn't found them... :(
In index.template.php I just see those:
// Show log in form to guests.
if (!empty($context['show_login_bar']))
{
echo '
<div id="top_section_notice" class="user"> etc.
if ($context['allow_search'])
{
echo '
<form id="search_form" action="', $scripturl, '?action=search;sa=results" method="post" accept-charset="UTF-8">
<label for="quicksearch">
<input type="text" name="search" id="quicksearch" value="" class="input_text" placeholder="', $txt['search'], '" />
</label>';
hmm... okay, then probably the changes I'm referring to are "post-RC2"... I'm never really sure when I add things... :-\
And that's yet another reason why I should refrain from let "big" changes slip through... lol
So I have to wait until the next version of ElkArte? ;)
Thank you for your help, emanuele and never mind...it's not this necessary to have those two functions displayed.
I have tried several other things, but none of them worked.
So I disabled the VB-Style-Login and added display: none in the CSS for the searchform. It is okay this way for the moment.
Well, you can download the latest files from the repo ( https://github.com/elkarte/Elkarte/ "download" button on the right), extract and upload. Of course remember that uploading them will overwrite changes you have done to the files up to now (if any).
Now I have tried this, emanuele - and it worked! Well, not excatly as I hoped.... ;)
The VB-Style-Login and the Search disapeared from the Header, they are now displayed in Infocenter and are both working. :)
But they are "a line to deep" there and this Icon and the "Users tools" should not be shown there?
I don't know, maybe I did something wrong?
I cannot figure it out how to get the login and the the search
into the infocenter :(
So I did this:
function template_ic_show_tools()
{
global $context, $txt, $settings;
//echo '
//<li class="board_row">
//<h3 class="ic_section_header">
//<img class="icon" src="', $settings['images_url'], '/icons/online.png', '" alt="" />Users tools</a>
//</h3>';
if ($context['user']['is_guest'])
template_login_bar();
if ($context['allow_search'])
template_search_bar();
}
It looks like this now...
It is not as I would like it, but it is not too bad... ;)
Find in index.template.php function
template_login_bar, copy it and paste (at the end of this file), change name of this 'new' function to
template_login_bar2, change function name in your code.
Next step would be changing in in 'new' function
top_section_notice to
top_section_notice2.
Last step is adding some HTML to your code:
After globals add:
echo '
<li class="board_row">';
and before } add
echo'
</li>';
My version looks like this:
function template_ic_show_tools()
{
global $context, $txt, $settings;
echo '
<li class="board_row">';
if ($context['user']['is_guest'])
template_th_login_bar2();
if ($context['allow_search'])
template_th_search_bar();
echo'
</li>';
}
I'm not sure why login and search template functions are different in your files, but I think you will know what to do now :)
Thank you, phantom...but I don't know what to do at all... ;)
I have tried this now in boardindex.template:
function template_ic_show_tools()
{
global $context, $txt, $settings;
echo '
<li class="board_row">';
if ($context['user']['is_guest'])
template_login_bar();
if ($context['allow_search'])
template_search_bar();
echo'
</li>';
}
It looks like this:
Because emanuele told me to change the names in index.template.php, otherwise the search and the login will not disappear from the header...not sure if I understood him properly...
I am not sure, if I had understood... O:-) Where do I have to paste it and to change the name? In which file? In index.template.php? Not in boardindex.php?
attach your index.template and BoardIndex.template files
Those with the changes of the moment or the original files?
At the moment they look like this:
Try files from attachment
Thank you very much, phantom.
It worked for the log in. :) Looks quite nice...
But the search is still beyond the infocenter.
hm.. I have no clue how to make this work with search bar, sorry :|
And if I am logged in, then the infocenter looks like this... :o
Never mind, phantom...and thank you very much for your help.
I made it now again as I have shown in Reply #7
Grab the files attached here, based on
@phantom's work, then add to your css:
.user_tools:after {
display: block;
clear: both;
content: "";
}
and to Addons.english.php:
$txt['user_tools'] = 'Tools';
or whatever you prefer. ;)
Now it worked, great! Thank you very much, emanuele... :)
It looks a bit...I don't know how to say in English...funny?
Maybe I can change the height? I mean, that the word "tools" and the two bars are on one line, not underneath?
Finished! It was very difficult to do for me...
What do you think? ;) Is it looking nice or awful? I am not sure...
If you prefer to have them on two lines, you can remove the float on the two containers, something like:
#search_form, #top_section_notice {float: none;}
To be honest, if they stay on the same line, to me looks better one on the left and one on the right instead of the two both on the left.
Change the position of these two "blocks" is just a matter of changing the float (left/right/none) on the containers above (#search_form, #top_section_notice), if you want the search on the left you just float:left the search and float:right the login. ;)
You don't know how difficult such things are to me, emanuele.... ;)
I made some changes there again. Does it look better now? O:-)
LOL
Don't worry, I know the feeling. ;)
Guess so! :D (Of course is
you like it first and foremost. ;D)