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

  • SEARCH
  • Home
  • 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 7194571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:23:56+00:00 2026-05-28T20:23:56+00:00

I am new to ZF.i have made a function that basically make a Form

  • 0

I am new to ZF.i have made a function that basically make a Form this is code

 require_once 'Zend/Form.php';
  function getLoginForm(){
$username = new Zend_Form_Element_Text('username');
$username->setLabel('Username:')
        ->setRequired(true);

$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password:')
        ->setRequired(true);

$submit = new Zend_Form_Element_Submit('login');
$submit->setLabel('Login');

$loginForm = new Zend_Form();
$loginForm->setAction('/login/index/')
        ->setMethod('post')
        ->addElement($username)
        ->addElement($password)
        ->addElement($submit);
 return $loginForm;
}

this is the error

Fatal error: Class 'Zend_Form_Element_Text' not found in C:\xampp\htdocs\phoggi\application\controllers\LoginController.php on line 68

line 68 refers to this line

 $username = new Zend_Form_Element_Text('username');

Further how can i add css classes to each and every element in my form and also how to add my own error messages.plz take one element and add custom error messages and css class.Thanking you all.
EDITED this is my index.php

<?php
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', true);
$rootDir = dirname(dirname(__FILE__));
set_include_path($rootDir . '/library' . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Controller/Front.php';
require_once 'Zend/Registry.php';
require_once 'Zend/Paginator.php';
include_once 'Zend/Db/Adapter/Pdo/Mysql.php';
require_once 'Zend/View.php';
require_once 'Zend/Controller/Action/Helper/ViewRenderer.php';
$params = array('host'         => 'localhost',
        'username'  => 'root',
        'password'    => '',
        'dbname'        => 'xyz'
       );

     $DB      = new Zend_Db_Adapter_Pdo_Mysql($params);
       $DB->setFetchMode(Zend_Db::FETCH_OBJ);
     Zend_Registry::set('DB',$DB);

 $view = new Zend_View();
 $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
 $viewRenderer->setView($view);
 Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
 Zend_Controller_Front::run('../application/controllers');
 ?>
  • 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-28T20:23:57+00:00Added an answer on May 28, 2026 at 8:23 pm

    here is what a standard index.php file looks like as created by Zend_Tool version 1.11:

    // Define path to application directory
    defined('APPLICATION_PATH')
        || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
    
    // Define application environment
    defined('APPLICATION_ENV')
        || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
    
    // Ensure library/ is on include_path
    set_include_path(implode(PATH_SEPARATOR, array(
        realpath(APPLICATION_PATH . '/../library'),
        get_include_path(),
    )));
    
    /** Zend_Application */
    require_once 'Zend/Application.php';
    
    // Create application, bootstrap, and run
    $application = new Zend_Application(
        APPLICATION_ENV,
        APPLICATION_PATH . '/configs/application.ini'
    );
    $application->bootstrap()
                ->run();
    

    this along with the application.ini are all that are required to make Zend Framework work.

    //application.ini
    
    [production]
    phpSettings.display_startup_errors = 0
    phpSettings.display_errors = 0
    includePaths.library = APPLICATION_PATH "/../library"
    bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
    bootstrap.class = "Bootstrap"
    appnamespace = "Application"
    resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
    resources.frontController.params.displayExceptions = 0
    
    ;database setup
    resources.db.adapter = PDO_MYSQL
    resources.db.params.host = localhost
    resources.db.params.username = username
    resources.db.params.password = password
    resources.db.params.dbname = databasename
    
    resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
    [staging : production]
    
    [testing : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    
    [development : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    resources.frontController.params.displayExceptions = 1
    

    it looks like alot of the stuff in your index.php should be either in your application.ini or in your bootstrap.php. I think that’s why your autoloader doesn’t work.

    //bootstrap.php
    
    <?php
    
    class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
    {
    
    }
    

    help yourself and run through a couple of tutorials that will help you to setup a ZF app in a very few minutes.
    Zend Framework Quickstart
    Rob Allen’s Zf 1.11 tutorial
    Together you can get through these in an hour or two but they will provide a solid basis for ZF setup and basic functions.

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

Sidebar

Related Questions

I have made a new windows service which works fine using barebone code (just
I have a function called testimonials() that basically cycles through a set of divs,
So I have made this simple interface: package{ public interface GraphADT{ function addNode(newNode:Node):Boolean; }
Basically, i made a chessboard. i have 2 classes. the partial class, that triggers
I have made a function simular to the print_r function in php. Is there
I am a very new programmer, I have made a couple basic applications, however
I've just create a new MVC project, and have made no changes at all,
I made a similar question a few days ago, but now I have new
I am new to iPhone development. I have been looking at samples and made
When we have new in C#, that personally I see only as a workaround

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.