|
|||
|
Hi, I'm trying to use the Zend_Form component in a script which does not use the full mcv structure.
When I try to render the form, it says it needs Zend_View. I have heard that Zend_View can be used standalone, is this true? I have searched for instructions but have had no luck. If anyone knows how to do this please let me know. Thank You |
|
|||
|
Solved it myself! After messing around with the code I came up with this - which works.
Code:
<?php
// Setup Include Paths
define('ROOT_DIR', dirname(__FILE__));
set_include_path(
ROOT_DIR . '/library' . PATH_SEPARATOR
. ini_get('include_path') . PATH_SEPARATOR
);
// Load Classes On Demand
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoLoad();
// Setup View
$view = new Zend_View();
$view->setScriptPath('views');
// Setup Config
$config = new Zend_Config_Ini(ROOT_DIR . '/config/config.ini');
// Setup Form
$form = new Zend_Form($config->form1);
// Output Form
$view->form = $form->render($view);
echo $view->render('view.php');
You're welcome ![]() Last edited by c0mrade : 04-13-2008 at 08:55 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|