Login Box

Questions and answers about change of functions, design, hosting etc.

Moderators: Koduc, Xpycm

Forum rules
Pay attention! Forum is not a means for guaranteed support of clients and users. An answer as well as a quick answer is not supposed on the forum. We post messages as soon as possible.

The message limit on the forum is 3 messages per day.
If you want to say "thank you" then use the function "Give good reputation point", which is a green icon "plus" under the nickname of the person, who answered the message.

Login Box

Postby amdawi0 » 09 Dec 2013, 11:26

Hello,
I want to display login form in footer for every page if user is not logged.



Thanks,
amdawi0
Stranger
 
Posts: 1
Joined: 09 Dec 2013, 11:22
Reputation point: 0

Re: Login Box

Postby Foton » 09 Dec 2013, 13:55

In file protected\views\layouts\main.php after
Code: Select all
<div class="footer"> 

insert code
Code: Select all

<?php if (Yii::app()->user->isGuest): ?>
<div class="form">
    <?php $form=$this->beginWidget('CActiveForm', array(
        'id'=>'login-form',
        'enableClientValidation'=>false,
        'action'=>Yii::app()->controller->createAbsoluteUrl('/site/login')
        /*'clientOptions'=>array(
            'validateOnSubmit'=>true,
        ),*/
    ));
    $loginForm = new LoginForm;
    ?>

    <p class="note"><?php echo Yii::t('common', 'Fields with <span class="required">*</span> are required.'); ?></p>

    <div class="row">
        <?php echo $form->labelEx($loginForm,'username'); ?>
        <?php echo $form->textField($loginForm,'username'); ?>
        <?php echo $form->error($loginForm,'username'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($loginForm,'password'); ?>
        <?php echo $form->passwordField($loginForm,'password'); ?>
        <?php echo $form->error($loginForm,'password'); ?>
    </div>

    <div class="row rememberMe">
        <?php echo $form->checkBox($loginForm,'rememberMe'); ?>
        <?php echo $form->label($loginForm,'rememberMe'); ?>
        <?php echo $form->error($loginForm,'rememberMe'); ?>
    </div>


    <div class="row buttons">
        <?php echo CHtml::submitButton(Yii::t('common', 'Login')); ?>
    </div>

    <?php $this->endWidget(); ?>
</div>
<?php endif; ?>
Foton
Web Developer
Web Developer
 
Posts: 117
Joined: 26 Jan 2012, 14:58
Reputation point: 1


Return to Questions and help for changes

Who is online

Users browsing this forum: No registered users and 50 guests

cron