zend-framework

Zend Framework: How to intentionally throw a 404 error?

泄露秘密 提交于 2019-12-20 09:34:29
问题 I would like to intentionally cause a 404 error within one of the controllers in my Zend Framework application. How can I do this? 回答1: A redirect to a 404 would be: throw new Zend_Controller_Action_Exception('Your message here', 404); Or without Exception: $this->_response->clearBody(); $this->_response->clearHeaders(); $this->_response->setHttpResponseCode(404); 回答2: You can always set the response code manually, without throwing any exceptions. $this->_response->clearBody(); $this->

How are major sites detecting timezone? [duplicate]

限于喜欢 提交于 2019-12-20 09:18:16
问题 This question already has answers here : Determine a user's timezone (24 answers) Closed 6 years ago . Facebook, myspace, MSN, craigslist; all detect timezone and show times and dates correctly without ever submitting a form or reloading a page. How do they do it? I have a pretty large site and have people publishing articles which need to display correct times (uploaded 3pm or 6pm depending on timezone). Preloaders? Javascript? Loading the page and reloading it? My site currently has the

How to create WHERE IN clause with Zend_Db_Select

久未见 提交于 2019-12-20 09:09:16
问题 So I am trying to accomplish something like this: SELECT * FROM table WHERE status_id IN (1,3,4); using Zend_Db_Select... can't find how to do it :( Is it at all possible? 回答1: you can also use it like this: $data = array(1,3,4); $select->where('status_id IN(?)', $data); you dont need to implode array, and it's safer 回答2: The first answer probably works in ZF1 but it doesn't work in Zend Framework 2: $data = array(1,3,4); $select->where('status_id IN(?)', $data); In case the Zend Framework2 I

Zend Framework form with jquery

。_饼干妹妹 提交于 2019-12-20 08:51:07
问题 Any one a idea how to simply create a form with Zend_Form and jquery? I want to use Zend_Form to validate the form so I don't have to dual script the form in JavaScript and PHP. Thank you, Ivo Trompert 回答1: No problem there. Add ZendX_JQuery to your library if you use autoload. Then extend ZendX_JQuery_Form to your needs. Do your stuff in the init() method of your class. For example, I was able to create an AutoComplete field which has regular Zend_Form validation plus JQuery behavior like

Domain-driven design with Zend

白昼怎懂夜的黑 提交于 2019-12-20 08:49:48
问题 This question is a continuation of my previous question here zend models architecture (big thanks to Bill Karwin). I've made some reading including this article http://weierophinney.net/matthew/archives/202-Model-Infrastructure.html and this question How To Properly Create Domain using Zend Framework? Now I understand, what domain driven design is. But examples are still very simple and poor. They are based on one table and one model. Now, my question is: do they use Domain Model Design in

How can I access the configuration of a Zend Framework application from a controller?

本秂侑毒 提交于 2019-12-20 08:43:50
问题 I have a Zend Framework application based on the quick-start setup. I've gotten the demos working and am now at the point of instantiating a new model class to do some real work. In my controller I want to pass a configuration parameter (specified in the application.ini) to my model constructor, something like this: class My_UserController extends Zend_Controller_Action { public function indexAction() { $options = $this->getFrontController()->getParam('bootstrap')->getApplication()-

How can I access the configuration of a Zend Framework application from a controller?

百般思念 提交于 2019-12-20 08:43:35
问题 I have a Zend Framework application based on the quick-start setup. I've gotten the demos working and am now at the point of instantiating a new model class to do some real work. In my controller I want to pass a configuration parameter (specified in the application.ini) to my model constructor, something like this: class My_UserController extends Zend_Controller_Action { public function indexAction() { $options = $this->getFrontController()->getParam('bootstrap')->getApplication()-

Move to https://www, when it is www or http:// or without www and http://?

落爺英雄遲暮 提交于 2019-12-20 07:48:55
问题 I am using Zend framework where i have nice looking url controllers. Following .htaccess is working but its making SEO to see us as four links for one page. RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R] I need to do following fix using htaccess: www.stackoverflow.com

Need to change smarty file into zend file

99封情书 提交于 2019-12-20 07:46:54
问题 HI here i have smarty file and i need to convert into zend.. How can i change smarty to zend? its tpl file <div id="add-user-form" class="form"> <form action="/account/login" method="post"> {{input_text type="hidden" name="redirect_url" value=$smarty.server.REDIRECT_URL|default:"/"}} <div class="contain"> <div class="fieldgrp"> <label> </label> <div class="field"><p><h3>Enter User Credentials</h3></p></div> </div> <div class="fieldgrp"> <label for="login_name">Username </label> <div class=

Zend Framework Admin Module structure

一世执手 提交于 2019-12-20 07:23:54
问题 I am creating a large web application with Zend Framework 1.10. A am new in Zend Framework(1 month experiance). Can you explain me how to create a admin module in the best way?(with own authentication). How to make this with good security? Thanks a lot. 回答1: I would create AdminController in each module, then route rewriting the paths like this: /admin/module1 => module1/AdminController /admin/module2 => module2/AdminController Then leverage Zend_Auth and Zend_Acl. You will also need