Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8918477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:45:38+00:00 2026-06-15T05:45:38+00:00

my problem is the following: i would like to use a login element instead

  • 0

my problem is the following:

i would like to use a login element instead of a login view.
so i can use the login in my default.ctp… i want the user to have the possibility to login from every page. It should be a sort of dropdown menu.

How can i tell my controller to use the element and get the element data and not the view anymore?

My LoginsController login function:

function login()
{
    $this->set('headline','Melden Sie sich an...');

    if($this->request->is('post'))
    {
        if($this->Auth->login())
        {
            //$this->redirect($this->Auth->redirect);
            $this->redirect(array('action' => 'index'));
            $this->Session->setFlash('Ihr Login war erfolgreich!');
        }
        else
        {
          //  $this->Session->setFlash('Ihre Email/Passwort ist falsch!' . ' ' . $this->request->data['Login']['email'] . ' ' . $this->request->data['Login']['password']);
            $this->Session->setFlash('Ihre Email/Passwort ist falsch!');
        }
    }
    $this->render('logins/login');
}

My View/Element:

<aside id="left">

<div class="whitebox einloggen">
    <div class="rahmen">
        <h2>Login</h2>
        <div class="inside">

  <?php              echo $this->Html->para(null,'Sind Sie bereits als Nutzer registriert?');



    echo $this->Form->create('Login', array('action' => 'login'));

    echo $this->Form->input('email', array ('label' => false, 'type'=>'text','class'=>'text', 'value'=>'E-Mail','id'=>'LoginEmail', 'onfocus'=>"resetinput(this);", 'onBlur'=>"fillinput(this);"));
    echo $this->Form->input('password', array ('label' => false, 'type'=>'text','class'=>'text', 'value'=>'Passwort','id'=>'LoginPassword', 'onfocus'=>"resetinputpw(this);", 'onBlur'=>"fillinput(this);"));
    echo $this->Form->end(array('label'=>'Einloggen','class' => 'button long','type' => 'submit','name'=>'submit'));

    echo $this->Html->para('forgetpw', $this->Html->link('Passwort vergessen?', array('controller' => 'login', 'action' => 'forgotpwd'), array('label' => false, 'class' => 'forgetpw', 'title'=>'Passwort vergessen')));

    echo $this->Html->link('', array('controller' => 'login', 'action' => 'fblogin'), array('class' => 'facebook-button', 'title'=>'Mit Facebook einloggen'));
    ?>

        </div>
    </div>
</div>

I call the element in the default.ctp like this:

<?php    echo $this->element('/logins/login'); ?>

Its always complaining about missing the login view…

If this isnt a good practise, please teach me otherwise 😉

Sorry for my bad english and thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:45:40+00:00Added an answer on June 15, 2026 at 5:45 am

    Have you tried disabling the view in the controller?

    If the element is included in default.ctp, adding

    $this->autoRender = false;
    

    in place of

    $this->render('logins/login');
    

    in your login controller will stop the Login Controller trying to specifically render the view.

    You will need to place your element in the Elements directory (under ‘Views’) and then update your code in default.ctp to be

    <?php echo $this->element('login'); ?>
    

    Also, using the cakephp way of setting up the links and forms may help you in the element.

    For full guidance for the form, try here: http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html

    For how to do links the cake way, try: http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use LINQ to solve the following problem, I have the
i have the following problem: i would like to create a footer. that footer
Ok, I have the following problem: I would like to scroll an overflowing ListBox
while designing my user control, i encountered the following problem: i would like to
I would like to find a better algorithm to solve the following problem: There
my problem is the following. I would like to encapsulate a NSString in a
I have to following problem: If i want to follow the Rails naming convention
I would like to know what my alternative would be for the following problem
I would really appreciate any help with the following problem: I need to be
I dont understand what would be the problem with the following code. It needs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.