ElkArte Community

Project Support => General ElkArte discussions => Topic started by: Ruth on August 28, 2014, 06:09:01 pm

Title: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on August 28, 2014, 06:09:01 pm
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?
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: emanuele on August 29, 2014, 12:36:46 pm
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[1] 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:
Code: [Select]
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:
Code: [Select]
call_template_callbacks('ic', $context['info_center_callbacks']);
add this:
Code: [Select]
	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...
I knew I should not do "big" changes in RC! Darn!
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on August 29, 2014, 02:12:56 pm
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:

Quote from: emanuele –
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.


Are they somewhere else? I didn't found them...  :(

In index.template.php I just see  those:

Code: [Select]
// Show log in form to guests.
if (!empty($context['show_login_bar']))
{
echo '
<div id="top_section_notice" class="user"> etc.

Code: [Select]
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>';

Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: emanuele on August 29, 2014, 08:26:19 pm
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
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on August 30, 2014, 03:00:27 am
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.
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: emanuele on August 30, 2014, 08:13:07 am
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).
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on September 18, 2014, 04:32:17 pm
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?
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on September 19, 2014, 02:44:41 pm
I cannot figure it out how to get the login and the the search into the infocenter :(

So I did this:

Code: [Select]
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... ;)
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Adrek on September 19, 2014, 03:03:34 pm
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:
Code: [Select]
	echo '
<li class="board_row">';

and before } add
Code: [Select]
	echo'
</li>';

My version looks like this:
Code: [Select]
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 :)
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on September 19, 2014, 04:14:19 pm
Thank you, phantom...but I don't know what to do at all... ;)
I have tried this now in boardindex.template:

Code: [Select]
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:

Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on September 19, 2014, 04:15:00 pm
Quote from: phantom – I'm not sure why login and search template functions are different in your files

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...


Quote from: phantom – 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.

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?
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Adrek on September 19, 2014, 04:24:19 pm
attach your index.template and BoardIndex.template files
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on September 19, 2014, 04:32:31 pm
Those with the changes of the moment or the original files?

At the moment they look like this:

Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Adrek on September 19, 2014, 04:36:08 pm
Try files from attachment
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on September 19, 2014, 04:49:13 pm
Thank you very much, phantom.

It worked for the log in.  :) Looks quite nice...
But the search is still beyond the infocenter.
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Adrek on September 19, 2014, 05:04:34 pm
hm.. I have no clue how to make this work with search bar, sorry :|
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on September 19, 2014, 05:07:13 pm
And if I am logged in, then the infocenter looks like this... :o
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on September 19, 2014, 05:20:27 pm
Never mind, phantom...and thank you very much for your help.

I made it now again as I have shown in Reply #7
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: emanuele on September 19, 2014, 05:47:29 pm
Grab the files attached here, based on @phantom's work, then add to your css:
Code: [Select]
.user_tools:after {
display: block;
clear: both;
content: "";
}
and to Addons.english.php:
Code: [Select]
$txt['user_tools'] = 'Tools';
or whatever you prefer. ;)
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on September 19, 2014, 06:36:51 pm
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?
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on September 20, 2014, 08:49:05 am
Finished! It was very difficult to do for me...

What do you think? ;)  Is it looking nice or awful? I am not sure...

Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: emanuele on September 20, 2014, 10:15:53 am
If you prefer to have them on two lines, you can remove the float on the two containers, something like:
Code: [Select]
#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. ;)
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: Ruth on September 20, 2014, 11:13:06 am
You don't know how difficult such things are to me, emanuele.... ;)

I made some changes there again. Does it look better now? O:-)
Title: Re: VB-Style-Login and Search displayed in Infocenter?
Post by: emanuele on September 21, 2014, 08:42:55 am
Quote from: Ruth – You don't know how difficult such things are to me, emanuele.... ;)
LOL
Don't worry, I know the feeling. ;)

Quote from: Ruth – I made some changes there again. Does it look better now? O:-)
Guess so! :D (Of course is you like it first and foremost. ;D)