â¡ï¸ This document was imported from mods.tiki.org to here to be integrated into the documentation and translation effort.
Details
This document describes a method of adding the login form into the tiki-top_bar template.
The Juicy Stuff
Ok, lets start by looking at the default content of the tiki-top_bar:Copy to clipboard {tr}This is{/tr} Tiki v1.8.3 (CVS) -Polaris- 2002-2004 {tr}by the{/tr}
<a href="http://tikiwiki.org" title="tikiwiki.org">{tr}Tiki community{/tr}</a>
{if $feature_calendar eq 'y' and $tiki_p_view_calendar eq 'y'}
<a href="tiki-calendar.php">{$smarty.now|tiki_short_datetime}</a>
{else}
{$smarty.now|tiki_short_datetime}
{/if}
{if $tiki_p_admin eq 'y' and $feature_debug_console eq 'y'}
//<a href="javascript:toggle('debugconsole');">{tr}debug{/tr}</a>
{/if}
Really this wants to be tidied up to your own taste, so heres a variation:Copy to clipboard {tr}This is{/tr} Tiki -Polaris-
A little better for what we want to do ð
Now we need to extra the good stuff from templates/modules/mod-login_box.tpl, here I only want the 2 fields and the button to send the form, so we need to accomodate this:Copy to clipboard <form action="{$login_url}" method="post">
<input type="hidden" name="challenge" value="{$challenge|escape}" />
<input type="hidden" name="response" value="" />
<input type="text" name="user" size="10" />
<input type="password" name="pass" size="10" />
<input type="submit" name="login" value="Sign In" />
<input type="hidden" name="rme" value="on"/></form>
btw the last hidden turns on the remember me box ð
Now if we combine the two into a table we get something like this for the tiki-top_bar.tpl:Copy to clipboard <table width="100%"><tr>
<td width="60%">{tr}This is{/tr} Tiki -Polaris- </td>
<td><form action="{$login_url}" method="post">
<input type="hidden" name="challenge" value="{$challenge|escape}" />
<input type="hidden" name="response" value="" />
User: <input type="text" name="user" size="10" />
Pass: <input type="password" name="pass" size="10" />
<input type="submit" name="login" value="Sign In" />
<input type="hidden" name="rme" value="on"/></form></td></tr></table>
Now thats looking cool! ð However when someones logged in they still see the login boxes and now welcome Mr X and a signout button. So heres the final version, with a smarty IF to check if the user is logged in or not: Copy to clipboard <table width="100%"><tr>
<td width="60%">{tr}This is{/tr} Tiki -Polaris- </td>
<td>{if $user}Welcome: {$user} <a class="linkmodule"
href="tiki-logout.php">{tr}Sign Out{/tr}</a>
{else}<form action="{$login_url}" method="post">
<input type="hidden" name="challenge" value="{$challenge|escape}" />
<input type="hidden" name="response" value="" />
User: <input type="text" name="user" size="10" />
Pass: <input type="password" name="pass" size="10" />
<input type="submit" name="login" value="Sign In" />
<input type="hidden" name="rme" value="on"/></form>
{/if}</td></tr></table>
Hope that helps everyone!
p.s. To change styles you can always add or modify the existing values in your CSS file:
Copy to clipboard input {color : #000000;
background: #EEEEEE;
font: normal 10px Verdana, Arial, Helvetica, sans-serif;
border: 1px solid #999999;
}
input[type=submit] {
-moz-border-radius: 0.8em;}
input[type=submit]:hover { color: #000000;
background-image: url(mods/tab-active.jpg);
}
Note that tab backgrounds and moz-border-radius DONT work on Internet Explorer, hey have you tried this site under Mozilla you people! ð
Damian
|