Witam,
dostałem aplikację, w której nie wiem dlaczego ale nie widzi nowej dodanej akcji/widoku.
Dostaję taki komunikat "Action Helper by name xxxxxAction not found"
Pewnie chodzi o ścieżki route, ale nie wiem gdzie są zdefiniowane.
Plik index.php
<?php
. PATH_SEPARATOR . ROOT_PATH . '/library'
. PATH_SEPARATOR . ROOT_PATH . '/application/default/models/'
);
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);
try {
$frontend = array('master_file' => ROOT_PATH
. '/config/route.ini', 'automatic_serialization' => true); $backend = array('cache_dir' => ROOT_PATH
. '/temporary/cache/config'); $cache = Zend_Cache::factory('File', 'File', $frontend, $backend);
if (!$config = $cache->load('route')) {
$config = new Zend_Config_Ini(ROOT_PATH . '/config/route.ini', 'routes');
$cache->save($config, 'route');
}
require_once 'Core/Controller/Plugin/Cache.php';
$router = new Core_Controller_Router_Rewrite();
$router->addConfig($config, 'route');
$fc = Zend_Controller_Front::getInstance();
$fc->throwExceptions(true);
$fc->setParam('noViewRenderer', true);
$fc->setRouter($router);
$fc->addModuleDirectory(ROOT_PATH . '/application');
$fc->registerPlugin(new Core_Controller_Plugin_Locale());
$fc->registerPlugin(new Core_Controller_Plugin_Runtime());
$fc->registerPlugin(new Core_Controller_Plugin_Acl());
$fc->registerPlugin(new Core_Controller_Plugin_Layout());
$fc->dispatch();
} catch (Exception $e) {
}
route.ini
Kod
; ================= trasy statyczne ============================================
route.error403.type = "Zend_Controller_Router_Route_Static"
route.error403.route = "nie_masz_dostepu"
route.error403.defaults.module = default
route.error403.defaults.controller = error
route.error403.defaults.action = display
route.error403.defaults.code = 403
Jeszcze są dwa takie pliczki:
rewrite.php
final class Core_Controller_Router_Rewrite extends Zend_Controller_Router_Rewrite
{
public function addDefaultRoutes()
{
if (!$this->hasRoute('default')) {
$dispatcher = $this->getFrontController()->getDispatcher();
$request = $this->getFrontController()->getRequest();
$compat = new Core_Controller_Router_Route_Module
(array(), $dispatcher, $request);
}
}
}
rote.php
final class Core_Controller_Router_Route_Module extends Zend_Controller_Router_Route_Module
{
protected $_languageKey = 'language';
public function match($path)
{
$this->_setRequestKeys();
$path = trim($path, self::URI_DELIMITER);
if ($path != '') {
$path = explode(self::URI_DELIMITER, $path);
if (ereg('^([a-z]{2})$', $path[0
])) { }
if ($this->_dispatcher && $this->_dispatcher->isValidModule($path[0])) {
$this->_moduleValid = true;
}
}
}
if ($numSegs = count($path)) { for ($i = 0; $i < $numSegs; $i = $i + 2) {
$params[$key] = $val;
}
}
}
$this->_values = $values + $params;
return $this->_values + $this->_defaults;
}
public function assemble
($data = array(), $reset = false, $encode = false) {
if (!$this->_keysSet) {
$this->_setRequestKeys();
}
$params = (!$reset) ?
$this->_values
: array();
foreach ($data as $key => $value) {
if ($value !== null) {
$params[$key] = $value;
} elseif (isset($params[$key])) { }
}
$params += $this->_defaults;
$url = '';
$lang = $params[$this->_languageKey];
unset($params[$this->_languageKey
]);
if ($params[$this->_moduleKey] != $this->_defaults[$this->_moduleKey]) {
$module = $params[$this->_moduleKey];
}
}
unset($params[$this->_moduleKey
]);
$controller = $params[$this->_controllerKey];
unset($params[$this->_controllerKey
]);
$action = $params[$this->_actionKey];
unset($params[$this->_actionKey
]);
foreach ($params as $key => $value) {
$url .= '/' . $key;
$url .= '/' . $value;
}
if (!empty($url) || $action !== $this->_defaults
[$this->_actionKey
]) { $url = '/' . $action . $url;
}
if (!empty($url) || $controller !== $this->_defaults
[$this->_controllerKey
]) { $url = '/' . $controller . $url;
}
$url = '/' . $module . $url;
}
$url = '/' . $lang . $url;
}
return ltrim($url, self::URI_DELIMITER); }