zend-framework

Route module on subdomain in Zend Framework

别来无恙 提交于 2019-12-06 23:42:40
I'm having trouble getting the Zend_Controller_Router_Route_Hostname to work properly. I'm using Zend Framework 1.9.4 In my config I have: resources.router.routes.www.type = "Zend_Controller_Router_Route_Hostname" resources.router.routes.www.route = ":module.domain" resources.router.routes.www.defaults.module = "frontend" resources.router.routes.www.chains.index.type = "Zend_Controller_Router_Route" resources.router.routes.www.chains.index.route = ":controller/:action/*" resources.router.routes.www.chains.index.defaults.controller = "index" resources.router.routes.www.chains.index.defaults

How to render some html in Zend form?

蓝咒 提交于 2019-12-06 22:09:44
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:) To wrap your Contact form around div which is inside <li class ="af_title"> you can do as follows: $yourForm = new YourForm(); $yourForm->addDecorator(array('div' => 'HtmlTag'), array('tag' => 'div')); $yourForm-

Zend DB Selecting constants - columns that do not exist in table

旧城冷巷雨未停 提交于 2019-12-06 19:31:31
问题 I'm trying to do this query using Zend DB select but I'm not able to do so This is the sql query select shopping_id,shopping_details,"friend" as type from shopping Notice here how I'm specifying "friend" as type and friend is not a column in the shopping table. Now how do I do this in Zend. I have tried this but it gives me an error saying "sh.friend Column does not exist" $select->from(array('sh'=>'shopping'),array('shopping_id','shopping_details','"friend" as type'); Any help will be

Zend Framework: What is the difference between no return value and returning the resource instance in a bootstrap init?

安稳与你 提交于 2019-12-06 17:04:03
问题 I'm new to this framework. I've been searching on how to define a custom route and I found this code: protected function _initRouter(){ $front = Zend_Controller_Front::getInstance(); $router = $front->getRouter(); $router->addRoute( 'listOnIndex', new Zend_Controller_Router_Route('/list', array('controller' => 'index', 'action' => 'list')) ); return $router; } I've tried removing the return value and it still works. Why is that? Is it really necessary to return the instance? Thank you very

How update a database table record in Zend?

送分小仙女□ 提交于 2019-12-06 16:52:37
问题 I am using select like this and it is fetching record successfully: $table = new Bugs(); $select = $table->select(); $select->where('bug_status = ?', 'NEW'); $rows = $table->fetchAll($select); But Now I want to update same record. For example in simple MySQL. UPDATE TableName Set id='2' WHERE id='1'; How to execute above query in Zend ? Thanks 回答1: $data = array( 'field1' => 'value1', 'field2' => 'value2' ); $where = $table->getAdapter()->quoteInto('id = ?', $id) $table = new Table(); $table-

SocialEngine Zend getting user profile picture

戏子无情 提交于 2019-12-06 16:13:09
问题 I am trying to get a users profile picture by using $this->itemPhoto($this->viewer(), 'thumb.icon'); or $this->htmlLink($this->viewer()->getHref(), $this->itemPhoto($this->viewer(), 'thumb.icon')) The this->viewer gets the person who is viewing the page and outputs their user_id and a link. I mimicked the output of that but it refuses to accept it. It errors out with 'Item must be a valid item." I have searched through the code and when users upload images it for some reason is hashed and put

Call Multiple Stored Procedures with the Zend Framework

…衆ロ難τιáo~ 提交于 2019-12-06 15:56:32
问题 I'm using Zend Framework 1.7.2, MySQL and the MySQLi PDO adapter. I would like to call multiple stored procedures during a given action. I've found that on Windows there is a problem calling multiple stored procedures. If you try it you get the following error message: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable

How to calculate time passed with PHP or Zend_Date?

梦想与她 提交于 2019-12-06 15:37:31
问题 I'm trying to create a view helper that will display the number of minutes, hours, or days that have passed since...right now. I'm not really sure how to do it. It looks like the date comparison is working, but I don't know how to get the number. Here's what I have so far: <?php class Zend_View_Helper_RecentDate { public function recentDate($datetime) { $date = new Zend_Date($datetime); switch ($date) { case($date->isEarlier(1, Zend_Date::HOUR)): $message = 'was minutes ago'; break; case(

ACL and appearance manipulation of links, forms and DOM elements

断了今生、忘了曾经 提交于 2019-12-06 15:30:30
I would like to find out which strategy is the best for links, forms and DOM elements appearance manipulation (show/hide) on top level of multi modular application (admin, default, etc) ?? It should be done through ACL and it's usage I know well, permission are stored in DB. If someone tries to access certain page (module/controller/action) that is not allowed for him, an info page is passed which says that he is not allowed. In that case all elements are visible. I have a few strategies for elements appearance manipulation on my mind: To set in controller $this->view->allow_delete_link = $acl

Zend Framework Custom Validation Class Error Message

那年仲夏 提交于 2019-12-06 15:05:48
问题 The validation fails as it should but does not return the error message. $form->addElement('text', 'phone_number', array( 'required' => true, 'validators' => array( array('NotEmpty', true, array('messages' => 'Enter a valid Phone Number')), array('regex', false, array('pattern' => '/\([0-9]{3}\)\s[0-9]{3}-[0-9]{4}/', 'messages' => 'Enter a valid Phone Number' )), 'CheckPhoneNumber'), ), )); Custom Class: class Custom_Validators_CheckPhoneNumber extends Zend_Validate_Abstract{ const IN_USE =