zend-framework

Database Designing for Vote Buttons

只谈情不闲聊 提交于 2019-12-23 04:44:00
问题 I am working on a Project in which i have Voting Options Up and Down similar to StackOverFlow. I am not much experienced in DB Designing and thus i got up with the following issue, First of all, here is my table structure for voting : voteId -----AUTO_INCREMENT with PRIMARY KEY. mediaId ----The Media for which user gives an up/down vote. userId -----The User who Voted. voteMode ---1 for Up Vote and 0 for Down Vote. This is an Integer Field. In this case if i have 100 users and 100 medias,

how to get the uploaded image path in php and ajax?

给你一囗甜甜゛ 提交于 2019-12-23 04:43:41
问题 i have a simple form: <input type="hidden" name="MAX_FILE_SIZE" value="2097152" id="MAX_FILE_SIZE"> <input type="file" name="file_upload" id="file_upload" class="picture_main"> <input type="submit" name="upload_picture" id="upload_picture" value="Submit"> i am trying to to an ajax upload: submit.on("click", function(){ var file = $('#file_upload').val(); uploadImageAjax(file); return false; }); var uploadmageAjax = function(file) { $.ajax({ type: "POST", url: "/test/index/imageupload", data:

Zend pagination with limited number of links and dots between

本秂侑毒 提交于 2019-12-23 04:33:46
问题 I have implemented a Zend Pagination but can't figure out how to limit the number of links in the pagination. I know about setPageRange, but it isn't exactly what i want. Currently the pagination looks like this. < | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | > But what i want is something like this: for page 1 < | 1 | 2 | 3 | ... | 14 | 15 | 16 | > for page 8 < | 1 | 2 | 3 | ... | 7 | 8 | 9 | ... | 14 | 15 | 16 | > for page 14 < | 1 | 2 | 3 | ... | 13 | 14 | 15 |

Adding a dollar sign to a text field in Zend Framework

孤街浪徒 提交于 2019-12-23 04:17:12
问题 Is there a way to add a "$" right before the <input> for a Zend_Form element? (using standard ZF stuff would be great, of course). EDIT : For example, if the html generated by Zend_Form for a cost element is something like: (very simplified) <label>Cost:</label> <input type="text" name="cost" /> I'd like it to output this: <label>Cost:</label> $ <input type="text" name="cost" /> 回答1: You can use callback decorator to put whatever html you want in your elements: For example in your case I

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

廉价感情. 提交于 2019-12-23 04:02:23
问题 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

PHP: How to determine email attachment's MIME type?

为君一笑 提交于 2019-12-23 03:47:06
问题 I'm using Zend's Zend_Mail_Storage_Pop3 to connect to mail server, open an email, and iterate through its attachments. If the attachment is a PDF, I need to download it. At each iteration of each message part, I call the getHeaders and use Regex to determine the mime type of the attachment. In most cases, I get something like this: ["content-type"]=> string(64) "application/octet-stream; name=abc.pdf" ["content-transfer-encoding"]=> string(6) "base64" But in some cases, I get something like

Zend Regex Route > Track the api version

假装没事ソ 提交于 2019-12-23 03:39:15
问题 i am building a web service with zend and i am using modules to separate my api versions. Ex: "applications/modules/v1/controllers", "applications/modules/v2/controllers" have different set of actions and functionality. I have made "v1" as the default module in "application.ini" file: resources.modules = "" resources.frontController.defaultModule = "v1" resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.frontController.moduleControllerDirectoryName =

How to modify zend Db_RecordExists validator where clause?

断了今生、忘了曾经 提交于 2019-12-23 03:31:06
问题 I want to add check for more than one values in where clause. Db_RecordExists just check for one filed. I have read that you can extend zend validate abstract class and you can have your own validator. can I have one little example about this please. Thank you... 回答1: What are you trying to do exactly? To me, you don't even need a custom validator. If you read carefully the source code of Zend_Validate_Db_Abstract you will notice this phpDoc above the constructor: Provides basic configuration

How to modify zend Db_RecordExists validator where clause?

こ雲淡風輕ζ 提交于 2019-12-23 03:31:06
问题 I want to add check for more than one values in where clause. Db_RecordExists just check for one filed. I have read that you can extend zend validate abstract class and you can have your own validator. can I have one little example about this please. Thank you... 回答1: What are you trying to do exactly? To me, you don't even need a custom validator. If you read carefully the source code of Zend_Validate_Db_Abstract you will notice this phpDoc above the constructor: Provides basic configuration

Examples on Zend_Rest_Controller Unit Testing

我们两清 提交于 2019-12-23 03:22:23
问题 I have found a bunch of examples how to unit test Zend_Controller, but I'm looking for examples on Zend_Rest_Controller Unit Testing. Any help is really appreciated. Thank you! 回答1: So, basically your question is how to emulate calling PUT and DELETE in your controller tests? Since this apparently doesn't work: $this->request->setMethod('PUT'); You can access both these actions with plain HTTP POST by providing _method parameter. So to call PUT : $this->request->setMethod('POST'); $this-