本文整理汇总了PHP中Zend_View_Abstract::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View_Abstract::__construct方法的具体用法?PHP Zend_View_Abstract::__construct怎么用?PHP Zend_View_Abstract::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View_Abstract
的用法示例。
在下文中一共展示了Zend_View_Abstract::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($data = array())
{
parent::__construct($data);
$dirs = Zend_Registry::get('dirs');
$template = Zend_Registry::get('theme');
$config = Zend_Registry::get('config');
$qool_module = Zend_Registry::get('Qool_Module');
// Class Constructor.
// These automatically get set with each new instance.
$loader = new Twig_Loader_Filesystem(APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP);
$twig = new Twig_Environment($loader, array('cache' => APPL_PATH . $dirs['structure']['cache'] . DIR_SEP . 'twig' . DIR_SEP));
$lexer = new Twig_Lexer($twig, array('tag_comment' => array('<#', '#>}'), 'tag_block' => array('<%', '%>'), 'tag_variable' => array('<<', '>>')));
$twig->setLexer($lexer);
include_once APPL_PATH . $dirs['structure']['lib'] . DIR_SEP . 'Qool' . DIR_SEP . 'Template' . DIR_SEP . 'template.php';
if (file_exists(APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP . 'functions.php')) {
include_once APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP . 'functions.php';
}
$funcs = get_defined_functions();
foreach ($funcs['user'] as $k => $v) {
$twig->addFunction($v, new Twig_Function_Function($v));
}
$this->_twig = $twig;
$this->assign('config', $config);
Zend_Registry::set('tplExt', 'html');
}
示例2: __construct
public function __construct($config = array())
{
parent::__construct($config);
if (isset($config['phptal'])) {
System_Options::setOptions($this->getEngine(), (array) $config['phptal']);
}
}
示例3: __construct
/**
* Constructor
*
* Pass it a an array with the following configuration options:
*
* scriptPath: the directory where your templates reside
* compileDir: the directory where you want your compiled templates (must be
* writable by the webserver)
* configDir: the directory where your configuration files reside
*
* both scriptPath and compileDir are mandatory options, as Smarty needs
* them. You can't set a cacheDir, if you want caching use Zend_Cache
* instead, adding caching to the view explicitly would alter behaviour
* from Zend_View.
*
* @see Zend_View::__construct
* @param array $config
* @throws Exception
*/
public function __construct($config = array())
{
$this->_smarty = new Smarty();
//smarty object
//compile dir must be set
if (!array_key_exists('compileDir', $config)) {
throw new Exception('compileDir must be set in $config for ' . get_class($this));
} else {
$this->_smarty->compile_dir = $config['compileDir'];
}
//configuration files directory
if (array_key_exists('configDir', $config)) {
$this->_smarty->config_dir = $config['configDir'];
}
if (array_key_exists('leftDelimiter', $config)) {
$this->_smarty->left_delimiter = $config['leftDelimiter'];
}
if (array_key_exists('rightDelimiter', $config)) {
$this->_smarty->right_delimiter = $config['rightDelimiter'];
}
if (array_key_exists('templateDir', $config)) {
$this->_smarty->template_dir = array($config['templateDir']);
}
if (array_key_exists('pluginDir', $config)) {
$this->_smarty->plugins_dir = $config['pluginDir'];
}
//call parent constructor
parent::__construct($config);
}
示例4: array
function __construct(Am_Di $di = null)
{
parent::__construct();
if (null === $di) {
$this->di = Am_Di::getInstance();
} else {
$this->di = $di;
}
if ($this->di->hasService('theme')) {
$this->theme = $this->di->theme;
} else {
$this->theme = new Am_Theme($this->di, 'default', array());
}
$this->setHelperPath('Am/View/Helper', 'Am_View_Helper_');
$this->setEncoding('UTF-8');
foreach ($this->di->viewPath as $dir) {
$this->addScriptPath($dir);
}
if (!$this->getScriptPaths()) {
$this->addScriptPath(dirname(__FILE__) . '/../../application/default/views');
}
$this->headScript()->prependScript("window.rootUrl = " . Am_Controller::getJson(REL_ROOT_URL) . ";\n");
$this->headScript()->prependScript("window.CKEDITOR_BASEPATH = " . Am_Controller::getJson(REL_ROOT_URL . '/application/default/views/public/js/ckeditor/') . ";\n");
$this->headScript()->prependScript("window.amLangCount = " . Am_Controller::getJson(count(Am_Di::getInstance()->config->get('lang.enabled'))) . ";\n");
}
示例5: __construct
public function __construct($data = array())
{
parent::__construct($data);
$dirs = Zend_Registry::get('dirs');
$template = Zend_Registry::get('theme');
$qool_module = Zend_Registry::get('Qool_Module');
//set Qool directories
$templates = APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP;
$templates_c = APPL_PATH . $dirs['structure']['cache'] . DIR_SEP . 'smarty' . DIR_SEP . 'templates_c' . DIR_SEP;
$configs = APPL_PATH . 'config' . DIR_SEP . 'smarty' . DIR_SEP;
$cache = APPL_PATH . $dirs['structure']['cache'] . DIR_SEP . 'smarty' . DIR_SEP . 'cache' . DIR_SEP;
// Class Constructor.
// These automatically get set with each new instance.
$this->_smarty = new Smarty();
$this->_smarty->setTemplateDir($templates);
$this->_smarty->setCompileDir($templates_c);
$this->_smarty->setConfigDir($configs);
$this->_smarty->setCacheDir($cache);
$this->_smarty->caching = Smarty::CACHING_LIFETIME_CURRENT;
$this->_smarty->caching = false;
//get the template file and register all functions in it to smarty
include_once APPL_PATH . $dirs['structure']['lib'] . DIR_SEP . 'Qool' . DIR_SEP . 'Template' . DIR_SEP . 'template.php';
if (file_exists(APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP . 'functions.php')) {
include_once APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP . 'functions.php';
}
// $this_smarty->register_function('date_now', 'print_current_date');
Zend_Registry::set('tplExt', 'tpl');
}
示例6: __construct
public function __construct($config = array())
{
if (APPLICATION_ENV == "testing") {
$this->_testing = true;
$this->_streamUrl = 'php://memory';
}
parent::__construct($config);
}
示例7: __construct
/**
* Constructor
*
* Register Zend_View_Stream stream wrapper if short tags are disabled.
*
* @param array $config
* @return void
*/
public function __construct($config = array())
{
if (array_key_exists('mail', $config)) {
$this->setMail($config['mail']);
}
parent::__construct($config);
$this->addHelperPath('App/Mail/View/Helper', 'App_Mail_View_Helper');
}
示例8: __construct
/**
* Constructor
* @access public
*/
public function __construct($options = array(), $engine = null)
{
parent::__construct($options);
if ($engine === null) {
$engine = new PHPTAL();
}
$this->_engine = $engine;
$this->_engine->set('this', $this);
}
示例9: __construct
/**
* Class Constructor
*
* @param array [OPTIONAL] $data
* @return ZendSmarty
*/
public function __construct($webConfig)
{
parent::__construct(array());
$configSmarty = $webConfig->smarty;
$templateDir = $configSmarty->templateDirectory;
$compileDir = $configSmarty->compileDirectory;
$configDir = $configSmarty->configDirectory;
$cacheDir = $configSmarty->cacheDirectory;
$this->smarty = new ProjectSmarty($templateDir, $compileDir, $configDir, $cacheDir, false);
}
示例10: __construct
/**
* Constructor
*
* Register Zend_View_Stream stream wrapper if short tags are disabled.
*
* @param array $config
* @return void
*/
public function __construct($config = array())
{
$this->_useViewStream = (bool) ini_get('short_open_tag') ? false : true;
if ($this->_useViewStream) {
if (!in_array('zend.view', stream_get_wrappers())) {
stream_wrapper_register('zend.view', 'Zend_View_Stream');
}
}
if (array_key_exists('useStreamWrapper', $config)) {
$this->setUseStreamWrapper($config['useStreamWrapper']);
}
parent::__construct($config);
}
示例11: __construct
public function __construct($options = array())
{
if (!isset($options["zf"])) {
$options["zf"] = array();
}
if (!isset($options["twig"])) {
$options["twig"] = array();
}
parent::__construct($options["zf"]);
$this->_twig = new Twig_Environment(null, array_merge($this->_twigOptions, $options["twig"]));
if (isset($options["twig"]["extensions"])) {
$exts = (array) $options["twig"]["extensions"];
$this->setExtensions($exts);
}
}
示例12: __construct
/**
* @param array $config View configuration.
*/
public function __construct($config = array())
{
parent::__construct($config);
// Setting the XHTML1_STRICT doctype fixes validation errors for ZF's form elements
$this->doctype()->setDoctype('HTML5');
$this->addHelperPath(VIEW_HELPERS_DIR, 'Omeka_View_Helper');
try {
$mvc = Zend_Registry::get('plugin_mvc');
foreach ($mvc->getHelpersDirs() as $pluginDirName => $dir) {
$this->addHelperPath($dir, "{$pluginDirName}_View_Helper");
}
} catch (Zend_Exception $e) {
// no plugins or MVC component, so we can't add helper paths
}
}
示例13: __construct
/**
* Constructor
*
* Register Zend_View_Stream stream wrapper if short tags are disabled.
*
* @param array $config
* @return void
*/
public function __construct($config = array())
{
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/config.ini', 'default');
$config = $config->resources->view->toArray();
$this->_useViewStream = (bool) ini_get('short_open_tag') ? false : true;
if ($this->_useViewStream) {
if (!in_array('zend.view', stream_get_wrappers())) {
require_once 'Zend/View/Stream.php';
stream_wrapper_register('zend.view', 'Zend_View_Stream');
}
}
if (array_key_exists('useStreamWrapper', $config)) {
$this->setUseStreamWrapper($config['useStreamWrapper']);
}
parent::__construct($config);
}
示例14: __construct
/**
* Constructor
*
* Pass it a an array with the following configuration options:
*
* scriptPath: the directory where your templates reside
* compileDir: the directory where you want your compiled templates
* (must be
* writable by the webserver)
* configDir: the directory where your configuration files reside
*
* both scriptPath and compileDir are mandatory options, as Smarty
* needs
* them. You can't set a cacheDir, if you want caching use
* Zend_Cache
* instead, adding caching to the view explicitly would alter
* behaviour
* from Zend_View.
*
* @see Zend_View::__construct
* @param array $config
* @throws Exception
*/
public function __construct($config = array())
{
$this->_smarty = new Smarty();
//smarty object
if (!array_key_exists('compileDir', $config)) {
throw new Exception('compileDir must be set in $config for ' . get_class($this));
} else {
$this->_smarty->compile_dir = $config['compileDir'];
}
//compile dir must be set
if (array_key_exists('configDir', $config)) {
$this->_smarty->config_dir = $config['configDir'];
}
//configuration files directory
parent::__construct($config);
//call parent constructor
}
示例15: __construct
/**
* Constructor.
*
* @param array $config Configuration key-value pairs.
*/
public function __construct(array $config = array())
{
// Disable streams
if (array_key_exists('streamFlag', $config)) {
$this->setStreamFlag($config['streamFlag']);
}
// Stream protocol
if (array_key_exists('streamProtocol', $config)) {
$this->setStreamProtocol($config['streamProtocol']);
}
// Stream wrapper
if (array_key_exists('streamWrapper', $config)) {
$this->setStreamWrapper($config['streamWrapper']);
}
// User-defined stream filters
if (array_key_exists('streamFilter', $config)) {
$this->addFilter($config['streamFilter']);
}
// Call parent
parent::__construct($config);
}