Re: [fw-general] Memcache Approach
On 12/11/2010 03:41 AM, Daniel Latter wrote: Hi All, Just wondered if anyone had any thoughts on the following: We have a ZF app where we use memcache to cache our model classes. The issue I have is that we cant store the db conn on the object so we have to make a static call to grab a db conn in everyone of our model class methods, which seems repetitive. Just wondered if anyone had a better approach? Abstract the grabbing database connection logic. -- With warm regards, Sudheer. S Personal home page - http://sudheer.net | Tech Chorus - http://techchorus.net Web and IT services - http://binaryvibes.co.in
Re: [fw-general] best practice: getting a Zend_Mail instance on demand
but I think there's the disadvantage that your Zend_Mail resource would get instantiated at bootstrap time whether you need it or not -- true? -- and not every controller/action in my app needs to send email. Right. Finally, I suppose you could set the email configuration data in its own separate config file. Any thoughts? I have my email settings in the database. I have extended Zend_Mail and added a method setup(). Class My_Mail extends Zend_Mail { public function setup() { // get the info to setup the clss // set it up } } Client code: $mail = new My_Mail(); $mail->setup(); -- With warm regards, Sudheer. S Personal home page - http://sudheer.net | Tech Chorus - http://techchorus.net Web and IT services - http://binaryvibes.co.in
Re: [fw-general] Validating numeric input
On 05/31/2010 04:58 PM, Aleksey Zapparov wrote: Hello, To test if string is integer or float, you should use Zend_Validate_Int (1). Alternatively you can use Zend_Validate_Callback (2) with is_numeric (3) function, so it will be something like this: $validator = new Zend_Validate_Callback('is_numeric'); [1] http://framework.zend.com/apidoc/1.10/Zend_Validate/Zend_Validate_Int.html [2] http://framework.zend.com/apidoc/1.10/Zend_Validate/Zend_Validate_Callback.html [3] http://php.net/manual/en/function.is-numeric.php Thanks for the quick response, Aleksey. I tried configuring Zend_Validate_Callback with PHP function is_numeric(). Zend_Validate_Callback passes two arguments to is_numeric while the PHP function is_numeric() requires exactly one argument. Is there a way to configure Zend_Validate_Callback so that it sends only one argument, ie, $value to the callback function? -- With warm regards, Sudheer. S Tech stuff: http://techchorus.net Business: http://binaryvibes.co.in
[fw-general] Validating numeric input
Hello, I want to make sure the user has input numeric value in a text form field. The value can be an integer or float, but it has to be numeric. I tried using Zend_Validate_Float and Zend_Validate_Digits, but they don't seem to suit my needs. For example, Zend_Validate_Float returns false for the input string '4'. Zend_Validate_Digits returns false for input 10.5. Do we need Zend_Validate_Numeric? Or am I missing something here? -- With warm regards, Sudheer. S Tech stuff: http://techchorus.net Business: http://binaryvibes.co.in
Re: [fw-general] Use Zend_Queue for sending mails
On 05/14/2010 11:36 AM, Ralf Eggert wrote: Hi, I want to use Zend_Queue to send bulk mails (newsletters). These newsletters are individualized. I think I have two general options how to handle this: a) Create all Zend_Mail objects and send them serialized to the Zend_Queue. When the queue is processed, I only need to send these mails out. b) Just send the parameters in the Zend_Queue (user id, newsletter id). When the queue is processed I create the Zend_Mail objects from these parameters and send them out. If I were to use Zend_Queue, I'd recommend option b. If you want to take a look at how we do it, visit http://projects.binaryvibes.co.in/repositories/entry/bizsense/trunk/application/modules/default/models/Newsletter/Message/Queue.php We don't use Zend_Queue though. We store all the required information in message_queue table and process the queue via cron. -- With warm regards, Sudheer. S Tech stuff: http://techchorus.net Business: http://binaryvibes.co.in
Re: [fw-general] HOW TO USE Zend_Controller_Plugin_Abstract with application.ini
On 03/11/2010 07:24 PM, Matthew Weier O'Phinney wrote: -- rtskoo wrote (on Wednesday, 10 March 2010, 07:13 PM -0800): I use zf 1.10 . I have make a custom contronller plugin now ,which extends from Zend_Controller_Plugin_Abstract. But where to put my custom contronller plugin? I have added this in application.ini already : resources.frontController.plugins.MyPlugin = "MyPlugin" Thank you! It needs to be somewhere it can be autoloaded -- either in your include_path, or in a place where an autoloader can locate and load it. If you're calling it simply "MyPlugin", put it in library/MyPlugin.php. However, I'd advise adding at least a vendor prefix to it: Foo_MyPlugin in library/Foo/MyPlugin.php. Out of curiosity, aren't you supposed to put your plugins in application/plugins or application/modules/default/plugins? -- With warm regards, Sudheer. S Tech stuff: http://techchorus.net Business: http://binaryvibes.co.in
Re: [fw-general] Has anyone ported ZF project from Windows to Linux before?
On Monday 30 November 2009 02:40 AM, Jigal sanders wrote: Well, my first problem is that it gets to my webroot but when I click on a link, it doesn't follow my controller and action. I rather get an error: The requested URL /authentication/login was not found on this server. the whole structure is exactly coppied to my project on ubuntu. can it be something in my vhost config? ServerAdmin jigalroe...@gmail.com <mailto:jigalroe...@gmail.com> DocumentRoot /var/www/nrka/public/ ServerName nrka Options Indexes FollowSymLinks MultiViews AllowOverride None AllowOverride All. Order allow,deny allow from all ##ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ ## ##AllowOverride None ##Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch ##Order allow,deny ##Allow from all ## ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" Options Indexes MultiViews FollowSymLinks AllowOverride None AllowOverride All. You have to allow the .htaccess files to override settings. Or just put up the rewrite rules in the section of Apache configuration. -- With warm regards, Sudheer. S Tech stuff: http://techchorus.net Business: http://binaryvibes.co.in
Re: [fw-general] ZF - Where to begin?
So, as an experienced PHP programmer but someone who's looking wanting to get the whole picture on how to best start utilizing ZF, where does one begin? Like Daniel pointed Surviving The Deep End is a good book. The book is more a 'best practices' tutorial for the Zend Framework user. Being familiar with MVC components helps. The best way is to start writing an application using the Zend Framework. If you wish to make contributions to an open source project written using Zend Framework, I have suggestions. :) Many of us hang out on #zftalk on freenode.net IRC channel. Recently, I wrote a review of the book - Zend Framework 1.8 Web Application Development at http://techchorus.net/zend-framework-18-web-application-development-book-review . The review might help. -- With warm regards, Sudheer. S Tech stuff: http://techchorus.net Business: http://binaryvibes.co.in
Re: [fw-general] Zend_View_Helper_Url not returning correct URL when Zend_Rest_Route is used
There are two things going wrong: you need to specify the route, and, specifically, the default route, when using the url() view helper. $url = $this->url(array( 'module' =>'default', 'controller' =>'user', 'action' =>'login' ), 'default', true); Thanks, Matthew. I was assuming that the url view helper would default to 'default' route. Is it possible to add this enhancement to the url view helper? -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] Zend_View_Helper_Url not returning correct URL when Zend_Rest_Route is used
Hi, In my bootstrap I am adding the Zend_Rest_Route [code] protected function _initRestRoute() { if (PHP_SAPI == 'cli') { return; } $this->bootstrap('frontController'); $frontController = Zend_Controller_Front::getInstance(); $restRoute = new Zend_Rest_Route($frontController, array(), array('webservice')); $frontController->getRouter()->addRoute('rest', $restRoute); } [/code] After adding this route, the url view helper is not returning the correct URL. For instance, in the layout script(default module), [code] $url = $this->url(array('module'=>'default','controller'=>'user','action'=>'login')); echo $url; [/code] The url returns the value '/user' instead of '/user/login'. How can I correct this issue -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Zend_Rest_Controller - how to pass params in the URI for POST requests
POST /webservice/lead not: POST /webservice/lead/apikey/myapikey In other words, apikey/myapikey does not do anything to identify the resource so should not be part of your URI. If your clients must use an API key, then you could have them send it as an HTTP Header. Thanks for the quick response Bradley. I liked the idea of using an HTTP header for API Key as soon as I read your reply. I implemented it in the application already. :) -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] Zend_Rest_Controller - how to pass params in the URI for POST requests
Hi, In my application, I have a module - 'webservice' to handle all REST requests. In my front controller I check if the request has a valid API key in the request URI parameters. If a valid key is not found access is denied. Example URI with API key : example.com/webservice/lead/apikey/myapikey My problem is, Zend_Rest_Route routes the request to putAction() if it finds anything after module/controller/ in the URI even though the method is POST. Is it possible to route requests to postAction() and pass pass parameters in the URI? Or, is there a better way of managing API key checks for REST requests? -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] How to set either Zend_Form_Element_Text required?
On Wednesday 30 September 2009 10:18 AM, Leon_L wrote: Hi, I'm new to Zend Framework, I have a question is that if I have two Zend_Form_Element_Text in a form, and I want make either of them to be filled by the user. For example, phone number and mobile number. People only need enter one of them to continue. How am I going to do this? Thanks Write a custom validator and use the $context variable. The reference manual has an example custom validator. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] bootstrap application from CLI
On Monday 28 September 2009 08:42 PM, Pádraic Brady wrote: I'm actually curious about this myself - how are people differentiating their application.ini settings between a web environment and console environment? Another inherited settings section? A separate config file? Paddy I had to move lot of config from application.ini to the bootstrap class. I didn't like the idea of having another APPLICATION_ENV value - 'production_cli'. This calls for additional checks in the resource methods. For example I had to write [code] if (PHP_SAPI == 'cli' and APPLICATION_ENV == 'production') { return; } [/code] at be beginning of one of the resource methods. To remove such checks, I have to move almost everything from application.ini to the bootstrap class. :/ -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] bootstrap application from CLI
The problem is, Zend_Application instantiates the front controller which in turn registers the FlashMessenger action helper. This throws the Zend_Session exception. Sorted it out. In my application.ini config file, I had defined a layout resource. This was bootrapping the view resource which in turn was bootstrapping the front controller resource. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] bootstrap application from CLI
On Monday 28 September 2009 05:58 PM, keith Pope wrote: 2009/9/28 Sudheer Satyanarayana: Hi, I am trying to boostrap the application from CLI. $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); $application->bootstrap(array('autoload', 'config', 'database')); The problem is, Zend_Application instantiates the front controller which in turn registers the FlashMessenger action helper. This throws the Zend_Session exception. Unit test enabling the session solves the problem. //require_once 'Zend/Session.php'; Zend_Session::$_unitTestEnabled = true; However, it is a quick hack solution. This CLI script runs in the production environment. Therefore, I don't want the session to be unit test enabled. To overcome the problem, I tried to override the method _initFrontController(). It doesn't seem to be the correct method name. Is it possible to disable the front controller? If not, how do I instruct the front controller to not register the FlashMessenger action helper? Your code does look correct, are you doing $application->run(); No, I am not calling run(); If so you dont want that as it starts the dispatch... If not this could be a bug, by doing boostrap('resource') etc Z_App should only execute those resources! -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] bootstrap application from CLI
Hi, I am trying to boostrap the application from CLI. $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); $application->bootstrap(array('autoload', 'config', 'database')); The problem is, Zend_Application instantiates the front controller which in turn registers the FlashMessenger action helper. This throws the Zend_Session exception. Unit test enabling the session solves the problem. //require_once 'Zend/Session.php'; Zend_Session::$_unitTestEnabled = true; However, it is a quick hack solution. This CLI script runs in the production environment. Therefore, I don't want the session to be unit test enabled. To overcome the problem, I tried to override the method _initFrontController(). It doesn't seem to be the correct method name. Is it possible to disable the front controller? If not, how do I instruct the front controller to not register the FlashMessenger action helper? -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Object oriented programming with Zend
On Saturday 26 September 2009 06:57 PM, PHPScriptor wrote: Hello there, I worked for different companies and saw different ways of programming websites. Now everybody is talking about OO programming. But my question is: why? Let me give you an example one of the ways I saw it done: a class member Class Member { protected $_id; protected $_name; portected $_street; ... public function setId($id) { $this->_id = $id; } public function getId() { return $this->_id; } ... public function save() { $member = array('name' => $this->getId(), 'street', $this->getStreet(), ...) $db->insert($member); } } When a form is posted it did: $member = new Member(); $member->setName($this->_getParam('member') ->setStreet($this->_getParam('street'); ... $member->save(); Also when you get data from the db it will be inserted in the object, and get from the object when you need to show it (eg in the view). Another way (I did it) before: Just in the controller after eg posting a form: $data = $this->_getAllParams(); $db->insert($data); Like you see, my way is a lot shorter :-). I think you are confusing what the code snippet is trying to demonstrate. Well, if you use Zend_Form you could do something like $data = $form->getValues(); $data->insert($data); All the form fields would be filtered and validated as well. Even more better than your snippet? Think SQL injection. But comments I get is: it's not really OO. They are true with that comment, but why should you make all those object, all those set en gets, ... Why isn't it better to work with arrays? With the Zend framework IMHO you don't need to configurate all those objects. Ok, in some systems it's better. But let's talk about administration application, where you only have forms to input or edit, delete and view lots of data. What 's your meaning, why is it better to use them? ... It is next to impossible to write all the benefits of using OOP in this email. You should read books about OOP to learn more about it. The sample you snippet posted appears to demonstrate how to encapsulate database access in your models. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] How to bootstrap application in testing environment
Again, this is a wild stab in the dark, but I have: Zend_Session::$_unitTestEnabled = true; in my TestHelper.php (run at the start of testing), which magically fixes a lot of sessions related test problems. That fixed the problem. Thanks. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] How to bootstrap application in testing environment
On Friday 18 September 2009 07:09 PM, Sudheer Satyanarayana wrote: Hi, I followed the tutorial at zendcasts.com ( http://tinyurl.com/n4hee2 ) to setup testing environment for my ZF enabled application. Everything went fine with regards to the tutorial. But the tutorial recommends including a test class that extends Zend_Test_PHPUnit_ControllerTestCase in the test bootstrap. I think it is a bit awkward for your ModelTest and LibraryTest classes to extend a class that in turn extends Zend_Test_PHPUnit_ControllerTestCase. Is there a way to bootstrap your testing environment without extending Zend_Test_PHPUnit_ControllerTestCase? I want to reuse the application's Bootstrap.php in all my environments - development, testing and production. I tried to bootstrap the application in my test like below: [code] $application = new Zend_Application(APPLICATION_ENV,APPLICATION_PATH . '/configs/application.ini'); $application->bootstrap(); [/code] But I get PHP session warnings because the user running tests is unable to write to /var/some/path/apache/is/able/to/write/to. Zend_Test_PHPUnit_ControllerTestCase mysteriously circumvents this. Example code snippet is highly appreciated. Anyone? -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Split controller actions into multiple classes
On Friday 18 September 2009 07:10 PM, Ryan Chan wrote: Hello, I have a controller that contains too many line of codes, which made the controller too large. So I want to split each action into eactly one class files. Is it recommended? If not, what are the recommended way to make the controller "thin"? Consider splitting your code into multiple controllers and perhaps modules. Do you have model classes by the way? -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] How to bootstrap application in testing environment
Hi, I followed the tutorial at zendcasts.com ( http://tinyurl.com/n4hee2 ) to setup testing environment for my ZF enabled application. Everything went fine with regards to the tutorial. But the tutorial recommends including a test class that extends Zend_Test_PHPUnit_ControllerTestCase in the test bootstrap. I think it is a bit awkward for your ModelTest and LibraryTest classes to extend a class that in turn extends Zend_Test_PHPUnit_ControllerTestCase. Is there a way to bootstrap your testing environment without extending Zend_Test_PHPUnit_ControllerTestCase? I want to reuse the application's Bootstrap.php in all my environments - development, testing and production. I tried to bootstrap the application in my test like below: [code] $application = new Zend_Application(APPLICATION_ENV,APPLICATION_PATH . '/configs/application.ini'); $application->bootstrap(); [/code] But I get PHP session warnings because the user running tests is unable to write to /var/some/path/apache/is/able/to/write/to. Zend_Test_PHPUnit_ControllerTestCase mysteriously circumvents this. Example code snippet is highly appreciated. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Clarification needed about "Zend" and its products
On Saturday 12 September 2009 08:25 PM, ataulkarim wrote: I must admit in the beginning i'm somewhat new to Frameworks, but for reasons to move to enterprise development and faster project execution im prone to get into the Frameworks Arena. Now, i have to make a choice between certain frameworks - Zend Framework, CakePHP, Symfony, CodeIgniter etc. I've invested quite a bit of time for each one's pros n cons, but i could not find an article or tutorial that gives me a complete insight into the world of "Frameworks". I've decided to approach the Zend Community to clarify me some of the things that are going on in my head. I hope many would like to participate here so that each new beginner can get an idea what options he has. Now, with all the backing that Zend has in terms of Technology Partners, people with PHP-Core knowledge, i decided to learn Zend framework, although alot of friends told me to choose CakePHP. Zend has: 1. Zend Framework 1.9.2 (Free) 2. Zend Server Community Edition (Free) 3. Zend Server (Buy) There is no compulsion to use other Zend products with Zend Framework. Zend Framework can be used on any PHP 5 installation. I've seen MVC tutorials of the framework (although old ones), but find the concept appealing. Zend server Community Edition provides with an user interface to work with, great. The only thing that confuses me is the aspect of CACHING. Caching Zend framework and Zend Community Edition come with the Zend Optimzer(to my understanding does not do opcode caching) and the Zend Server provides with opcode caching. I've read alot of APC caching possibilities and capabilites which to some people is faster then Zend Optimzer. Andi Gutmans commented somewhere that Zend Server has opcode caching capabilities and performance tests should be done with zend server. Now, here are my questions: 1. If i install Zend Server Community Edition can i still make certain manual changes i would be able to do with Zend Framework? You don't have to use Zend Server in order to use Zend Framework. But if you wish, you can. 2. Are opcode caching capabilites present in Zend Framework / Zend Server CE - other than Optimizer? (if not -> Can i use zend framework to manually overcome this deficit?) 3. If the only Opcode caching is possible with Zend Server(which i would have to buy)- is there a possibility to integrate APC with Zend Framework? Yes, you can use APC or any other op code caching component of your choice. Just treat Zend Framework as any other PHP library. 4. Why does Zend has a http://framework.zend.com/docs/screencasts Screenacst Tutorial about "Getting Started with Zend Framework" with 1.0.3. Ok i know Zend is a 'Company' and would concentrate more on the buy side of products, but essence of PHP is i guess Open Source(free) and any help regarding that would be appreciated even if its in the getting started video - 1.8 would also be OK :-) . There are good tutorials on ZF. http://www.survivethedeepend.com/ for example. The blogosphere offers some good tutorials. There is also the http://www.zendcasts.com/.( The domain name might mislead. It is not an official Zend website). I hope i get some clarification for these questions which might also benefit others. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Usage of ZFW / PHP in yuor country
On Saturday 12 September 2009 04:12 PM, howard chen wrote: Hello, I am from Taiwan. In Taiwan, PHP is still not a main stream commerical programming language for web, people still prefer .NET or Java for web site development. (Althought most taiwan people prefer PHP opensource app such as wordpress, phpbb etc) Talking about PHP itself, most people still perfer programming with raw PHP - inline php codes with HTML. (not to mention ZFW) Is it the same in your contry? I heard that PHP is more popuar and well accepted in some western countries, even in the enterprise market, is it true? Is it a wild guess about PHP usage in your country? Are you quoting a trusted source? If so what it is it? Or you have you conducted a survey yourself? And what has it got to do with Zend Framework? -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Unable to translate strings retrieved from DB
Thomas Weidner wrote: Simply make a var_dump() of $string, and $manualString and compare them to see where the differences are. A missing whitespace, additional point or any other different char could be the problem. You hit the nail on the head, Thomas. Thank you very much. I thought I was not overlooking this. The string in the DB had four linefeed characters and the source string in the translation file didn't. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] Unable to translate strings retrieved from DB
Hi, I am trying to set up a translation layer to an existing application. Here is my sample PHP script: [phpscript] $translate = new Zend_Translate('gettext', APPLICATION_PATH . '/languages/en/menu.mo', 'en'); $translate->setLocale('en'); mysql_connect($MySQL_Host, $MySQL_User, $MySQL_Passw); mysql_select_db($db); $result = mysql_query("select news from mdirekt_news where id = 1"); $row = mysql_fetch_object($result); //Print the string as is $string = $row->news; echo "As is: ". $string; //Print the translated string. Does not translate at all. Prints the source string as is echo " Zend_Translate translated: "; echo $translate->_($string); //Copy the string manually to a variable and print the translated string. Works well. echo "Manually copied string translated: "; $manualString = "unterstützt Ihre Messekommunikation durch die Verbreitung im Vorfeld der Messe - weil Sie aktiven Einfluss auf die Besuchsplanung des Messebesuchers ausüben"; echo $translate->_($manualString); [/phpscript] The script does not translate the string retrieved from the database. I think it is a character encoding issue. But I do not know how to fix. In an attempt to fix the issue I changed the collation to utf8_general_ci on the column, table and the database. But the output remains same. What could be the problem? How can I perform proper translation? -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] Re: [fw-mvc] - Where to put common DB calls
Vibhor Singh wrote: Hi, Can someone plz tell me whether there is any provision in ZF where I can put my common DB related functionalities, something like how action helpers is to controllers? All suggestions are welcome. Can you elaborate? The answer depends on the type of functions you are talking about. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Matthew's pastebin app
Christoph Dorn wrote: Matthew, Are you planning to update your pastebin app to incorporate all the latest 1.9 features? Christoph I would love to hear yes from Matthew! -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Put each action in a separate PHP file?
Ryan Chan wrote: Hello, As a ZFW learner, I tried the quick start: http://framework.zend.com/docs/quickstart/create-a-form My problem is when the controller contains many action - it make the file too large to edit. So I want to split each action into a separate PHP file, is it possible? Thanks... Hi Ryan, If you find your controller too large consider the following: 1. Segregating your application into multiple modules each having their own controllers 2. In the controller action receive the request, call the appropriate methods of your models and then assign variables to the view. This approach makes your controllers thin. IMO, it becomes very difficult to manage the code if every controller actions include files. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Zend Framework 1.9.0 Released!
700 issues have been resolved or closed since the release of 1.8.0! Any project the size of Zend Framework will inevitably run into issues where backwards compatibility breaks occur. While we strive to keep these to a minimum, we still needed to introduce several changes and updates in this version. They include the following: * Zend_Http_Client A change was made in Zend_Http_Client to correct ZF-5744 (Multiple file uploads using the same $formname in setFileUpload). Instead of returning an associative array of element name => upload information pairs, it now returns an array of arrays, with the element name as part of the upload information. This allows multiple file uploads using the same element name. * Zend_Config_Xml One deciding factor for many when choosing which Zend_Config format to use for their application config had to do with support for constants. Our application recommendations include defining two constants, APPLICATION_ENV and APPLICATION_PATH, and many developers have found it useful that in INI and PHP configurations, these constants are expanded during parsing. Zend_Config_Xml now supports this via an XML namespace as follows: http://framework.zend.com/xml/zend-config-xml/1.0/";> /library On the PHP side, nothing changes. * Zend_Translate_Adapter_Ini Prior to PHP 5.3, parse_ini_file() and parse_ini_string() handled non-ASCII characters in INI option values without an issue. However, starting in PHP 5.3, such options will now be silently dropped in the array returned. If you are upgrading to PHP 5.3 and using Zend_Translate_Adapter_Ini, this could cause potential issues for you. If you use UTF-8 or Latin-1 characters in your INI option keys (which are the message IDs for translation), you should either modify these to use only ASCII characters, or choose a different translation adapter. * Zend_Service_Amazon Zend_Service_Amazon has been updated to comply with the latest Amazon ECommerce APIs -- which, as of 15 August 2009, will require an API key for authentication. As a result, if you now use Zend_Service_Amazon, you will need to pass your API key to the Zend_Service_Amazon constructor: $amazon = new Zend_Service_Amazon($appId, $countryCode, $apiKey); Otherwise, usage of this component remains the same. A detailed list of all features and bug fixes in this release may be found at: http://framework.zend.com/changelog/1.9.0 Please join me in a hearty round of congratulations and acknowledgment of all contributors who helped make this release possible through code contributions, feedback, testing, documentation, translations, and issue reports! Without you, the community, Zend Framework would not be where it is today! Congrats to Zend, the contributors and everyone in the community. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Unable to autoload module's models
Have you got resources.modules = "" in your application.ini (or equivalent)? This causes the modules resource to be instantiated, which is responsible for calling the bootstrappers for all modules. Thanks. I was missing this. After I added [code] resources.modules = APPLICATION_PATH "/modules" [/code] in application.ini, autoload is working fine. I notice that you have a default module inside your modules directory. when Zend_Tool creates a new project the default modules controllers, models, views are located in Yes, this is the recommended directory structure - default module in the "application" directory (ie. not under the modules directory) I actually followed the directory structure specified in the manual: http://framework.zend.com/manual/en/zend.controller.modular.html - scroll down to 12.11.2. Specifying Module Controller Directories. The example demonstrating the addModuleDirectory() has default directory in application/modules. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Unable to autoload module's models
iamjim wrote: Here is what works for me in my module (Auth), to autoload files in the module subdirectories form, service, and models. class Auth_Bootstrap extends Zend_Application_Module_Bootstrap { protected function _initAuthAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'Auth_', 'basePath' => APPLICATION_PATH . '/modules/auth', 'resourceTypes' => array ( 'form' => array( 'path' => 'forms', 'namespace' => 'Form', ), 'model' => array( 'path' => 'models', 'namespace' => 'Model', ), 'service' => array( 'path' => 'service', 'namespace' => 'Service', ) ) )); return $autoloader; } } Thanks for the response. I now have this in the application/modules/job/Bootstrap.php [code] class Job_Bootstrap extends Zend_Application_Module_Bootstrap { protected function _initAuthAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'Job_', 'basePath' => APPLICATION_PATH . '/modules/job', 'resourceTypes' => array ( 'form' => array( 'path' => 'forms', 'namespace' => 'Form', ), 'model' => array( 'path' => 'models', 'namespace' => 'Model', ), 'service' => array( 'path' => 'service', 'namespace' => 'Service', ) ) )); return $autoloader; } } [/code] But still autoload does not work. The class Job_Bootstrap in the above file is never instantiated. I get the error: Fatal error: Class 'Job_Model_Index' not found My directory structure is application configs controller models modules admin... auth controllers forms models services views Bootstrap.php main... library public tests I notice that you have a default module inside your modules directory. when Zend_Tool creates a new project the default modules controllers, models, views are located in the application directory. Hope this is helpful. jim -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] Unable to autoload module's models
Hi, I have the following directory structure application ---Bootstrap.php ---modules --admin --default -controllers -models --- Account.php (with class Model_Account) -views --job Bootstrap.php( with class Job_Bootstrap extends Zend_Application_Module_Bootstrap) controllers -models Index.php (with class Job_Model_Index) -views I am unable to setup aotoload for Job_Model_Index. These are the contents of the application/Bootstrap.php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { ... protected function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => '', 'basePath' => dirname(__FILE__) . '/modules/default' )); return $autoloader; } } And below is the content of application/modules/job/Bootstrap.php class Job_Bootstrap extends Zend_Application_Module_Bootstrap { public function __construct($application) { parent::__construct($application); // echo "Bootstrap loaded!"; exit(1); } public function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => '', 'basePath' => dirname(__FILE__) )); return $autoloader; } } The Job_Bootstrap is not instantiated at all. I read the manual and few threads here, but could not figure out a solution. Can somebody suggest what is wrong with my code? -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] ZF1.8.4 and Dojo filteringselect
Holon35 wrote: Since V1.8.4 off ZF all my dojo dialog are down. With ZF1.8.3 /1001sportifsv2/public/general/default/index/listecommunautesrechvideo is called automatically and the value corresponding to 10 is selected. With 1.8.4 nothing is selected and 'populate' dont work at all. I'm very desapointed and I cant find solution. Hi, Look at http://framework.zend.com/issues/browse/ZF-7360 and vote on it. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Problem about running the quick start sample.
Niu Kun wrote: Dear all, I'm new to Zend Framework. First of all, I followed the quick start sample. But I change the database to mysql. And I change the pdo configuration. But when I browse to http://localhost/guestbook, I always get a 404 error. So I downloaded the sample code from the zend framework website and changed nothing. But, this time, I got the same 404 error. Would anyone here please point me out? Have you enabled mod_rewrite? Is your host allowed to override the rewrite rules? -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Get request from view
umpirsky wrote: Hi. Is there some easy way to get request parameters from view script (object)? I like smarty $smarty.post, is there sth like $view->getParam() in zend framework? You can get the request parameters from the request object. This might help to grab the request object: http://techchorus.net/how-access-request-object-any-part-your-application -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Reusing a partial across modules
keith Pope wrote: 2009/5/20 Sudheer Satyanarayana : Hello all, I am trying to reuse a partial in all my modules. I have the partial placed at modules/default/views/scripts/search.phtml In the view script modules/admin/views/scripts/branch/index.phtml I have the following code: paginationControl($this->paginator, 'Sliding', 'search.phtml', array('default')); ?> As per the documentation at http://framework.zend.com/manual/en/zend.paginator.usage.html#zend.paginator.rendering I am passing the module name in the additional parameters in the fourth argument. But the partial from the default module is not called at all. I get an exception with the message - string 'script 'search.phtml' not found in path (.../application/modules/admin/views/scripts/). Where did I go wrong? You need to add the script path to the view, what I usually do is have /application/views/scripts and use this as the global directory for shared view elements. You can add the path during bootstrap. Thanks for the quick reply. But, isn't it a performance overhead? Lazy loading the script would be great. I read, it is possible according to the documentation. http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.partial - Example 60.6. Rendering Partials in Other Modules Did I completely misunderstand the concept? To debug the issue, I copied the search.phtml file to admin/view/scripts and everything works properly. But having a copy of this script in every module is unmaintainable. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] Reusing a partial across modules
Hello all, I am trying to reuse a partial in all my modules. I have the partial placed at modules/default/views/scripts/search.phtml In the view script modules/admin/views/scripts/branch/index.phtml I have the following code: paginationControl($this->paginator, 'Sliding', 'search.phtml', array('default')); ?> As per the documentation at http://framework.zend.com/manual/en/zend.paginator.usage.html#zend.paginator.rendering I am passing the module name in the additional parameters in the fourth argument. But the partial from the default module is not called at all. I get an exception with the message - string 'script 'search.phtml' not found in path (.../application/modules/admin/views/scripts/). Where did I go wrong? To debug the issue, I copied the search.phtml file to admin/view/scripts and everything works properly. But having a copy of this script in every module is unmaintainable. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] howto find a method
Mike Wright wrote: Hi all, Is there any glossary or index that allows finding a method and/or its associated class? Sure would make life easier, especially for those not already immersed in the framework :D http://framework.zend.com/docs/api Is that what you are looking for? -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Four oh four issue
I have posted this to the issue queue. Vote for it - http://framework.zend.com/issues/browse/ZF-6650 -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] Four oh four issue
Hi, I have set up the the error controller with error_handler to act as 404 handler as per the instructions in the online reference manual. The 404 handler works but for one situation. If there is a ':' in the URI I don't get the exxception of type Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER or Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION. Instead I get a Zend_View_Exception. For example, I have the index controller and the index action in the default module. The page loads properly, when index/index/index is requested. However, when index: is requested, the Zend_View_Exception is thrown. The message in the exception is 'script 'index:/index.phtml' not found in path (../application/views/scripts/)' Shouldn't I be getting an exception of type Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER? ZF 1.8.0. There are no custom routes defined. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] Refresh meta tag with Zend_Http_Client
Hi list, Is Zend_Http_Client capable of refreshing meta tag? If so, how do I achieve it? -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Survey: Development environment for PHP/ZFW
howard chen wrote: Please feel free to answer: 1. What OS you are using during development? Windows? Mac? Linux? Linux. Currently Fedora 10. 2. Do you edit source code on localhost or remote? i.e. is your testing environment reside on localhost or remote? Local 3. What tool or IDE you are using? Ultraedit? Apanta? Eclipse PDT? vim 4. Which versioning system your are using? svn? git? svn and git 5. Do you use PHPUnit or other testing tools? PHPUnit -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] how to know which controller and action is being called
Vadim Gabriel wrote: Hey, That will not give him the ability to access the request object in his view script. Unless he would like to get the front controllers instance directly inside the view script file. True. I have never encountered a situation where I had to access the request object in the view script. Pradosh, If you describe us what exactly you are trying to do, we will be able to provide proper directions. My previous reply was for your information purpose only. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] how to know which controller and action is being called
prado wrote: BTW Vince How can i use this below straight from the view without putting in a variable from the controller? cheers Access the request object. And then you can read the controller name: $request->getControllerName(); This link might help - http://techchorus.net/how-access-request-object-any-part-your-application -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Zend_Db_Table How best to associate an object with a db table?
J DeBord wrote: This may be partially a general oop question, but I hope someone can give me some advice. If you want to build a User object, what is the best way to store it's attributes? Would a user object extend a Zend_Db_Table? Would you code a User class and have it interact with a UserTable extends Zend_Db_Table class? Can anyone provide a general example of code please? Or any advice? Books to read, sites to visit, etc... Personally, I prefer not to extend Zend_Db_Table for models. Matthew has written about it previously. http://weierophinney.net/matthew/archives/202-Model-Infrastructure.html You should follow Matthew's blog for tutorials, news and insight about Zend Framework. There's also a free book available on ZF - http://www.survivethedeepend.com/ -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Zend Framework team reorganization
Matthew Weier O'Phinney wrote: Greetings! The Zend Framework team has undergone some internal reorganization recently which will have some bearing on the project. First, the team now reports to Zeev Suraski, Zend's CTO. Please welcome him to the lists! Wow. Welcome Zeev. Additionally, Wil Sinclair is ending his tenure as the Zend Framework team leader. During his time as project lead, Zend Framework has made tremendous progress in becoming the de-facto standard for PHP development, with several significant achievements: * The 1.5, 1.6, and 1.7 releases, as well as the recent 1.8 preview release * Helped support and build partnerships with the Dojo Foundation, Adobe, and others * Introduction of agile methodologies to the ZF team * Usage of social networking media as an additional support vector I'd like to thank Wil for his contributions to the Zend Framework project! Thanks for all the greet work, Wil. Best of luck. Finally, I am pleased to announce my own promotion to the position of Project Lead. I have worked with Andi and Zeev in recent weeks to define how I will approach this role, and have emphasized during that time the need to address and respond to community concerns. Congrats Matthew. You deserve it! Following the 1.8 release, the team will be focussing on items such as whiddling down the bug backlog, improving documentation, and writing tutorials. Additionally, we will be outlining and scoping upcoming releases in order to publish a public roadmap for the project. Part of this effort will include some work to make the proposal process easier and more transparent. The hope is that having published milestones will help focus user contributions, both in terms of new features and stabilizing the framework. I look forward to working with each and every one of you, and welcome your feedback! -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Zend Framework Dojo Form Example with everything working?
Garey Smiley wrote: Sudheer Satyanarayana wrote: Garey Smiley wrote: I can't seem to find a fully working Zend_Dojo_Form example that actually works and includes bootstrap, controller and view that work with the example Zend_Dojo_Form class. I've tried many of them from the web, but all of them seem to be missing certain vital information to actually make them work. Have you tried the following? http://techchorus.net/add-cool-zend-dojo-date-picker-form-element-without-writing-single-line-javascript http://techchorus.net/autocomplete-example-zenddojoformelementfilteringselect-and-zenddojodata -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net Yep. I got: Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (index)' The error message indicates, you haven't set the right controller directory or there is no index controller. You will be able to get Zend_Dojo_Form to work only after the 'invalid controller' issue is fixed. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Zend Framework Dojo Form Example with everything working?
Garey Smiley wrote: I can't seem to find a fully working Zend_Dojo_Form example that actually works and includes bootstrap, controller and view that work with the example Zend_Dojo_Form class. I've tried many of them from the web, but all of them seem to be missing certain vital information to actually make them work. Have you tried the following? http://techchorus.net/add-cool-zend-dojo-date-picker-form-element-without-writing-single-line-javascript http://techchorus.net/autocomplete-example-zenddojoformelementfilteringselect-and-zenddojodata -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] security/Zend Session
411161 wrote: If I have some code that checks to see if a user is logged in and I want to do this for every page where is the best place to do this? I use modules and just want to do it for a particular module, does that change things? Front controller plugin. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Zend Db how to update rows like "price=price+formValue['price'] "
Mantasgl wrote: Hi I have a form in which I write a price and i want that prices of my products could be increased by that form value. A simple query would look like "UPDATE product SET price = price + $formvalue['price']" This works in phpmyadmin. So how could I write such a query with zend db? $db->update('product', $columnValuesArray); Or $result = $db->query("UPDATE product SET price = price +$formvalue['price']"); Where $db is your Zend_Db adapter. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] Action Helper To Send Files?
Hi All, I have few questions: 1. Would it make sense to write a PDF file sender Action Helper for ZF? I was wondering whether we could add this feature to contextSwitch Action Helper. 2. Or would it make more sense to write a generic file sender Action Helper with various adapters - PDF, CSV, Text, etc? 3. Does something like this exist already? The Action Helper would perform the following: 1. Disable layout 2. Disable view 3. Set appropriate headers 4. Send the file Regards, -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
Re: [fw-general] Custom validator is not run when the element value is not set
Sudheer wrote: Hi, I have written a custom validator to make either first name or last name field in my form mandatory. But not both. I have added the custom validator to the lastName element. The validator won't run unless the element value is set. I want it to run even though no value is supplied to the element. Is it possible? Never mind. Just re-read the manual and solved the issue by using setAllowEmpty(false). Regards, -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] Custom validator is not run when the element value is not set
Hi, I have written a custom validator to make either first name or last name field in my form mandatory. But not both. I have added the custom validator to the lastName element. The validator won't run unless the element value is set. I want it to run even though no value is supplied to the element. Is it possible? Here's the relevant part of the form: [snip] $form = new Zend_Form; $firstName = $form->createElement('text', 'firstName') ->addValidator(new Zend_Validate_StringLength(0, 100)) ->setLabel('First Name'); $middleName = $form->createElement('text', 'middleName') ->addValidator(new Zend_Validate_StringLength(0, 100)) ->setLabel('Middle Name'); $lastName = $form->createElement('text', 'lastName') ->addValidator(new Zend_Validate_StringLength(0, 100)) ->setLabel('Last Name') ->addValidator(new BV_Validate_PersonName); [/snip] Here's the code in BV_Validate_PersonName [snip] class BV_Validate_PersonName extends Zend_Validate_Abstract { const MSG = 'failed'; protected $_messageTemplates = array( self::MSG => 'Either first name or last name must be supplied', ); public function isValid($value, $context = null) { $this->_setValue($value); if (is_array($context)) { if ( (strlen($context['firstName']) > 1) or (strlen($context['lastName']) > 1)) { return true; } } $this->_error(self::MSG); return false; } } [/snip] Regards, -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
[fw-general] How to add a table row - Zend_Form decorator
Hi, I have the set the following decorators to render the form in a table. This is actually a subform, if it matters. $productsForm->setDecorators(array( 'FormElements', array('decorator' => array('th' => 'HtmlTag'), 'options' => array('tag' => 'th')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr')), array('HtmlTag', array('tag' => 'table', 'id'=>'productsTable')), 'Form' )); $productsForm->setElementDecorators(array( 'ViewHelper', 'Errors', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr')), )); I want to know how to add a table row with headings using decorators. Example output needed: head1head2head3 I want this row to appear on top of other rows in the table. The [snip] array('decorator' => array('th' => 'HtmlTag'), 'options' => array('tag' => 'th')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr')), [/snip] creates a row and adds one cell. But I don't know how to add content to that cell. Any help is appreciated. -- Sudheer. S Business: http://binaryvibes.co.in, Community: http://lampcomputing.com, Personal: http://sudheer.net
Re: [fw-general] Unable to programatically create filteringSelect
Nico Edtinger wrote: Sudheer wrote: var counter = 0; function moreWidgets() { counter++; var stateSelect = new Array(); list = stateSelect[counter]; var filteringSelect = new dijit.form.FilteringSelect( { id: stateSelect[counter], name: "productId[" + counter + "]", searchAttr: "productName" }, "list"); newStore = new dojo.data.ItemFileReadStore({url: '/product/jsonlist'}); filteringSelect.store = newStore; [...] When the function moreWidgets() is called, it is unable to create the filteringSelect widget. If I comment out the lines that create and append filteringSelect, the function works well. It also creates the other price and quantity elements when the filteringSelect lines are commented. But the script halts when the filteringSelect lines are uncommented. I get the message "root is null si = root.selectedIndex; file /js/dojo...mboBox.js (line 1051)" in firebug console. I would have asked the question in the dojo forums. But anyway ... here is a guess. Thanks for the response. Few kind folks helped me on #dojo for couple of hours. Unfortunately. we were unable to resolve the issue. I have an example HTML page where the same moreWidgets() function works well. I only get this issue when trying to integrate into the application that uses Zend Framework. Line 1051 in ComboBox.js is dijit.form._ComboBoxDataStore.fetchSelectedItem(). That's the store, which uses a select node instead of a normal store. So I think you should first create the store and give that as a param to the constructor of dijit.form.FilteringSelect. Few folks on #dojo also suspected this to be cause. But it is not. Like I said above, I have a clean working example which generates input element with filteringSelect widget before the store is created. BTW in firebug you can normally check which line of your code causes the error, with the backtrace and the function parameters in the trace. Or you set breakpoint, add watches and step through the code to see what goes wrong. In the firebug console I get "TypeError: root is undefined" error when I execute the following JavaScript line var product = new dijit.form.FilteringSelect(); However, I can execute the same line in the firebug console when the working example page is loaded. It returns an object and does not show any error. I suspect, the issue lies somewhere in ZF and Dojo integration. Of course, I could be wrong. You can reproduce this behaviour by doing the following steps: 1. Create a Zend_Form object with couple of sample elements. 2. Use dojo() view helper to specify path and stylesheet themes to use 3. Write a JavaScript function that creates an element with filteringSelect widget and include it in your view/layout. 4. Call the JavaScript function that you wrote in step 3. One more fact I have observed is, this is happening with only the filteringSelect dijit. Regards, -- Sudheer Satyanarayana Binary Vibes Information Technologies Pvt. Ltd. Postal Address: #506, 10th B Main Road, I Block, Jayanagar, Bangalore – 560 011 URL : www.binaryvibes.co.in Phone: +91 80 41558451 * Mobile: +91 99005 07499 Community : http://lampcomputing.com
Re: [fw-general] Unable to programatically create filteringSelect
Bump. Tried several ways to fix the issue. None of them worked so far. Can anybody give me a clue? Hi all, I have a custom js script in which I am trying to create an input element with filteringSelect widget when clicked on a button. I have tested the script with just an HTML file and it works great. However, I'm lost when trying to integrate the same functionality to the application which uses Zend_Dojo. In this particular page, there are other input elements with filteringSelect widget created by Zend_Form_Dojo that also work well. Here is my view script: view script--- form; //what follows below is another form to test the functionality ?> value=""> view script--- I have the following snippet in the layout script ---layout script--- dojo()->addStylesheetModule('dijit.themes.tundra'); ?> > ---layout script--- The custom js script - /js/custom/purchase.js ollows: custom js script-- var counter = 0; function moreWidgets() { counter++; var stateSelect = new Array(); list = stateSelect[counter]; var filteringSelect = new dijit.form.FilteringSelect( { id: stateSelect[counter], name: "productId[" + counter + "]", searchAttr: "productName" }, "list"); newStore = new dojo.data.ItemFileReadStore({url: '/product/jsonlist'}); filteringSelect.store = newStore; dojo.byId("moreInput").appendChild(filteringSelect.domNode); //Create quantity and append it to the form var quantity = document.createElement("input"); quantity.setAttribute("type", "text"); quantity.setAttribute("name", "quantity[" + counter + "]"); quantity.setAttribute("width", "50px"); quantity.setAttribute("size", "5"); dojo.byId("moreInput").appendChild(quantity); //Create price and append it to the formvar price = document.createElement("input"); price.setAttribute("type", "text"); price.setAttribute("name", "price[" + counter + "]"); price.setAttribute("width", "50px"); price.setAttribute("size", "5"); dojo.byId("moreInput").appendChild(price); var lineBreak = document.createElement("br"); dojo.byId("moreInput").appendChild(lineBreak); //Set total // dojo.byId("totalProducts").value = counter; } dojo.addOnLoad(function() { moreWidgets()}) custom js script-- When the function moreWidgets() is called, it is unable to create the filteringSelect widget. If I comment out the lines that create and append filteringSelect, the function works well. It also creates the other price and quantity elements when the filteringSelect lines are commented. But the script halts when the filteringSelect lines are uncommented. I get the message "root is null si = root.selectedIndex;file /js/dojo...mboBox.js (line 1051)" in firebug console. How do I get the script to create new element with filteringSelect widget? Any help is greatly appreciated.
[fw-general] Unable to programatically create filteringSelect
Sudheer wrote: I sent this message to fw-mvc. I think the spam filter ate it up. I am sending the same message to gw-general. Still looking for a solution to the below mentioned problem. Hi all, I have a custom js script in which I am trying to create an input element with filteringSelect widget when clicked on a button. I have tested the script with just an HTML file and it works great. However, I'm lost when trying to integrate the same functionality to the application which uses Zend_Dojo. In this particular page, there are other input elements with filteringSelect widget created by Zend_Form_Dojo that also work well. Here is my view script: view script--- form; //what follows below is another form to test the functionality ?> value=""> view script--- I have the following snippet in the layout script ---layout script--- dojo()->addStylesheetModule('dijit.themes.tundra'); ?> ---layout script--- The custom js script - /js/custom/purchase.js ollows: custom js script-- var counter = 0; function moreWidgets() { counter++; var stateSelect = new Array(); list = stateSelect[counter]; var filteringSelect = new dijit.form.FilteringSelect( { id: stateSelect[counter], name: "productId[" + counter + "]", searchAttr: "productName" }, "list"); newStore = new dojo.data.ItemFileReadStore({url: '/product/jsonlist'}); filteringSelect.store = newStore; dojo.byId("moreInput").appendChild(filteringSelect.domNode); //Create quantity and append it to the form var quantity = document.createElement("input"); quantity.setAttribute("type", "text"); quantity.setAttribute("name", "quantity[" + counter + "]"); quantity.setAttribute("width", "50px"); quantity.setAttribute("size", "5"); dojo.byId("moreInput").appendChild(quantity); //Create price and append it to the formvar price = document.createElement("input"); price.setAttribute("type", "text"); price.setAttribute("name", "price[" + counter + "]"); price.setAttribute("width", "50px"); price.setAttribute("size", "5"); dojo.byId("moreInput").appendChild(price); var lineBreak = document.createElement("br"); dojo.byId("moreInput").appendChild(lineBreak); //Set total // dojo.byId("totalProducts").value = counter; } dojo.addOnLoad(function() { moreWidgets()}) custom js script-- When the function moreWidgets() is called, it is unable to create the filteringSelect widget. If I comment out the lines that create and append filteringSelect, the function works well. It also creates the other price and quantity elements when the filteringSelect lines are commented. But the script halts when the filteringSelect lines are uncommented. I get the message "root is null si = root.selectedIndex;file /js/dojo...mboBox.js (line 1051)" in firebug console. How do I get the script to create new element with filteringSelect widget? Any help is greatly appreciated.
[fw-general] How to dynamically create filteringSelect
Hello, I have a page in my application to create invoices. All the form elements are created by Zend_Form and few use Dojo widgets. For a handy "product" select list, I am using filteringSelect widget generated by Zend_Form_Dojo. [snippet of code to show how I am creating the form element] $productId = new Zend_Dojo_Form_Element_FilteringSelect('productName); $productId->setLabel('Product Name') ->setAutoComplete(true) ->setStoreId('productStore') ->setStoreType('dojo.data.ItemFileReadStore') ->setStoreParams(array('url'=>'/product/jsonlist')) ->setAttrib("searchAttr", "name"); [/snippet] This creates one input element with filteringSelect widget. I am fine till this point. There is a "more products" button on the page. When the user clicks on the button, another input element with filteringSelect widget should appear. This input element will also use JSON from the same URL and expects the user to select another product. The "more products" button should keep on generating more input elements with filteringSelect widget when clicked. How would you create the input fields with filteringSelect widgets dynamically in this situation? I presume, the store names have to be unique. Can you suggest the steps and the flow required to achieve this objective? Code snippets would be much appreciated. Regards, -- Sudheer Satyanarayana Binary Vibes Information Technologies Pvt. Ltd. Postal Address: #506, 10th B Main Road, I Block, Jayanagar, Bangalore – 560 011 URL : www.binaryvibes.co.in Phone: +91 80 41558451 * Mobile: +91 99005 07499 Community : http://lampcomputing.com
Re: [fw-general] Table problem
José de Menezes Soares Neto wrote: Friends, I have three tables: page page2tag tag page2tag just have page_id and tag_id relationship... how to build a query looking inside page, but merging the three tables? regards, josé Use joins. Zend_Db_Table_Select has methods to conveniently join tables. You could try something like: |$select = $db->select() ||>from( array('p' => 'page'), array('fieldname) ) ->join(array('pt'=>'page2tag'), 'on condition') -join(array('t'=>'tag'), 'on condition');| http://framework.zend.com/manual/en/zend.db.select.html Regards, -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Community http://lampcomputing.com, Personal: http://sudheer.net
Re: [fw-general] Use Zend without MVC
Alomon wrote: Hello, I will probably have to make a little PHP application and use a Framework, but I really do not think I will use MVC, as the application is for a local use and will be made up of only 4 pages. in fact, I do not personnaly think a Framework is useful, but my boss does :D Anyway, I did not manage to find any tutorial on how tu use Zend without MVC. It is the first time I will use a Framework, and it is not really easy, so I really want to begin with a tutorial, or a simple application. Could someone give me a link showing how to use Zend without MVC? Thank you in advance. I think you can use the Zend Framework reference manual minus MVC components and those that integrate with it. Regards, -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Community http://lampcomputing.com, Personal: http://sudheer.net
Re: [fw-general] Using the Dojo shipped with ZF 1.6.0 - Important Note
Fortunately, there is a solution: a better rewrite rule. The one presented below has been circulating around in a variety of places, and was in fact the reason I never saw the reported issues myself. Instead of relying on the file extension to determine whether or not to rewrite, it relies on file presence: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] Thanks for the update. I was thinking there was some issue with all the dojo builds I tried so far. -- With warm regards, Sudheer. S http://binaryvibes.co.in
Re: [fw-general] Inter-page messaging - How do I display information in my layout?
stav wrote: Ok, so the Flash Messages are working if I do a _redirect(), but I can't seem to display them if I do not redirect and, instead, only _forward(). Then the messages are not displayed until the next request. I can get around this, but I am curious as to why they do not show up even if I put the getMessages() in the postDispatch(): public function postDispatch() { $this->view->flash_messages = $this->_flashMessenger->getMessages(); See what happens when you do $this->view->flash_messages = $this->_flashMessenger->getCurrentMessages(); instead. parent::postDispatch(); } Shouldn't this capture the new messages in the editAction()? -- Sudheer Satyanarayana Binary Vibes Information Technologies Pvt. Ltd. Postal Address: #506, 10th B Main Road, I Block, Jayanagar, Bangalore – 560 011 URL : www.binaryvibes.co.in Phone: +91 80 41558451 * Mobile: +91 99005 07499 Community : http://lampcomputing.com
Re: [fw-general] Question about Zend_Dojo
Actually, if you're using SVN already for ZF, we *do* use svn:externals to pull in dojo -- you can see it in the exernals/dojo/ directory of the standard library. Right. I am using the same source (http://svn.dojotoolkit.org/src/branches/1.1) and it has the same "node not found" issue. Also http://svn.dojotoolkit.org/src/tags/release-1.1.1 does not work either. As mentioned, the dojo build system seems to add some code to the files that makes it work. Odd, as I've tested all the dijits against the externals previously. As I said, I'll continue to look into it. As it is, you can actually create your own builds using either the Dojo shipped with 1.6.0 or via externals. I'll post more information on how to do this soon. I had similar issues with svn:externals http://svn.dojotoolkit.org/src/tags/release-1.1.1 which I added in my SVN(not the one used in externals). DateTextBox was not working due a file missing in the cldr direcctory. So far, Zend_Dojo works well with the code locally added(downloaded from http://download.dojotoolkit.org/release-1.1.1/dojo-release-1.1.1-mini.tar.gz ). -- With warm regards, Sudheer. S http://binaryvibes.co.in
Re: [fw-general] How to access response object's insert method in action helper
First, I'm hoping this is just a snippet of one of your action helper's class methods, 'cause otherwise this won't work. That hint helped a lot. I had just dumped the code in the Action Helper script without using any classes or methods. Don't laugh. Second, when in your action helper, use: $this->getResponse() to get the response. Perfect. As for the issues you show below, they don't make sense, unless you're trying to execute the above code outside the MVC environment -- for instance, just to test the code out. I can't personally reproduce the issue currently, which makes me think it's contextual. I am bit concerned about the above comment. I do have the MVC environment. Just to be sure, I am posting the code in my controller, action, layout, view and action helper. Please advise whether the approach makes sense. -IndexController.php class IndexController extends Zend_Controller_Action { public function indexAction() { $this->view->pageTitle = "Zend Layout Example"; $this->view->bodyTitle = 'Hello World!'; $this->view->bodyCopy = "Lorem ipsum dolor etc."; } } -IndexController.php --Foo.php--Action Helper- class BV_Controller_Action_Helper_Foo extends Zend_Controller_Action_Helper_Abstract { function init() { $response = $this->getResponse(); $this->view = Zend_Layout::getMvcInstance()->getView(); $this->view->addScriptPath('../application/views/scripts'); Zend_Layout::startMvc(array('layoutPath' => '../application/views/layouts')); $response->insert('sidebar', $this->view->render('../layouts/region/sidebar.phtml')); $response->insert('main', $this->view->render('menu/main.phtml')); } } --Foo.php--Action Helper- -index.phtml---view script- bodyTitle ;?> bodyCopy ;?> -index.phtml---view script- -layout.phtmllayout script- render('menu/navigation.phtml'); ?> layout()->content ?> layout()->sidebar; ?> -layout.phtmllayout script- With the above code, I am trying to aggregate the various content items like sidebar, menu and navigation in the action helper. I want to be able to override them in the controller actions. I never thought you would go to the extent of trying to reproduce the issue. Thank you so much. :) Your action helper blog post on Zend devzone was also very useful. Regards, -- With warm regards, Sudheer. S http://binaryvibes.co.in
[fw-general] How to access response object's insert method in action helper
Hi, I followed the Zend_Layout example at http://akrabat.com/2007/12/11/simple-zend_layout-example/ There was no problem in setting up the layout at all. Instantiating the response object and accessing its insert method in the init() function of every controller is repetitious. Therefore, I try to push the code in the init() function of the controller to an action helper. I have an action helper foo. Below is the code in foo.php getResponse(); $response->insert('sidebar', $view->render('../layouts/region/sidebar.phtml')); $response->insert('main', $view->render('menu/main.phtml')); When I view the page, I get an error *Fatal error*: Call to a member function insert() on a non-object in *../BV/Controller/Action/Helper/Foo.php* on line *7 *Line 7 in Foo.php is $response->insert('sidebar', $view->render('../layouts/region/sidebar.phtml')); The error message indicates that I can't access the insert method of response object. Am I allowed to access the insert method of the response object in the action helper? If so, how? Regards, -- With warm regards, Sudheer. S http://binaryvibes.co.in
Re: [fw-general] url not found
mom_maj wrote: i am sorry that is my user controller : class UserController extends Zend_Controller_Action { public function indexAction() { } } ?> just that and i made his view What do you have in the view script? Remember to remove the closing ?> tag in your controller. Also post the contents of your .htaccess. Have you enabled mod_rewrite on your Apache webserver? Have you set AllowOverride to All for your Document_Root? You may also have to post the code in your bootstrap. -- With warm regards, Sudheer. S http://binaryvibes.co.in
Re: [fw-general] url not found
mom_maj wrote: Hi list start to use zendframework yesterday , when i use index controller every thing is ok but when i create another controller and use it gave me that error : Not Found The requested URL /test_zendframework/public/user was not found on this server. Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 PHP/5.2.3-1ubuntu6.4 Server at localhost Port 80 Can you post your UserController.php code? Have you set up the view script for UserController? -- With warm regards, Sudheer. S http://binaryvibes.co.in
Re: [fw-general] How to integrate a Dojo date picker to Zend_Form?
Matthew Weier O'Phinney wrote: -- Sudheer <[EMAIL PROTECTED]> wrote (on Sunday, 10 August 2008, 10:26 PM +0530): Has anybody written a tutor on how to integrate a Dojo date picker to Zend_Form? I followed the online Zend_Dojo_Form manual, but could not understand it enough to have a working date picker. Searching on the Internet for few hours wasn't useful either. I would like to see an example usage of a nice JavaScript date picker with Zend_Form, preferably with Dojo. In summary I would like to see the code that 1. Instructs the application to use a dojo CDN 2. Adds necessary js files to the HTML document 3. Creates the form element with drop down calendar date picker // in your application code: $element = new Zend_Dojo_Form_Element_DateTextBox('datepicker'); $view->element = $element; // In your view script: $this->dojo()->useCdn() // uses AOL CDN by default ->addStylesheetModule('dijit.tundra.tundra'); There was one small mistake in the above line. Maybe a typo. ->addStylesheetModule('dijit.themes.tundra'); This is just for the archive's sake so that somebody reading it can know the correct path. Thanks again for your help. :) echo $this->element; // In your layout script: dojo() ?> layout()->content ?> and that's all there is to it.
Re: [fw-general] How to integrate a Dojo date picker to Zend_Form?
Matthew Weier O'Phinney wrote: -- Sudheer <[EMAIL PROTECTED]> wrote (on Sunday, 10 August 2008, 10:26 PM +0530): Has anybody written a tutor on how to integrate a Dojo date picker to Zend_Form? I followed the online Zend_Dojo_Form manual, but could not understand it enough to have a working date picker. Searching on the Internet for few hours wasn't useful either. I would like to see an example usage of a nice JavaScript date picker with Zend_Form, preferably with Dojo. In summary I would like to see the code that 1. Instructs the application to use a dojo CDN 2. Adds necessary js files to the HTML document 3. Creates the form element with drop down calendar date picker // in your application code: $element = new Zend_Dojo_Form_Element_DateTextBox('datepicker'); $view->element = $element; // In your view script: $this->dojo()->useCdn() // uses AOL CDN by default ->addStylesheetModule('dijit.tundra.tundra'); echo $this->element; // In your layout script: dojo() ?> layout()->content ?> and that's all there is to it. Thank you very much, Matthew. I can now build on this. Regards, -- With warm regards, Sudheer. S http://binaryvibes.co.in
[fw-general] How to integrate a Dojo date picker to Zend_Form?
Hi, Has anybody written a tutor on how to integrate a Dojo date picker to Zend_Form? I followed the online Zend_Dojo_Form manual, but could not understand it enough to have a working date picker. Searching on the Internet for few hours wasn't useful either. I would like to see an example usage of a nice JavaScript date picker with Zend_Form, preferably with Dojo. In summary I would like to see the code that 1. Instructs the application to use a dojo CDN 2. Adds necessary js files to the HTML document 3. Creates the form element with drop down calendar date picker Regards, -- With warm regards, Sudheer. S http://binaryvibes.co.in
[fw-general] Zend_Form Array notation
Hello, I have come across a situation where I have to create form elements based on information stored in the database. For each value I want to create a checkbox form field element. Without Zend_Form I would do something like this: [snip] Email: Roles: fetchAll($sql); foreach ($result as $row) { $role = $row['name']; echo $role; echo "name=\"row[$role]\" value=\"set\" /> "; } ?> /> [/snip] How can I achieve the objective using Zend_Form? Specifically, I would like to know how to build form elements whose names are represented by arrays. I have read the subform section of the manual. But I'm unable to understand how to implement it in this situation. I would greatly appreciate if somebody can show an example. -- With warm regards, Sudheer. S http://binaryvibes.co.in
[fw-general] How to access current url in custom view helper?
Hello, I am trying to construct an HTML anchor link in my custom view helper. How can I know the current URL in the view helper? I tried to create a frontController instance and access the getBaseUrl method. I did not return anything. -- With warm regards, Sudheer. S http://binaryvibes.co.in
Re: [fw-general] How are you using Zend_Pdf?
Willie Alberty wrote: Kevin and I are about ready to introduce the comprehensive Zend_Pdf updates I described last week for community review and early testing. I am working on shoring up the documentation now and could use some feedback: In what ways are you are currently using Zend_Pdf? Hi Willy, I currently am not using Zend_Pdf. But I will be very soon. I am developing a CRM product using Zend Framework. I would like to use Zend_Pdf to generate quotes, invoices and reports. All these PDF documents generated by the application will be based on templates. Typical components of the PDF quote document would be * Company logo and slogan * Company address and contact details * Customer shipping and billing addresses * Table with serial number, products, quantity, amount and tax. The table will have subtotal and total on the last two rows. The columns on the last two rows are merged to remove empty cells. * Promotional information containing images and text with links to web pages * Quote and invoice status message displayed as big background image with dull colours It will be awesome if Zend_Pdf provides methods to build charts/graphs in the PDF document. These features help build PDF reports. I can even send you a sample PDF document, if you would like to see it. -- With warm regards, Sudheer. S http://binaryvibes.co.in
Re: [fw-general] Re: Zend_Form Array notation
Matthew Weier O'Phinney wrote: -- Sudheer <[EMAIL PROTECTED]> wrote (on Sunday, 03 August 2008, 03:44 PM +0530): Sudheer wrote: I did not receive a copy of this message from the list. I suspect a problem with my e-mail client. Apologies if you received this message twice. I have advanced a bit. I have encountered a problem with my new code. You can see the code and output here -> http://pastebin.ca/1091642 When I create checkbox form elements in the subform, it generates hidden fields. If I replace them with text fields, I get correct output and the hidden form fields vanish. HTML does not submit unfilled checkboxes in a form payload. As a result, forms with checkboxes either do not validate, or no value is returned for the checkbox elements. The hidden fields are present to ensure a value is _always_ passed for the checkbox, correcting this issue. What you're seeing is the intended behavior of Zend_Form. I was expecting the form to not return the unfilled checkboxes. Thus, I was worried with the hidden fields. :) I never expected this is the intended behaviour of Zend_Form. Although, this feature does not assist me in this situation, it sure is a good idea to have unfilled checkboxes return. Thank you very much. -- With warm regards, Sudheer. S http://binaryvibes.co.in
Re: [fw-general] Re: Zend_Form Array notation
Sudheer wrote: I did not receive a copy of this message from the list. I suspect a problem with my e-mail client. Apologies if you received this message twice. I have advanced a bit. I have encountered a problem with my new code. You can see the code and output here -> http://pastebin.ca/1091642 When I create checkbox form elements in the subform, it generates hidden fields. If I replace them with text fields, I get correct output and the hidden form fields vanish. I think the problem is with the following line of code: $role{$roleId} = $roleform->createElement('checkbox', $roleId) ->setLabel($roleName); Can somebody tell me why this is happening? What am I doing wrong? Regards, -- With warm regards, Sudheer. S http://binaryvibes.co.in
[fw-general] Re: Zend_Form Array notation
Sudheer wrote: Hello, I have come across a situation where I have to create form elements based on information stored in the database. For each value I want to create a checkbox form field element. Without Zend_Form I would do something like this: [snip] Email: Roles: fetchAll($sql); foreach ($result as $row) { $role = $row['name']; echo $role; echo "name=\"row[$role]\" value=\"set\" /> "; } ?>type="submit" name="submit" value="submit" /> [/snip] How can I achieve the objective using Zend_Form? Specifically, I would like to know how to build form elements whose names are represented by arrays. I have read the subform section of the manual. But I'm unable to understand how to implement it in this situation. I would greatly appreciate if somebody can show an example. I did not receive a copy of this message from the list. I suspect a problem with my e-mail client. Apologies if you received this message twice.
Re: [fw-general] LinkedIn Group
Karl Katzke wrote: Here's a direct link, I think... http://www.linkedin.com/pub/0/626/433 I just joined. :) -- With warm regards, Sudheer. S http://binaryvibes.co.in
Re: [fw-general] How to destroy a session
Sudheer wrote: xing93111 wrote: Hi, I create a default session namespace using: $s = new Zend_Session_Namespace(); How do I destroy it? Thanks |Looks like the answer is Zend_Session::namespaceUnset($a) Oops! Zend_Session::namespaceUnset($s) Regards, Sudheer |
Re: [fw-general] How to destroy a session
xing93111 wrote: Hi, I create a default session namespace using: $s = new Zend_Session_Namespace(); How do I destroy it? Thanks |Looks like the answer is Zend_Session::namespaceUnset($a) Regards, Sudheer |
Re: [fw-general] Question about pagination
Csányi András wrote: On Sun, Apr 06, 2008 at 11:41:18AM +0200, Csányi András wrote: On Sun, Mar 30, 2008 at 10:28:37PM -0700, thurting wrote: I've set up my model to handle pagination and had a question about how I should handle bad input. Suppose my url is constructed as controller/action/key/value and I am passing the user param 'page' to my ^^^ I was finding in the documentation in a last 2 hours! I remember this function but I dont know where is it and how work is it - I need some examples or something. Please somebody tell me where is it in the documentation :) Thank you! András I have find it. :) Could you post the link? Regards, Sudheer
[fw-general] Solved | Re: [fw-general] Help to implement a join query in Zend_Db
I was able to solve this with Juzzy's help on #zftalk. Apparently there was a column name clash in the query. Regards, Sudheer Jim Scherer wrote: I don't have the answer you seek, but maybe this can help get you on your way. If you: Thanks for your reply. echo $select->__toString(); That sure helps. I can at least see what query is being generated. You will see: SELECT `s`.`sid`, `s`.`name`, `s`.`status`, `r`.`rid`, `r`.`rdate`, `sc`.*, `c`.`name` FROM `student` AS `s` INNER JOIN `registration` AS `r` ON s.sid = r.sid INNER JOIN `student_course_interests` AS `sc` ON s.sid = sc.sid INNER JOIN `course` AS `c` ON c.cid = sc.cid the SQL that is being generated for you. You can place this after any $select statement to see step by step generated code. You also have the option of passing your select statement like this: $select = $db->query('select s.sid, s.name, r.rid, r.rdate, c.name, s.status from student as s, registration as r, student_course_interests as sc, course as c where s.sid=r.sid and s.sid=sc.sid and c.cid=sc.cid'); $result = $select->fetchAll(); I had tried this before. It changes the positions of the columns and the some columns are missing in the result. I hope a Zend_DB expert will chime. :) That's the best I can offer for now. Others surely know a lot more then I. Jim Regards, Sudheer
Re: [fw-general] Help to implement a join query in Zend_Db
Jim Scherer wrote: I don't have the answer you seek, but maybe this can help get you on your way. If you: Thanks for your reply. echo $select->__toString(); That sure helps. I can at least see what query is being generated. You will see: SELECT `s`.`sid`, `s`.`name`, `s`.`status`, `r`.`rid`, `r`.`rdate`, `sc`.*, `c`.`name` FROM `student` AS `s` INNER JOIN `registration` AS `r` ON s.sid = r.sid INNER JOIN `student_course_interests` AS `sc` ON s.sid = sc.sid INNER JOIN `course` AS `c` ON c.cid = sc.cid the SQL that is being generated for you. You can place this after any $select statement to see step by step generated code. You also have the option of passing your select statement like this: $select = $db->query('select s.sid, s.name, r.rid, r.rdate, c.name, s.status from student as s, registration as r, student_course_interests as sc, course as c where s.sid=r.sid and s.sid=sc.sid and c.cid=sc.cid'); $result = $select->fetchAll(); I had tried this before. It changes the positions of the columns and the some columns are missing in the result. I hope a Zend_DB expert will chime. :) That's the best I can offer for now. Others surely know a lot more then I. Jim Regards, Sudheer
[fw-general] Help to implement a join query in Zend_Db
Hello experts, I am trying to implement a MySQL query with Zend_DB. The query is: select s.sid, s.name, r.rid, r.rdate, c.name, s.status from student as s, registration as r, student_course_interests as sc, course as c where s.sid=r.sid and s.sid=sc.sid and c.cid=sc.cid When I execute this query in the MySQL client, I get the desired result. I tried various types of queries with ZF. I don't understand why Zend_DB changes the column positions. The below query doesn't seem to select s.name at all. [code] $select = $db->select(); $select->from(array('s' => 'student'), array('s.sid','s.name','s.status')); $select->join(array('r' => 'registration'), 's.sid = r.sid', array('r.rid','r.rdate')); $select->join(array('sc' => 'student_course_interests'), 's.sid = sc.sid'); $select->join(array('c' => 'course'), 'c.cid = sc.cid', array('c.name')); $result = $db->fetchAll($select); [/code] How can I fix this? Any help is greatly appreciated. Regards, Sudheer