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 390023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:55:26+00:00 2026-05-12T15:55:26+00:00

How can I add a form to my layout.phtml? I would like to be

  • 0

How can I add a form to my layout.phtml?

I would like to be able to have a search form and a login form that persists through every form on my site.

  • 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-05-12T15:55:26+00:00Added an answer on May 12, 2026 at 3:55 pm

    I have a blog post explaining this: http://blog.zero7ict.com/2009/11/how-to-create-reusable-form-zend-framework-zend_form-validation-filters/

    In your Application folder create a Forms folder

    This is an example form:

    <?php
    class Form_CreateEmail extends Zend_Form
    {
    public function __construct($options = null)
    {
        parent::__construct($options);
    
        $this->setName('createemail');
        $title = new Zend_Form_Element_Text('title');
        $title->setLabel('Subject')
        ->setRequired(true)
        ->addFilter('StripTags')
        ->addFilter('StringTrim')
        ->addValidator('NotEmpty');
        $info = new Zend_Form_Element_Textarea('info');
        $info->setLabel('Email Content')
        ->setAttribs(array('rows' => 12, 'cols' => 79)); 
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton');
        $this->addElements(array($title, $info, $submit));
    }
    
    }
    ?>
    

    You can then call it from your controller like this:

    $form = new Form_CreateEmail();
            $form->submit->setLabel('Add');
            $this->view->form = $form;
    

    And display it from you view using

    echo $this->form;
    

    Hope this helps.

    Edit: if you want this to be included on everypage you could create a new helper file

    in your views folder create a helpers folder and create a loginHelper.php file

    class Zend_View_Helper_LoginHelper
    {
        function loginHelper()
        {
    
    $form = new Form_CreateEmail();
            $form->submit->setLabel('Add');
            return = $form;
    
        }
    }
    

    This could be output from your layout using:

    <?php echo $this->LoginHelper(); ?>     
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have a Form that can Add or Delete TextFields. I was
I have form, where some fields are looks like rows, so I can add/delete
I have a form which users can add controls to and when they right
I have a form in witch users can add their working hours view them
I have a form where users can add input fields with jQuery. <input type="text"
I have a simple form where a user can add, edit, and delete people
I make Panel(layout:Absolute). After, I add Items to Panel. But I can't see that
I have an Administrator that needs a dynamic form generator with layout capabilities on
How do you add search to a layout so it can search for posts
I have a static html form layout where i add extjs form fields using

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.