zend-framework

How to configure MySQL under Zend Framework?

社会主义新天地 提交于 2019-12-08 07:48:46
问题 I configured my Zend Framework virtualhost environment, but now my files cannot access the MySQL database. Getting an error: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost'. Where should I configure my MySQL so that it matches my virtualhost? 回答1: You need to make sure you are using Zend_Db and you have configured MySQL as you adapter in Zend DB Adapter Also, in your application.ini file under configs folder, you must write: [development : production] phpSettings.display

Mysql CASE statement usage with Zend

不羁的心 提交于 2019-12-08 07:37:13
问题 I have the following query that selects some records from the database: $select_person = $this->select() ->setIntegrityCheck(false) ->from(array('a' => 'tableA'), array(new Zend_Db_Expr('SQL_CALC_FOUND_ROWS a.id'), 'a.cid', 'a.email', 'final' => new Zend_Db_Expr( "concat( '<div style=\"color:#1569C7; font-weight:bold\">', a.head , ' ' , a.tail, '</div>')" ), 'a.red_flag' ) ) ->joinLeft(array('b' => 'tableb'), ... blah blah) ->where('blah blah') ->order('a.head ASC') I want to modify the above

How do I forward errors generated in the Bootstrap to the ErrorController?

久未见 提交于 2019-12-08 07:33:29
问题 I am using the default ErrorController that Zend Tool generated for me. The very first thing my index.php file does is to register an error handler that converts errors and warnings into exceptions: function handleError($errno, $errstr, $errfile, $errline, array $errcontext) { // error was suppressed with the @-operator if (0 === error_reporting()) { return false; } throw new ErrorException($errstr, 0, $errno, $errfile, $errline); } set_error_handler('handleError'); I also have this set up in

Zend framework: using BreadCrumbs with partial

纵饮孤独 提交于 2019-12-08 07:18:55
问题 I have some trouble making a customized breadcrumb: I my layout.phtml I have: $container = new Zend_Navigation(); $this->navigation($container); $container->addPage( array( 'label' => 'Dashboard', 'module' => 'default', 'controller' => 'dashboard', 'action' => 'index', 'pages' => array( array( 'label' => 'Create Order', 'module' => 'default', 'controller' => 'createorder', 'action' => 'index' ), array( 'label' => 'Query', 'module' => 'default', 'controller' => 'query', 'action' => 'index',

Calendar in Zend Framework

淺唱寂寞╮ 提交于 2019-12-08 07:07:26
问题 I looking to create a custom calender with Zend Framework, I am hoping that it will be able to list all the days of the month for the coming years and then have a different bg color on the date if there is an event on this. I am however struggling to create this firstly because it needs to go into the layout view, rather than an action, so where does the logic go? I am also unclear as to how the logic with mkdate() would work. Can someone point me in the right direct please? Thanks 回答1: Here

Best practice to place meta tags, links and styles in zend framework?

时光总嘲笑我的痴心妄想 提交于 2019-12-08 06:41:28
I have project-range meta tags that are need to be set. I've put them in protected method _initMeta in Bootstrap class. Are there any better options? What if I would like different set of this data for another languages? protected function _initMeta(){ $this->bootstrap('view'); $view = $this->getResource('view'); $view->doctype('XHTML1_STRICT'); $view->headTitle()->headTitle('Foo title'); $view->headMeta()->appendName('keywords','foo'); $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ->appendHttpEquiv('Content-Language', 'any'); $view->headLink()-

Uploadify Minimum Image Width And Height

戏子无情 提交于 2019-12-08 06:32:06
问题 So I am using the Uplodify plugin to allow users to upload multiple images at once. The problem is I need to set a minimum width and height for images. Let's say 150x150px is the smallest image users can upload. How can I set this limitation in the Uploadify plugin? When user tries to upload smaller picture, I would like to display some error message as well. Here is the PHP file that is called bu the plugin to upload images: <?php define('BASE_PATH', substr(dirname(dirname(__FILE__)), 0, -22

How to render some html in Zend form?

人走茶凉 提交于 2019-12-08 06:19:05
问题 In my form i need this: <li class ="af_title"><div>Contact form</div></li> I understand that if I need for example a text field - then I'd just create Zend_Form_Element_Text and wrap HtmlTag decorator around it - right? questions: 1) how would I generate div form element so I can wrap decorator around it? 2) mmm. - how would I set content of said element to be "Contact form"? Thanks:) 回答1: To wrap your Contact form around div which is inside <li class ="af_title"> you can do as follows:

How to validate either Zend_Form_Element_File or Zend_Form_Element_Text are not empty.

≯℡__Kan透↙ 提交于 2019-12-08 06:17:20
问题 In my form, I want user to pick a file OR enter it's URL. One of two options. I know how to write a validator for either one of two Zend_Form_Element_Text elements, but since data from Zend_Form_Element_File is not in $_POST but in $_FILES I don't know where to begin - I can't get the data from Zend_Form_Element_File to be in a $context in isValid($value, $context = null) method for my custom validator. Any ideas? 回答1: A possible approach I can think of is to pass the information if the file

Migrate this Zend Gdata code from ZF to ZF2

谁都会走 提交于 2019-12-08 06:09:25
问题 Sorry for such a bad question but I spend 2 hours without any success. Zend Docs are horrible ... I have found this Zend_Gdata library and Picasa data API -- loader.php file missing, but its crashing at line 2 Class 'Application\Controller\Zend\Loader\StandardAutoloader' not found, which obviously isn't the correct path. I am not sure why ZF does not use ...\vendor\ZF2\library\Zend\Loader\ Im using https://github.com/zendframework/ZendSkeletonApplication which is working, but nothing else