zend-framework

why doesn't the Zend_Locale honor abbreviated formats like zh_HK or zh_CN

笑着哭i 提交于 2019-12-25 01:14:58
问题 I have the following piece of code and am trying to do something simple with the Zend framework and Zend_Locale() $supported_langs = array( 'en' => 'English', 'zh_CN' => '中文(简体)', 'zh_HK' => '中國(傳統)', 'es' => 'Español', 'ja' => '日本', 'pt' => 'Português', 'de' => 'Deutsch', 'ar' => 'العربية', 'fr' => 'Française', 'ru' => 'Pусский', 'ko' => '한국의', 'hi' => 'हिन्दी', 'vi' => 'Việt' ); echo '<pre>'; foreach ($supported_langs as $lang => $desc) { print Zend_Locale::getTranslation($lang, 'language',

How to create controller using command prompt in zend framework

ⅰ亾dé卋堺 提交于 2019-12-25 00:52:44
问题 I am new to zend framework.I have placed my bin and library folder in : C:\xampp\htdocs\zend and have created project using command prompt. C:\xampp\htdocs\zend\bin> zf create project zendtest its creating project zendtest in folder -> C:\xampp\htdocs\zend\bin\ C:\xampp\htdocs\zend\bin>cd zendtest but when i tried to create module C:\xampp\htdocs\zend\bin\zendtest> zf create module testmodule its saying 'zf' is not recognised as internal or external command . On creating controller also

Zend Lucene: Fatal Error, Maximum Execution Time

不羁岁月 提交于 2019-12-25 00:23:09
问题 I've written a basic indexing script for my site and it seems to be working...somewhat. It gets through about 3/4 of the pages it needs to index and then give this error: Fatal error: Maximum execution time of 0 seconds exceeded in /Zend/Search/Lucene/Analysis/Analyzer.php on line 166 It seems to hang up in a different spot each time, too. I ran it a minute later and got this: Fatal error: Maximum execution time of 0 seconds exceeded in /Zend/Search/Lucene/Storage/Directory/Filesystem.php on

ZF3 Get browser Language

爷,独闯天下 提交于 2019-12-24 23:58:57
问题 There are a several of ways to get the browser language in Zend Framework 3. Can anyone tell me what should be the right way ? I was thinking about getting the locale and substract the language from it ? 回答1: $this->request->getHeader('Accept-Language')->getPrioritized()[0]->getPrimaryTag(); or $this->request->getHeader('Accept-Language')->getPrioritized()[0]->getLanguage(); 回答2: In ZF 2 , somewhere in Controller $translator = $this->getServiceLocator()->get('translator'); $t = $translator-

Custom error message for input validators (using the array syntax)

寵の児 提交于 2019-12-24 23:12:11
问题 ZF 1.11.2 I've tried most of the syntaxes. They didn't click. $validators = array('product_name' => array('alnum')); //... $input = new Zend_Filter_Input($filters, $validators, $_POST); How in the world do you set a custom error message for alnum with the syntax above? Using 'messages' => array('Not alnum!!') ? Yeah, well... How? I must've tried 100 nested arrays. 回答1: Use the built in translator. For example, configure the translator in your config file to use a simple array ; Translations

how to call multiple controller action from within any action in ZF?

最后都变了- 提交于 2019-12-24 23:08:44
问题 I have a controller action and I want it to be executed after any action. I have written an action helper with this method: public function postDispatch(){ $actionstack = Zend_Controller_Action_HelperBroker::getStaticHelper('actionStack'); $actionstack->direct('myaction', 'mycontroller'); } But it seems that it stuck in a loop, what is wrong with my code? 回答1: You could create a Plugin, for example: class Plugin_Sidebar extends Zend_Controller_Plugin_Abstract { public function postDispatch

how to call restful zend controller usin curl in php?

◇◆丶佛笑我妖孽 提交于 2019-12-24 22:07:50
问题 <?php require_once 'Zend/Session/Namespace.php'; class ApiController extends Zend_Rest_Controller { public function init() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); } public function indexAction() { $query=$this->getRequest()->getParam('query'); $this->getResponse() ->appendBody("hi"); $this->getResponse()->setHttpResponseCode(200); } public function getAction() { $query=$this->getRequest()->getParam('id'); $this->getResponse() ->appendBody(

Zendframework CSS Problem

半世苍凉 提交于 2019-12-24 21:45:19
问题 I am very to new to zend frame work , I am trying to set up a project (Done by other programmer) in my local server, i have setted up this project, but all pages are styless in my browser, ie the CSS files are not taken in phtml pages, For solving this issue which file I have ti Edit? Plss Help me 回答1: It depends upon the directory structure that your app has adapted. However checkout if you have views/scripts directory then, again depending upon the directory style used, the header.phtml

PHP Zend Route Config.ini - similar patterns

只谈情不闲聊 提交于 2019-12-24 21:27:01
问题 I'm using a configuration file to route my requests in my application. I have the following entries: routes.deal.route = "deal/:id/*" routes.deal.defaults.controller = "deal" routes.deal.defaults.action = "index" routes.deal.reqs.id = "\d+" routes.deal.route = "deal/buy/:id/*" routes.deal.defaults.controller = "deal" routes.deal.defaults.action = "buy" routes.deal.reqs.id = "\d+" here's what the behavior I'm looking for: mysite.com/deal/75 --- this will display the details of Deal 75

How to get the current time/timezone of the user visiting my website?

拈花ヽ惹草 提交于 2019-12-24 20:03:46
问题 I am working on an application which utilizes PHP (Zend Framework) and JavaScript (jQuery). I'm trying to get the current time of the user visiting the site. Is this possible? How can this be done? 回答1: adapted from: http://kennyshu.blogspot.com/2009/05/javascript-get-clients-timezone.html <script type="text/javascript"> var gmtOffset function timezone() { var localTime = new Date(); //this one will give you the GMT offset gmtOffset = localTime.getTimezoneOffset()/60 * (-1); } </script> then