zend-framework

How to set the message of the NotEmpty validator on a Zend_Form_Element?

I have a form element that I'm setting as required: $this->addElement('text', 'email', array( 'label' => 'Email address:', 'required' => true )); Since I'm setting required to true, it makes sure that it's not empty. The default error message looks like this: "Value is required and can't be empty" I tried setting the...

No full-text support; must have effective mysql db search engine; where to find one?

I have asked several questions about Zend and its search functions. Now after further reading I have noticed that it requires FULL-TEXT indexes in the MySQL fields. My webhosting provider doesn't allow me to change anything in the my.ini (my.cnf) file, which holds information about minimum length of word to search full-text indexes an...

How to use call_user_func_array with an object with a __construct method in PHP

How could I use call_func_array to create a new object with a __construct method (with some not optional arguments). Here's the code: $urls = array( 'view' => array( 'view/(\d+)', array('controller' => 'test', 'action' => 'view'), array(1 => 'id'), ), ); foreach ($urls as $name => $args) { $route = ca...

Problem with URL encoded parameters in URL view helper

So my problem is kinda weird, it only occurs when I test the application offline (on my PC with WampServer), the same code works 100% correctly online. Here is how I use the helper (just example): <a href="<?php echo $this->url(array('module' => 'admin', 'controller' => 'index', 'action' => ...

PHP loop, date sorting challenge...

I'm having trouble trying to figure out how to achieve this programming challenge in my Zend Framework application: I need to create an array that looks like this: $array = array( 0 => stdClass()->monthName ->monthResources = array() 1 => stdClass()->monthName ->monthResources = array() ); ...

How do I install Zend on my website and how do I test if it works ?

Background: I need to setup a search engine for my classifieds site, which is PHP and Mysql based. I have downloaded Zend Framework and have no clue what to do with it. My webhosting provider says they don't support changing the php.ini file, and all tutorials I have found so far is based on changing that file. I have found very little...

Zend Framework, access denied to my database, but only under certain wi-fi connections?

This is the second time that I've noticed this... I am running my Zend Framework application on my laptop, but connecting to my remote database. It works fine most of the time (from home, and other places). But this is the second time that I get an error message from my application: SQLSTATE[28000] [1045] Access denied for user 'databa...

Authentication methods for Zend Framework XML-RPC server

I have a Zend Framework application whose sole purpose is to serve as an XmlRpc / JSONRPC server. I've mostly followed the philosophy from this guide for my implementation method. I overrode my Bootstrap's run() method to run a Zend_XmlRpc_Server object and attach the API classes to it. I want to authenticate any XML-RPC method that ge...

How to change a Zend Layout in module/controller to layout stored in another module?

I am working in the error controller of my default module but I have other modules/controllers that have errors. Their errors are sent to the default/error controllers but the layouts that are used are the ones from the module that threw the error. I want to only use the default modules layout for all errors. ...

Little help with making this basic search function work (Zend Lucene)

I have two php files so far, test.php: <?php include("../config_conn_fordon_db.php"); include("../config_open_db.php"); // Fix Special Characters mysql_query("SET NAMES 'utf8'") or die(mysql_error()); mysql_query("SET CHARACTER SET 'utf8'") or die(mysql_error()); $root = realpath($_SERVER["DOCUMENT_...

Uploadify Minimum Image Width And Height

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...

Zend Cache Howto PHP

How can i do the followin tasks public function addToCache($id,$items) { // in zend cache } public function getFromCache($id) { // in zend cache } The first method should take an id and items which should be cached. The second method should just take an id of an cached object, and should return the content of the cache of that it...

Can I predict how large my Zend Framework index will be? (and some quick Q:s)

I have around 100thousand rows in a mysql table, where each row has about 8 fields. I have finally got the hold on how to use Zend Lucene to index and search data from a mysql table. Before I fully implement this funcionality to my website, I have some questions: 1- Is it possible to determine the size of a index in advance? This beca...

Zend Form: Checkbox element displays as hidden field?

I would like to add a simple check box to my form: $element = new Zend_Form_Element_Checkbox('dont'); $element->setDescription('Check this box if you don\'t want to do this action.'); $form->addElement($element); However, this is what the html looks like: <dt id="dont-label">&nbsp;</dt> <dd id="dont-element"> <input type="hidden"...

Sphinx requirements, would it work on my Webhostings provider ?

I am still searching for a search engine to be used on my webhosting-providers server (one.com) and still haven't found any. I have heard great things about Sphinx, what are the requirements to run it? I have read the manual, doesn't say much, seems like it should work... Just want to ask some professionals first. I dont have access t...

Zend_Form arbitrary number of key-value pair fields

I'm trying to create a form using Zend_Form (Zend_Framework component). The users should be able to add arbitrary number of fields. Just as you can upload files with gmail GUI. Example: [_____] [+] After clicking on the [+] button: [_____] [_____] [+] To get things complicated, I'd like to add field pairs, so it would look like thi...

Add DIR to application dir Zend Framework

Hi, I whant to use some classes that are not part of ZF. I have a dir classes in application dir and the classes dir contains classes that are required as object or static. In Bootstrap i "load" every class.php. Zend_Loader::loadFile('TimeZones.php', APPLICATION_PATH.'/classes/', false); How can I have all the classes by default loa...

Zend_Auth - Be Able To Login With Both Email And Username

So I am using Zend_Auth to authenticate users of my website. Currently they are only able to log in with their email as login but I would like to enable them to log in also with their username. Here is some code: // prepare adapter for Zend_Auth $adapter = new Zend_Auth_Adapter_DbTable($this->_getDb()); $adapter...

How to optimize mysql full match

Hey guys, do you know some trick about how can I optimize more a full match search? The code that I'm trying to optimize: $do = $this->select() ->where('MATCH(`name`,`ort`) AGAINST( ? IN BOOLEAN MODE)', $theString) ->order('premium DESC'); The search should search for some companies...and let's say that in the field name ...

Zend Framework SEO tips

I've done basic work suggested by Google and others to improve Google ranking. What are the 'specific' things I should do with Zend Framework (or in general any MVC architecture) to make it better? It seems all the usual methods aren't working that well with Zend Framework. ...