Apache httpd.conf include path
Code:
php_value include_path ".;C:/xampp/htdocs/xampp/mainevent/apps/lib;C:/xampp/php/PEAR;C:/xampp/htdocs/xampp/mainevent/apps;C:/xampp/htdocs/xampp/mainevent/apps/modules/admin/views/forms;"
Index.php file:
Code:
<?php
require_once 'Bootstrap.php';
Bootstrap::run();
?>
Bootstrap.php file:
Code:
<?php
require_once 'Zend/Loader.php';
require_once 'Zend/Session.php';
class Bootstrap{
public static function run() {
...
self::prepare();
...
}
public static function prepare() {
self::setupController();
self::setupView();
}
public static function setupView() {
$view = new Zend_View;
$prefix = 'Addon_View_Helper';
$config = Zend_Registry::get('config');
$dir = $config->paths->data . '/lib/Addon/View/Helper';// from config file: C:/xampp/htdocs/xampp/mainevent/apps
$view->addHelperPath($dir,$prefix);
$view->setEncoding('UTF-8');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
Folder Structure:
Custom View Helper:
Code:
<?php
class Addon_View_Helper_DateFormat {
public function dateFormat($date="") {
$pieces = explode("-",$date,3);
$newDate = $pieces[2] . "/" . $pieces[1] . "/" . $pieces[0];
return $newDate;
}
}
?>
Settings.ini file:
Code:
[development]
paths.base = C:/xampp/htdocs/xampp/mainevent
paths.data = C:/xampp/htdocs/xampp/mainevent/apps
paths.modules.admin = C:/xampp/htdocs/xampp/mainevent/apps/modules/admin
paths.templates = C:/xampp/htdocs/xampp/mainevent/templates