zend-framework

First day of each month

半腔热情 提交于 2019-12-06 10:24:37
问题 If I start with the current date, how can I get the first Friday of each month? I was thinking about using $date->get(Zend::WEEKDAY) and comparing that to Friday and then with DAY and checking if it is less than or equal to 7. Then adding 1 month onto it. There must be something simpler? 回答1: How about $firstFridayOfOcober = strtotime('first friday of october'); Or turn it into a handy function:- /** * Returns a timestamp for the first friday of the given month * @param string $month *

Zend_Db_Table: Delete multiple entries

醉酒当歌 提交于 2019-12-06 10:23:45
问题 I wanted to delete some db entries and each of them has a unique ID. My current code looks so, taken from here: Zend Framework: How to delete a table row where multiple things are true? $where = array(); foreach ($IDs as $ID) { $where[] = $this->getAdapter()->quoteInto('id = ?', $ID); } $this->delete($where); This is called inside the model class extends by Zend_Db_Table_Abstract. The query looks now like that: DELETE FROM `shouts` WHERE (id = '10') AND (id = '9') AND (id = '8') That doesn't

Error with JSON in javascript : unexpected non-whitespace character after JSON data

寵の児 提交于 2019-12-06 10:18:44
My question is about an error I have when I use jQuery.ajax in my javascript function. I searched and found similar question, but none of these questions helped me. So, what's really weird is that it was working before. I spent a few days working on translations problems with UTF-8 and when I tried it again after, it was working anymore. I can't see what happened so maybe you can help me find out. Here is the code from my controller action which is called for ajax. $project =$_GET['project']; //Call private function getQuota $quotaTab = $this->getQuota($project); $this->_helper->getHelper(

Modify Stack in the Zend HeadScript View Helper

核能气质少年 提交于 2019-12-06 10:16:47
I am trying to attack this problem from a completely different angle, because it doesn't look like I can achieve my goal that way. I want to loop over the item stack in the HeadScript View Helper , and make modifications to it. The documentation for this and some of the other view helpers makes this statement: HeadScript overrides each of append(), offsetSet(), prepend(), and set() to enforce usage of the special methods as listed above. Internally, it stores each item as a stdClass token, which it later serializes using the itemToString() method. This allows you to perform checks on the items

How to move the “views” of Zend_Layout

元气小坏坏 提交于 2019-12-06 10:14:58
问题 Normally it would be in such a structure: ../application/modules/somemodule/views/scripts/index/index.phtml How I move it to: ../application/templates/somemodule/template1/views/...... ../application/templates/somemodule/templateTWOOMG/....... ?? 回答1: You need to play with: $viewRenderer::setViewBasePathSpec(); For example in frontController plugin, (or easier, but not so flexible, in Bootstrap.php ): $templateName = 'myTemplate'; $bootstrap = $this->getBootstrap(); $bootstrap->bootstrap(

Zend Framework calling another Controller Action

倾然丶 夕夏残阳落幕 提交于 2019-12-06 10:04:29
Hi i have issue here of calling another controller action to send an mail, here is my code: user.php public function followAction() { $follow_id = $this->_getParam('id'); $response = "<a href='javascript: void(0)' class='i-wrap ig-wrap-user_social i-follow_small-user_social-wrap'><i class='i i-follow_small-user_social ig-user_social'></i>Stop Following</a>"; notifyEmail() ------> need to call Notity Controller with notifyEmail() Action along with params $this->_helper->json($response); ----> return json response } NotifyController.php <?php class NotifyController extends Zend_Controller_Action

zend locale with url routing

穿精又带淫゛_ 提交于 2019-12-06 09:56:52
Is there a simple way of using zend routes and locales in the URL to force the loading of a particular locale? e.g. - http://domain.com/en-US/controller1/action So the language-Region should prefix all URL calls and just set the locale in the bootstrap but let the rest of the MVC routing work as normal. ideally it could detect if no language-Region is in the URL and attempt to autodetect from the browser. e.g. - http://domain.com/ (if no locale is found - defaults to en-US/index) I've seen some articles on routes for things like custom user vanity urls. e.g. - http://domain.com/username

Do I need to hack ZendFramework1.10.8/Doctrine1.2.2 to get model generated?

我的未来我决定 提交于 2019-12-06 09:41:26
I've started reading on zend framework and it's use with Doctrine and have implemented a small project to grasp the understanding.I've come to a point where i needed my model generated as in having a generate script like the one suggested in Doctrine 1.2.2 pdf manual.After few unsuccessful attempts like Class 'sfYaml' not found in G:\php_document\zendworkspace\BookingManager\library\doctrine\Doctrine\Parser\Yml.php on line 80 i've googled and found out what people are doing about that. To me it sounds too much the fact of having a command line script to do that work.So my question is do i

Magento: Call template phtml file via Ajax

为君一笑 提交于 2019-12-06 09:38:39
问题 I'm attempting to call a phtml file from Ajax on the homepage of my Magento site. I basically created a copy of app/design/frontend/base/default/template/catalog/product/list.phtml and customized it to view a particular category. If I add a block pointing to this file in the CMS section, I can view it just fine. However, I want to call this file via Ajax. I followed the instructions to create a module here, and then I attempted to follow the logic of Ajax in Magento by following this post.

Android save user session

徘徊边缘 提交于 2019-12-06 09:37:11
问题 I'm new in android I'm trying to save login session and send it with every time I send request to server, My web service is PHP (Zend framework 2). This code to identify user: $auth = Zend_Auth::getInstance(); $IdentityObj = $auth->getIdentity(); It's possible save session and send it like I use web browser without make any change in my web service. 回答1: Yes, it is. You just have to store the session using SharedPreferences. The idea is, after you login, I guess you return some kind of