zend-framework

Writing Changes Back to a Zend Dom Query Object

被刻印的时光 ゝ 提交于 2019-12-10 15:05:15
问题 I want to loop through images in an HTML document and set the width/height if they don't exist. Here's a minimal piece of working code: $content = '<img src="example.gif" />'; $dom = new Zend_Dom_Query($content); $imgs = $dom->query('img'); foreach ($imgs as $img) { $width = (int) $img->getAttribute('width'); $height = (int) $img->getAttribute('height'); if ((0 == $width) && (0 == $height)) { $img->setAttribute('width', 100)); $img->setAttribute('height', 100); } } $content = $dom-

how to use zend paginate without loading all the results of a database

让人想犯罪 __ 提交于 2019-12-10 14:59:17
问题 So the way I see zend paginate work is that you do: $paginator = Zend_Paginator::factory($results); $paginator->setItemCountPerPage($itemCount); $paginator->setPageRange($pageRange); Where $results is the result of loading a bunch of items from a database in the form of "SELECT * FROM table WHERE etc" Then zend paginate will count the number of results and generate the page ranges automatically... But if you do this then you're going to have to fetch all results of a database which I see as a

Database connection with Firebird Adapter in Zend Framework

浪子不回头ぞ 提交于 2019-12-10 14:31:47
问题 I just started to learn about ZF and Firebird because of a project I am assigned to. I have been trying to make the connection between both for several days now, but I haven't succeed yet. I tried ZF with PDO_Mysql and it works just fine as it does Firebird connection with PHP (out of ZF), but when I try to make the connection with the Firebird adapter in ZF it keeps displaying all kinds of errors. So, just to check. To make the connection in ZF with Firebird it should be done with the the

Convert Zend\Db\ResultSet\HydratingResultSet to Array of Objects

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 14:20:47
问题 In my Mapper class I'm extending AbstractDbMapper from ZfcBase to fetch rows from the database. A simple example would be code like this: class MyMapper extends AbstractDbMapper { //... public function fetchAll() { $select = $this->getSelect(); return $this->select($select); // returns HydratingResultSet } } The problem is that $this->select() returns a Zend\Db\ResultSet\HydratingResultSet (containing the needed and hydrated objects). But I would like to return an array of these objects

What is the regular expression for International phone number validation in php or zend?

微笑、不失礼 提交于 2019-12-10 14:17:11
问题 I have a zend form where I have a phone number field and have to check for validator. I have decided to use regular expression for that. I searched google but the results I have is not working. Can anyone please provide me the regular expression. here is my code: $phone = new Zend_Form_Element_Text('phone'); $phone->setRequired(true); $phone->setLabel('Phone :') ->addFilter('StripTags') ->addValidator('NotEmpty', false, array('messages'=>'phone cannot be empty')) ->addFilter('StringTrim') -

Php __get and __set magic methods - why do we need those here?

不问归期 提交于 2019-12-10 13:03:30
问题 On Zend Quick Start Guide here http://framework.zend.com/manual/en/learning.quickstart.create-model.html we can see: class Application_Model_Guestbook { protected $_comment; protected $_created; protected $_email; protected $_id; public function __set($name, $value); public function __get($name); public function setComment($text); public function getComment(); ... I normally create my getters and setters without any magic method. I've seen this on the quick guide, and I don't understand why

Cannot rollback transaction in Zend Framework

僤鯓⒐⒋嵵緔 提交于 2019-12-10 12:49:08
问题 I use the following code for transaction in Zend Framework but the rollback function doesn't work (Data is inserted into the database by insertSome($data)). What's wrong? $db->beginTransaction(); try{ $model->insertSome($data); $model->insertAll($data2); //this line cannot be run and the whole transaction should be rolled back. $db->commit(); } catch (Exception $e) { $db->rollBack(); echo $e->getMessage(); } 回答1: We can't get this question out of the list of "unanswered" questions on

Zend based modules

老子叫甜甜 提交于 2019-12-10 12:16:47
问题 Anybody knows about the URL. Where I can get already build modules in zend framework as we get plugins in joomla so that I can use them directly. For an example banner management module, notification and otheres. Is there any place where I can get this?? Thanks in advance 回答1: Zend Framework is a development framework, NOT a Content Management Framework like Drupal or Joomla. All information regarding the Zend Framework can be found at http://framework.zend.com. Other useful resources are :

Zend Auth - Using two tables

北战南征 提交于 2019-12-10 12:05:01
问题 I'm currently developing a website in Zend Framework wich uses Zend_Auth. The current design of the database is the following: users - id / email users_props - id - user_id - prop_name - prop_value However, the current Zend_Auth_Adapter_DbTable uses only one table, as where I have to tables and need to join them. How on earth can I do this? As far as i'm concerned, there are three options: I somehow create a (mysql) view I change the design so the users table contains both username/password I

DisplayGroup decorator in Zend Framework

别说谁变了你拦得住时间么 提交于 2019-12-10 11:59:01
问题 I'm using DisplayGroup to render a couple of elements in a group. Now what I want to do, is render this group in a single table row. But it turns out, that Decorators on DisplayGroups do NOT work the same way they do on simple elements. An example: $content = $this->getDisplayGroup('group'); $content->setDecorators(array( 'FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'element')), )); This just puts <table></table> at the end of my DisplayGroup. I've also tried to alias