Re: [fw-general] Help me with ZF2 routing?
If your problem is the child route taking precedence, you should consider adding a priority key and set it to a high value. Op 21 mei 2014, om 00:31 heeft Jamie Krasnoo jkras...@gmail.com het volgende geschreven: Hi All, I've attached what I've done for the config of my Admin module. I can't seem to get my head around the routing yet. I've taken the Application config and made it generic so I can get a good start. What I'd like to do is route /admin/login to the login action of the Auth Controller. However it seems that the child route overrides everything and I'm getting a 404 error saying that the Admin/Controller/Login resolves to an invalid controller class or alias. I've found a few helpful things looking through the list but not enough. Jamie module.config.php -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [fw-general] [ZF1] Error with Zend_Rest_Server when set a class that extends Zend_Db_Table
You should inspect the parent find method to see if it has a 'wrong' docblock. This seems to be the cause. If that is the case, can it be fixed? If it can be fixed, please let us know. -Bart Op 11 feb. 2013, om 12:28 heeft Razorblade kaiohken1...@hotmail.com het volgende geschreven: Hi All, as the title, I get this error when setting a Zend_Db_Table's type class with Zend_Rest_Server. Tested with ZF 1.12.1 This is the error: object(Zend_Server_Reflection_Exception)#782 (8) { [_previous:Zend_Exception:private] = NULL [message:protected] = string(224) Variable number of arguments is not supported for services (except optional parameters). Number of function arguments in Zend_Db_Table_Abstract::find() must correspond to actual number of arguments described in the docblock. [string:Exception:private] = string(0) [code:protected] = int(0) [file:protected] = string(124) path\to\project\vendor\zendframework\zendframework1\library\Zend\Server\Reflection\Function\Abstract.php [line:protected] = int(350) [trace:Exception:private] = array(11) { [0] = array(6) { [file] = string(113) path\to\project\vendor\zendframework\zendframework1\library\Zend\Server\Reflection\Method.php [line] = int(83) [function] = string(8) _reflect [class] = string(40) Zend_Server_Reflection_Function_Abstract [type] = string(2) - [args] = array(0) { } } [1] = array(6) { [file] = string(112) path\to\project\vendor\zendframework\zendframework1\library\Zend\Server\Reflection\Class.php [line] = int(90) [function] = string(11) __construct [class] = string(29) Zend_Server_Reflection_Method [type] = string(2) - [args] = array(4) { [...] This is the code to reproduce this error: $this-server = new Zend_Rest_Server(); $this-server-setClass(ClassName); // Class ClassName will extends Zend_Db_Table If ClassName have 'find()' method overridden it will work. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF1-Error-with-Zend-Rest-Server-when-set-a-class-that-extends-Zend-Db-Table-tp4659118.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Fwd: [fw-general] Successfully Created View Helper In Application.ini / Unsuccessful in Bootstrap
Begin doorgestuurd bericht: Van: Bart McLeod mcl...@spaceweb.nl Onderwerp: Antw.: [fw-general] Successfully Created View Helper In Application.ini / Unsuccessful in Bootstrap Datum: 18 januari 2013 20:32:32 CET Aan: i_banks bigbank...@gmail.com Hi, In the bootstrap, you omitted the second argument to addHelperPath(), the prefix 'App_View_Helper_', which you do *do* specify in application.ini. That's why application.ini works and your bootstrap doesn't. -Bart Op 18 jan. 2013, om 19:32 heeft i_banks bigbank...@gmail.com het volgende geschreven: Hello Zend Community. I'm using ZF 1.12. I'm trying to find out what I'm doing wrong in my Bootstrap file in creating a View Helper. I want the view helper to be available throughout the site. So I created a folder in my library: /library/App/View/Helper// The class method is a one that calls the appropriate helper based on the argument passed to it. So all of the helpers are in the same location (the path mentioned above). Now as I stated in the Subject line, my application.ini file worked. It's just the Bootstrap that doesn't. Here's what I used for both: *application.ini* resources.view[]= resources.view.helperPath.App_View_Helper_ = APPLICATION_PATH /../library/App/View/Helper/ *Bootstrap.php* protected function _initView() { //Initialize view $view = new Zend_View(); //add custom view helper path $view-addHelperPath(APPLICATION_PATH . '/../library/App/View/Helper'); //do more stuff if needed //add it to the view renderer $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper( 'ViewRenderer'); $viewRenderer-setView($view); //Return it, so that it can be stored by the bootstrap return $view; } Any thoughts? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Successfully-Created-View-Helper-In-Application-ini-Unsuccessful-in-Bootstrap-tp4658785.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Re: can't load classes in Zend_Framework 1.12.1 but worked 1.11.2 and previous versions
My guess is that backporting autoloaders from ZF 2 might have caused this. -Bart Op 16 jan. 2013, om 14:16 heeft Oleg_201080 opp20071...@gmail.com het volgende geschreven: Does anybody know what change it 1.12 that code and configuration that worked in earlier versions stopped working? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/can-t-load-classes-in-Zend-Framework-1-12-1-but-worked-1-11-2-and-previous-versions-tp4658753p4658764.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] ZF2 Documentation
like "Who needs this? This is just a mess." I felt lost. Around 1.6 I had another stab at it. Felt lost once again. Slowly, I ploughed through it. 1.7, 1.8... and the rest is history. :) Then ZF2 alphas, betas, RCs came out. Then stable. I was lost, once again. Frustrated with that (and some other things as well), I wanted to quickly port my ZF1 based blog to ZF2. And then I remembered how I felt when I learned ZF1 and that eventually I *did* learn it. And I'm confident that the same will happen with ZF2. I'm a fairly smart guy, I can learn it. Granted, it will take time, but it's my own time I invest, into my own knowledge. The gist of this little trip down memory lane, is that, in my opinion, don't expect to get the hang of it fast (where fast being days or weeks). Don't rage quit after a day or two just because some stiff prick called Robert didn't get to updating that piece of documentation. The ZF2 community and it's knowledge is still fresh, new. Yes, we'd all wish it would be at the level where ZF1 is at (it's what, 6-7 years old now?), but we (we, the community), still have to learn, together, to teach and to be taught, how to use the new MVC, the voodoo that is the EventManager, the Service locators, managers and what-have-yous. What I want to say with all this is - have patience, don't get frustrated, and You *will* get there. Honest! If not, beer's on me ;) Regards, Robert -- Bart McLeod Space Web Middenlaan 47 6869 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] Re: Mocking in zf2 is not such easy
Hi all, I think unit testing controllers can be tedious. It depends on your case if there is added value. For example: if you have a lot of custom routes configured, if these are covered by unit test you will ensure that these are getting dispatched correctly during the lifetime of your application. Ruby on Rails? If you like it, you should use it. I can't speak for it, because I never tried. ZF2 offers a lot of flexibility and that flexibility comes at a price, for sure. -Bart Op 11-10-12 08:29, Christian Soronellas schreef: Hi Pablo, To unit test a controller is a waste of time. A functional test may report you more value in this case :) Cheers! Christian. 2012/10/11 pablofmorales pablofmora...@gmail.com Yes, I can change the way I set Models, but is not enough. ZendSkeletonModule must have the correct way, thats why we use ZF2. Check this http://devblog.x2k.co.uk/getting-the-servicemanager-into-the-test-environment-and-dependency-injection/ You must have to write a lot of code to get a simple test, and ZF must abstract to you of all of these code, in this case is more easier to write unit test without zf2, wich with it, and is insane. If we check how many line you need to write for a simple route, and you can get the same results in Ruby on rails with just one line, you start to think, if ZF2 a good framework? And is the same for other stuff like unit test, modules, config files, dependency container, etc. Pablo Morales blog: http://blog.pablo-morales.com linkedln: http://www.linkedin.com/pub/9/528/21 skype: pablofmorales gtalk: pablofmora...@gmail.com msn: pfm...@hotmail.com On Wed, Oct 10, 2012 at 5:59 PM, luk [via Zend Framework Community] ml-node+s634137n465747...@n4.nabble.com wrote: pablofmorales wrote I trying to use baby steps with ZF2, but I found several issues. In the first instance I can't run my phpunit test case because this error https://github.com/timdev/ZendSkeletonModule/commit/52c71b8d5f6497c822c5a0f3b2b172af5b16016c I use ZendSkeletonModule, with this fix I continue, but the problem is when I try to mock a model, in the controller. In the example here http://framework.zend.com/manual/2.0/en/user-guide/database-and-models.html we configure the module indicating the name of the class, and namespaces, how I can mock this object? The only way, I supuse, is using DI, but why you don't use a good example in the first time? I would like to know if exists a module example well done, with TDD. Pablo Morales blog: http://blog.pablo-morales.com linkedln: http://www.linkedin.com/pub/9/528/21 skype: pablofmorales gtalk: [hidden email] msn: [hidden email] -- List: [hidden email] Info: http://framework.zend.com/archives Unsubscribe: [hidden email] I recommend you to read here on TDD with ZF2 (courtesy by Tom Oram): http://devblog.x2k.co.uk/ Cheers, -- Luke Mierzwa If you reply to this email, your message will be added to the discussion below: http://zend-framework-community.634137.n4.nabble.com/Mocking-in-zf2-is-not-such-easy-tp4657469p4657475.html To start a new topic under Zend Framework, email ml-node+s634137n634138...@n4.nabble.com To unsubscribe from Zend Framework Community, click here. NAML - http://blog.pablo-morales.com Zend PHP 5.3 Certified -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Mocking-in-zf2-is-not-such-easy-tp4657469p4657479.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Bart McLeod Space Web Middenlaan 47 6869 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] controller configurations do not get merged as expected THIS IS ZF2
I doesn't seem to be as simple that the last one wins. I have the same problem with a view helper config in the article module, but if I configure the invokable with the last module (CfFrontend), that does not help. -Bart Op 30-06-12 07:50, Bart McLeod schreef: Sorry, forget to mention ZF2 Op 30-06-12 07:49, Bart McLeod schreef: Hi all, What I am trying to do is pretty simple, and I can get it to work, but I encounter unexpected things along the road. For example, I have a CfFrontend module and a CfArticle module. Both have controllers. CfFrontend is at http://zf2/ CfArticle is at http://zf2/article These two routes work, and they are configured in the respective module.config.php files of each module. Now two strange things happen: 1. If a controller has an alias in the route configuration (i.e. NOT a class name), and it has an 'invokables' key in the 'controllers' configuration section with a key for the alias, it is not loaded. Examples later in this mail. However, if instead of 'invokables', 'factories' is used (with a valid factory for the alias) then it does work. 2. If in the second ('article') module we use the same setup with a valid factory, the controller is not found. It seems the factories are not stacked (not merged correctly). The last one loaded takes precedence. The last module in the application.config.php wins. Examples: module.config.php for 'CfArticle' return array( 'router' = array( 'routes' = array( 'cf-article' = array( 'type' = 'Literal', 'options' = array( 'route' = '/article', 'defaults' = array( //'controller' = 'article', // factories don't work here, incorrect merge? 'controller' = 'CfArticle\Controller\ArticleController', 'action' = 'index', ), ), ), ), ), 'controller' = array( 'factories' = array( // using invokables is not possible here, only directly in route 'article' = 'CfArticle\Controller\ControllerFactory', // Does only work for last module loaded ), ), ); module.config.php for CfFrontend (last one loaded: wins) return array( 'router' = array( 'routes' = array( 'cf-frontend' = array( 'type' = 'Literal', 'options' = array( 'route' = '/', 'defaults' = array( 'controller' = 'frontend', // works 'action' = 'index', ), ), ), ), ), 'controller' = array( // works 'factories' = array( // using invokables is not possible here, only directly in route 'frontend' = 'CfFrontend\Controller\ControllerFactory', ), 'invokables' = array( // does not work, not even if 'factories' is gone, just here as an example 'frontend' = 'CfFronted\Controller\FrontendController', ), ), ); Anyone any ideas, are these bugs I should fix? -Bart -- Bart McLeod Space Web Middenlaan 47 6869 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify! -- Bart McLeod Space Web Middenlaan 47 6869 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] howto set radio button checked in config.ini
Hi Mike, The list isn't as active as it used to be when ZF1 first started. I am not sure why, but it seems to me that #zftalk on freenode is the place to go when looking for immediate help from community members. You'll find it on zftalk.com - Bart Op 29-06-12 22:51, Mike Wright schreef: On 06/29/2012 12:06 PM, Mike Wright wrote: Hi all, Using zf-1.11 I have a form defined in a config.ini file and have added an example radio button whose definition follows. elements.color.type = "radio" elements.color.options.label = "Select a Color" elements.color.options.multiOptions.red = "Red" elements.color.options.multiOptions.green = "Green" elements.color.options.multiOptions.yellow = "Yellow" Let's say I want "Red" to be the default. What do I have to do to add checked='checked' for that button? Finally found this solution in a post from MWO'P, Feb 18, 2008, 4:31am Re: MultiCheckbox on config files - Zend_Form substituting gives 'elements.color.options.value.red = "red"' Not particularly intuitive but elegant and does produce the 'checked="checked"' markup correctly. Took about 4 hours to find the answer; nonetheless, sorry for the noise and thanks for the tachyon response. -- Bart McLeod Space Web Middenlaan 47 6869 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
[fw-general] controller configurations do not get merged as expected
Hi all, What I am trying to do is pretty simple, and I can get it to work, but I encounter unexpected things along the road. For example, I have a CfFrontend module and a CfArticle module. Both have controllers. CfFrontend is at http://zf2/ CfArticle is at http://zf2/article These two routes work, and they are configured in the respective module.config.php files of each module. Now two strange things happen: 1. If a controller has an alias in the route configuration (i.e. NOT a class name), and it has an 'invokables' key in the 'controllers' configuration section with a key for the alias, it is not loaded. Examples later in this mail. However, if instead of 'invokables', 'factories' is used (with a valid factory for the alias) then it does work. 2. If in the second ('article') module we use the same setup with a valid factory, the controller is not found. It seems the factories are not stacked (not merged correctly). The last one loaded takes precedence. The last module in the application.config.php wins. Examples: module.config.php for 'CfArticle' return array( 'router' = array( 'routes' = array( 'cf-article' = array( 'type' = 'Literal', 'options' = array( 'route'= '/article', 'defaults' = array( //'controller' = 'article', // factories don't work here, incorrect merge? 'controller' = 'CfArticle\Controller\ArticleController', 'action' = 'index', ), ), ), ), ), 'controller' = array( 'factories' = array( // using invokables is not possible here, only directly in route 'article' = 'CfArticle\Controller\ControllerFactory', // Does only work for last module loaded ), ), ); module.config.php for CfFrontend (last one loaded: wins) return array( 'router' = array( 'routes' = array( 'cf-frontend' = array( 'type' = 'Literal', 'options' = array( 'route'= '/', 'defaults' = array( 'controller' = 'frontend', // works 'action' = 'index', ), ), ), ), ), 'controller' = array( // works 'factories' = array( // using invokables is not possible here, only directly in route 'frontend' = 'CfFrontend\Controller\ControllerFactory', ), 'invokables' = array( // does not work, not even if 'factories' is gone, just here as an example 'frontend' = 'CfFronted\Controller\FrontendController', ), ), ); Anyone any ideas, are these bugs I should fix? -Bart -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] controller configurations do not get merged as expected THIS IS ZF2
Sorry, forget to mention ZF2 Op 30-06-12 07:49, Bart McLeod schreef: Hi all, What I am trying to do is pretty simple, and I can get it to work, but I encounter unexpected things along the road. For example, I have a CfFrontend module and a CfArticle module. Both have controllers. CfFrontend is at http://zf2/ CfArticle is at http://zf2/article These two routes work, and they are configured in the respective module.config.php files of each module. Now two strange things happen: 1. If a controller has an alias in the route configuration (i.e. NOT a class name), and it has an 'invokables' key in the 'controllers' configuration section with a key for the alias, it is not loaded. Examples later in this mail. However, if instead of 'invokables', 'factories' is used (with a valid factory for the alias) then it does work. 2. If in the second ('article') module we use the same setup with a valid factory, the controller is not found. It seems the factories are not stacked (not merged correctly). The last one loaded takes precedence. The last module in the application.config.php wins. Examples: module.config.php for 'CfArticle' return array( 'router' = array( 'routes' = array( 'cf-article' = array( 'type' = 'Literal', 'options' = array( 'route' = '/article', 'defaults' = array( //'controller' = 'article', // factories don't work here, incorrect merge? 'controller' = 'CfArticle\Controller\ArticleController', 'action' = 'index', ), ), ), ), ), 'controller' = array( 'factories' = array( // using invokables is not possible here, only directly in route 'article' = 'CfArticle\Controller\ControllerFactory', // Does only work for last module loaded ), ), ); module.config.php for CfFrontend (last one loaded: wins) return array( 'router' = array( 'routes' = array( 'cf-frontend' = array( 'type' = 'Literal', 'options' = array( 'route' = '/', 'defaults' = array( 'controller' = 'frontend', // works 'action' = 'index', ), ), ), ), ), 'controller' = array( // works 'factories' = array( // using invokables is not possible here, only directly in route 'frontend' = 'CfFrontend\Controller\ControllerFactory', ), 'invokables' = array( // does not work, not even if 'factories' is gone, just here as an example 'frontend' = 'CfFronted\Controller\FrontendController', ), ), ); Anyone any ideas, are these bugs I should fix? -Bart -- Bart McLeod Space Web Middenlaan 47 6869 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] ZF2 Modules
You will probably have to look for an alias in your class loader or just some mapping. Did you install using composer? If you did not, you may have to edit the autoloader config, so that it has an empty classmap, just to get you started. -Bart Op 16-06-12 00:35, Steve Rayner schreef: Thanks Matthew, it's starting to make sense. I'm getting this error; Unable to locate class associated with "zfcuserauthentication" I see this was an issue around three months ago, but any discussions i find seem to indicate it was fixed so i assume my problem is something i have done wrong. should i post any of my code here? On Fri, Jun 15, 2012 at 2:59 PM, Matthew Weier O'Phinney matt...@zend.com wrote: -- Steve Rayner srayne...@googlemail.com wrote (on Friday, 15 June 2012, 07:53 AM +0100): I see there is a module called zfc-user, with a sub-module for using doctrine orm. I'm new to ZF2 and the concept of modules (i didn't use them in zf1). ZF2 seems to have quite a complicated folder structure, that looks well thought out. I'm using composer, so I've added the required dependencies, done an update and it looks like everything i need has been downloaded into the vendor folder (and sub-folders). Now i'm lost. What's my next step? Enable the module in config/application.config.php: 'modules' = array( 'Application', 'ZfcUser', /* ... etc. ... */ ), We've added a step of explicitly enabling modules here. The reason for this is because it allows you to have a central "repository" of modules that you can selectively choose from. A good example is, for instance, if you're a client shop and host for your clients; instead of having module installations per client project, you could have a single location, and selectively enable the modules you need for a given project. Additionally, it allows you to toggle modules on and off when desired; I've done this in the past to determine what modules may or may not have been causing issues for the site I was working on. I thought the concept of modules was that it would drop a module into my application that i could use, but it apears not. Is my next step to create my own module that makes use of the stuff in the vendor folders, or does the module live under the vendor folder and i have to config my application to use it. Typically, once you've enabled the module, you will likely need to do some configuration -- it really depends on the module. For instance, my PhlyContact module will basically work "out-of-the-box" -- but it assumes Sendmail as the mail transport, and the "Dumb" captcha adapter -- neither of which is likely what you want. Thus, you configure the module to suit your site's needs. Similarly with ZfcUser, you need to configure a database connection at minimum, and potentially some other options -- all of which are documented in its README.md file. So, while modules are mostly "plug and play", they will often benefit from configuration. -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com -- Bart McLeod Space Web Middenlaan 47 6869 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] ZF website, with /blog/ subfolder for Wordpress - how to integrate WP with my website
Hi Rishi, I know a little about WordPress and a little about ZendFramework, but if I were you I would not mix their code, or at least I would not mix WP code into your ZF application code. I would just load a WordPress template inside your ZF template using curl for example. So you just create the templates you need on the WP side, just as you normally would for a WP site, but without the head and body of the html, just render an HTML snippet. Then in your ZF template you read that using file_get_contents or curl and echo it out. In your request to your WP blog, you can add all of the parameters needed to get the desired language out. Try to think of WP as an API that gives you certain HTML based on certain parameters. Don't mix the code. Just my 2 cents. -Bart Op 10-06-12 14:44, Rishi Daryanani schreef: Hi, I've researched online (still researching) but would like to some help from the Zend Framework community please :) We've built an e-commerce website with Zend Framework (with Postgresql), and the client has a separate /blog/ directory holding Wordpress (and a separate Mysql database). The client now wants us to load some of the WP feeds into the main website, for example the top 3 feeds under their "Latest news" page on the main ZF site. 1) This is quite easy with Wordpress, following the below article. http://codex.wordpress.org/Integrating_Wordpress_with_Your_Website However, researching online and trying it for myself, it seems like the best (or only) to include the core WP file (wp-blog-header.php) is by including it in bootstrap.php or index.php (i.e. before the ZF application runs). e.g. http://www.squidgle.com/post/7 I'm just wondering, is this what everyone is doing? It seems unnecessary as I only need to include the wp-blog-header.php file on certain pages, so this could slow our site down unnecessarily when not needed. I have a special Wordpress model mapper to fetch the data using WP functions, but I can't actually include the header file in the model because it is within a function (errors are thrown if I do this). 2) Even if the above is the only solution, has anyone done this for "Multisites" ? Our site has several languages and we need Wordpress to also be available in those languages, so the best solution seems like to use http://codex.wordpress.org/Create_A_Network - a Network of sites such as ourdomain.com/blog/ - for the UK version - and ourdomain.com/blog/de/ - for the German version, etc. However, the above Wordpress link (http://codex.wordpress.org/Integrating_Wordpress_with_Your_Website) says "These directions will not work on a MultiSite Network.", but offers no solution to actually make it work. So it looks like I'm stuck. I've can see that people have been asking about this online but I'm just wondering if anyone here has done this, specifically to get the English Wordpress posts for the English main ZF site, and the German WP posts for the German ZF site, etc. Any help would be appreciated. I'll also try the WP forums but would love some feedback here.. Many thanks, Rishi -- Bart McLeod Space Web Middenlaan 47 6869 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] Fixing Zend_Db_Statement::_stripQuoted() seg-faults on large SQL strings in ZF 1.x
OK, Let me follow up with the details in case you are interested to contribute by testing the fix on your system against your database. This is important, we need all the help we can get! I can reproduce issue ZF-5063 with the following code: $db = Zend_Db_Table::getDefaultAdapter(); $value = str_repeat('a', 66000) . 'x'; // 66,000 times an 'a' with an 'x' appended to it, to identify the end. $query = "INSERT INTO `pcre` (`test`) VALUES ('$value')"; In my case, the default adapter was mysql and I am on a 64bit system. You might get a segmentation fault from this, which you can see in you apache error log. The code snippet was inside a controller action of a default Zend Framework project (see the full code below). To reproduce with this code, you need a database connection and a table named 'pcre' with a field named 'test' (of type LONG_TEXT in mysql). In my case, this was the only field. **Fix the segfault in case you get it** In case you also reproduce the segfault, you can add a setting to php.ini to modify the behavior of the PCRE library, that is causing the segfault: [PCRE] pcre.recursion_limit = 1000 If you set this, the segfault should dissapear. The default pcre.recursion_limit = 10, which is too high, apparently. If you set it to a value that is simply to low, you will get many errors accross many components. If you have or get idea's on what an optimum default setting would be, please let us know. Instead of the segfault, you will either get a memory_limit error, which is ok, since you can increase the memory_limit if you need to, or you will get a database error because you query exceeds the maximum size, in case that is too low. You can play with how much you allow as the maximum packet size for your database and the memory_limit in php, but in the end, it is important that **you do no longer get the segmentation fault**. If you don't and you did before, you have found a working setting for pcre.recursion_limit. The query above is a very simple query. We would like to know if real life queries that previously caused a segfault, will work now, with the new implementation and optionally a different recursion_limit on PCRE. I intend to change the current implementation of Zend_Db_Statement so that it sets a sensible default for pcre.recursion_limit at runtime and restores the original limit afterwards. In addition, I would like to make this configurable through the adapter configuration, so that you can change the default if it not right for a specific use case you may have. **Full controller code:** /** * DbController */ class DbController extends Zend_Controller_Action { // http://localhost/db/st public function stAction() { $db = Zend_Db_Table::getDefaultAdapter(); $value = str_repeat('a', 66000) . 'x'; $query = "INSERT INTO `pcre` (`test`) VALUES ('$value')"; $this-view-query = $query; } } Op 21-05-12 15:59, Ralph Schindler schreef: Hi all, In the past we've been reluctant to solve an issue inside Zend_Db_Statement::_stripQuoted() that caused PHP's PCRE to seg-fault and crash. http://framework.zend.com/issues/browse/ZF-5063 http://framework.zend.com/issues/browse/ZF-10209 We've been reluctant for a number of reasons: * the problem is not directly in ZF, but in PHP's PCRE * the problem is only exposed on certain architectures * fixing the problem might cause unintended BC issues That said, given the amount of research a number of contributors have put into the matter, primarily by Bart McLeod, we feel comfortable moving forward with this fix for ZF 1.12 as it gives developers some flexibility in avoiding the problem, and the fix is fairly well tested against BC issues. I will let Bart get into the complexities of the fix, but I would like everyone to test what is currently in _trunk_ if you have large SQL that is being passed through Zend_Db. Thanks! Ralph Schindler -- Bart McLeod Space Web Middenlaan 47 6869 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zen
Re: [fw-general] Fixing Zend_Db_Statement::_stripQuoted() seg-faults on large SQL strings in ZF 1.x
I just noticed I omitted one essential line in the reproduction code: $db = Zend_Db_Table::getDefaultAdapter(); $value = str_repeat('a', 66000) . 'x'; $query = "INSERT INTO `pcre` (`test`) VALUES ('$value')"; $this-view-query = $query; var_dump($db-query($query)); // added this line, that actually triggers the segfault, if it exists Op 21-05-12 16:42, Bart McLeod schreef: OK, Let me follow up with the details in case you are interested to contribute by testing the fix on your system against your database. This is important, we need all the help we can get! I can reproduce issue ZF-5063 with the following code: $db = Zend_Db_Table::getDefaultAdapter(); $value = str_repeat('a', 66000) . 'x'; // 66,000 times an 'a' with an 'x' appended to it, to identify the end. $query = "INSERT INTO `pcre` (`test`) VALUES ('$value')"; In my case, the default adapter was mysql and I am on a 64bit system. You might get a segmentation fault from this, which you can see in you apache error log. The code snippet was inside a controller action of a default Zend Framework project (see the full code below). To reproduce with this code, you need a database connection and a table named 'pcre' with a field named 'test' (of type LONG_TEXT in mysql). In my case, this was the only field. **Fix the segfault in case you get it** In case you also reproduce the segfault, you can add a setting to php.ini to modify the behavior of the PCRE library, that is causing the segfault: [PCRE] pcre.recursion_limit = 1000 If you set this, the segfault should dissapear. The default pcre.recursion_limit = 10, which is too high, apparently. If you set it to a value that is simply to low, you will get many errors accross many components. If you have or get idea's on what an optimum default setting would be, please let us know. Instead of the segfault, you will either get a memory_limit error, which is ok, since you can increase the memory_limit if you need to, or you will get a database error because you query exceeds the maximum size, in case that is too low. You can play with how much you allow as the maximum packet size for your database and the memory_limit in php, but in the end, it is important that **you do no longer get the segmentation fault**. If you don't and you did before, you have found a working setting for pcre.recursion_limit. The query above is a very simple query. We would like to know if real life queries that previously caused a segfault, will work now, with the new implementation and optionally a different recursion_limit on PCRE. I intend to change the current implementation of Zend_Db_Statement so that it sets a sensible default for pcre.recursion_limit at runtime and restores the original limit afterwards. In addition, I would like to make this configurable through the adapter configuration, so that you can change the default if it not right for a specific use case you may have. **Full controller code:** /** * DbController */ class DbController extends Zend_Controller_Action { // http://localhost/db/st public function stAction() { $db = Zend_Db_Table::getDefaultAdapter(); $value = str_repeat('a', 66000) . 'x'; $query = "INSERT INTO `pcre` (`test`) VALUES ('$value')"; $this-view-query = $query; } } Op 21-05-12 15:59, Ralph Schindler schreef: Hi all, In the past we've been reluctant to solve an issue inside Zend_Db_Statement::_stripQuoted() that caused PHP's PCRE to seg-fault and crash. http://framework.zend.com/issues/browse/ZF-5063 http://framework.zend.com/issues/browse/ZF-10209 We've been reluctant for a number of reasons: * the problem is not directly in ZF, but in PHP's PCRE * the problem is only exposed on certain architectures * fixing the problem might cause unintended BC issues That said, given the amount of research a number of contributors have put into the matter, primarily by Bart McLeod, we feel comfortable moving forward with this fix for ZF 1.12 as it gives developers some flexibility in avoiding the problem, and the fix is fairly well tested against BC issues. I will let Bart get into the complexities of the fix, but I would like everyone to test what is currently in _tr
Re: AW: [fw-general] Zend_Form_Element_File
Ah I see, Sorry, I should have read your mail more carefully. It looks like Zend_Validate_File_Upload doesn't take your validator for size into account when generating the message. This would mean there is a bug, or the way you 'fixed' it could also be a documentated way to go. Could you search in the issuetracker to see if you can find an issue that describes this behavior? If so, I would be happy to fix that. If you do not find such an issue, please create one. -Bart Op 14-12-11 09:18, Marc Tempelmeier schreef: Hi, yes, sorry, I meant I want to change that message. Is the correct approach to set the php.ini higher than the Zend_Validate_File_FilesSize? Seems strange to me. I fixed it with adding $vFileUpload = new Zend_Validate_File_Upload(); $vFileUpload-setMessage('my own personal message', 'fileUploadErrorIniSize'); to the file element. Marc -Ursprüngliche Nachricht- Von: Bart McLeod [mailto:mcl...@spaceweb.nl] Gesendet: Mittwoch, 14. Dezember 2011 09:05 An: fw-general@lists.zend.com Betreff: Re: [fw-general] Zend_Form_Element_File Hi Marc, i´ll get the validation error: File 'file' exceeds the defined ini size. Isn't that expected behavior? I suppose you should change the php.ini setting to the desired value. -Bart Op 13-12-11 15:10, Marc Tempelmeier schreef: Hi, I want to build an upload form, everything works but if I´ll upload files greater than the php.ini i´ll get the validation error: File 'file' exceeds the defined ini size. I added Zend_Validate_File_FilesSize with custom error messages, but the error is still there. It is generated in Zend_Validate_File_Upload. Any suggestions? Greetings from Germany Marc -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Zend_Form_Element_File
Hi Marc, i´ll get the validation error: File 'file' exceeds the defined ini size. Isn't that expected behavior? I suppose you should change the php.ini setting to the desired value. -Bart Op 13-12-11 15:10, Marc Tempelmeier schreef: Hi, I want to build an upload form, everything works but if I´ll upload files greater than the php.ini i´ll get the validation error: File 'file' exceeds the defined ini size. I added Zend_Validate_File_FilesSize with custom error messages, but the error is still there. It is generated in Zend_Validate_File_Upload. Any suggestions? Greetings from Germany Marc -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Re: Allowed memory size exhausted
Op 29-07-11 09:38, metalmini schreef: Wow that are alot of replys :-) Anyway i am using version: 1.9.5 And before everybody starts screaming about that, this project was handed to me and i knew (know even) nothing about zend framework. I meant a trace file but i also got an cachegrind file which is about 170mb big... I did an edit of php.ini to 512 mb but this still generates the problem. I am not using an mssql database but i do use the excel generator. But this is used on different parts of the application. I dont think that it has anything to do with it. I cannot be sure of course, but what if you just turned off the excel generator? I told you about PHPExcel, because I experienced a problem like you are having with exactly that component. It is also possible to watch your system performance using your systems monitoring feature, to see the memory consumption increase while the script runs. Maybe that can shed some light on what it happening. PHPExcel remains my best guess. I tried to use the https://gist.github.com/628803 helper script for analyzing the output of a PHP xdebug code trace But it outputs nothing :-( [root@web01 tmp]# php trace.php trace.2043925204.xt memory-own 20 PHP Warning: Module 'xdebug' already loaded in Unknown on line 0 parsing... ( 2.26%) ( 5.12%) ( 7.54%) ( 9.95%) (12.37%) (14.78%) (17.20%) (19.62%) (22.03%) (24.45%) (26.86%) (29.28%) (31.70%) (34.11%) (36.53%) (38.94%) (41.36%) (43.78%) (46.19%) (48.61%) (51.03%) (53.44%) (55.86%) (58.27%) (60.69%) Done. Showing the 20 most costly calls sorted by 'memory-own'. Inclusive Own function#calls time memory time memory [root@web01 tmp]# So what steps do i need to take? I think that i have written something that fills the global variable ($this) with alot of stuff, but well how do i hunt it down? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Allowed-memory-size-exhausted-tp3701480p3703294.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Re: Allowed memory size exhausted
Regarding the original memory error, the causes can be anywhere in your application. The error occurs on the last bit of memory php tries to allocate that is to big for the remaining memory resources. This can even happen at different spots in the code, depending on how the memory is allocated during execution. Are you using code with memory leaks? Like an old mssql server extension or PHPExcel component? You may also try to increase the memory limit in php.ini. You seem to have around 12M if I read it right, but you could set it to 512M for example and see if you code will run on that. Just my 2 cents. -Bart Op 28-07-11 21:01, Andreas Möller schreef: command line you can do: zf --show-version Or see /Zend/Version.php. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] news publishing site
Hi, Zend Framework is not specific to any business domain, such as news publishing, it is just a general purpose framework, intending to make your life as a programmer a little bit easier and to make your code more testable and maintenable using automated tests. But if you are looking for a CMS based on Zend Framework, there are several out there. In fact, there has been a recent discussion in this mailing list on that topic. You should be able to find it if you look in the recent archives. -Bart Op 21-07-11 22:29, ibbrxx schreef: guys, is there a quick start using zendframework to build a news publishing site??? i am news to php and zendframework. but thought to switch to php and use zendframework as my base from now on. you help will be much appreciated. thanks in advance. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/news-publishing-site-tp3684934p3684934.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Zend_Form: adding css class attrib to select option elements
Op 22-07-11 17:06, David Mintz schreef: On Thu, Jul 21, 2011 at 5:19 PM, Bart McLeodmcl...@spaceweb.nl wrote: My wild guess is that you should override addMultiOptions in a custom select element so that you can add the class attribs. -Bart Op 21-07-11 21:49, David Mintz schreef: From my googling I see that this has been asked, and there's no really easy answer, and none of the few answers I found work for my case. Basically, you have a label, a value and a category signified by the css class. I want the output to be something like option label=apple class=fruit value=1apple/option option label=spinach class=vegetable value=wspinach/option option label=salmon class=fish value=1salmon/option And yes, I know there are option groups for organizing OPTION elements into a hierarchy, but I have my reasons for not wanting to go there. This will all come from a database. In high-level terms, how would you suggest approaching this? What classes/methods would you look into overriding? The purpose is to do fancy tricks using jQuery -- I need to detect the category on the change event. I can think of ways of hacking around this, e.g., load a JSON data structure that maps ids to categories and refer to that as needed. But... any other ideas? Thanks Bart. I noticed that $helper is a public property of Zend_Form_Element_Select, so rather than extending it, I have started working on a custom view helper instead, whose method signature is the same as that of formSelect in Zend_View_Helper_FormSelect. But the $options array that I am going to pass the Zend_Form_Element_Select constructor won't be like array( 1= apple, 2 = spinach ), but rather array( array(value=1,label=spinach, class=vegetable ), ... ) Any thoughts about this approach? I know that it's kind of crude to deliberately abuse Zend_Form_Element_Select's constructor and then give it a custom view helper to make up for it, but it looks like it's gonna work. Indeed it sounds like it's going to work and I do not see the crude aspect. If the constructor can be used this way it is the strength of the architecture that makes this possible. I looked at the issue in the tracker and that doesn't sound bad either, although I wonder how it would perform with a lot of options. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Zend Framework, Doctrine 2 - Let's talk entities and forms
Op 18-07-11 17:05, Kyle Spraggs schreef: Does anyone have any input on how I should handle filters? I was thinking of doing the following: get($field) - applies filtering to the field // user getter getEmail() { return $this-get('email'); } This allows users to have the flexibility of choosing whether or not to include automated filtering for getters/setters. I really dislike magic methods (__get/__set) so I'd prefer not to use them if at all possible. Magic getters and setters are considered a great feature by others, including me. Zend_Framework uses their magic extensively. If implemented well, these functions offert great possibilities. I do not think personal dislike is a good reason not to use them if you plan to develop for a large community. -Bart -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Zend_Form: adding css class attrib to select option elements
My wild guess is that you should override addMultiOptions in a custom select element so that you can add the class attribs. -Bart Op 21-07-11 21:49, David Mintz schreef: From my googling I see that this has been asked, and there's no really easy answer, and none of the few answers I found work for my case. Basically, you have a label, a value and a category signified by the css class. I want the output to be something like option label=apple class=fruit value=1apple/option option label=spinach class=vegetable value=wspinach/option option label=salmon class=fish value=1salmon/option And yes, I know there are option groups for organizing OPTION elements into a hierarchy, but I have my reasons for not wanting to go there. This will all come from a database. In high-level terms, how would you suggest approaching this? What classes/methods would you look into overriding? The purpose is to do fancy tricks using jQuery -- I need to detect the category on the change event. I can think of ways of hacking around this, e.g., load a JSON data structure that maps ids to categories and refer to that as needed. But... any other ideas? Thanks. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Re: Zend_Rest_Controller - Retrieve PUT data
Op 16-07-11 19:59, Matthew Weier O'Phinney schreef: -- Bart McLeodmcl...@spaceweb.nl wrote (on Friday, 15 July 2011, 09:04 PM +0200): Op 15-07-11 16:00, Matthew Weier O'Phinney schreef: -- Bart McLeodmcl...@spaceweb.nl wrote (on Friday, 15 July 2011, 12:22 PM +0200): Another issue is that Zend_Http_Client does not send PUT and DELETE data. There is a fix for that documented in the tracker. I tried that fix and it works, but I couldn't find the unit tests so far. Is Zend_Http_Client considered untestable? Or should AllTests.php be run? You should run AllTests when in the ZF1 repository -- in some components, it does some bootstrapping for the individual test cases to ensure that they have what they need. We're changing those strategies in ZF2 (often through test listeners), but for ZF1, continue this. This is good to know, since I was usually running individual tests and also recommending that as a good practice for bug fixing, so I will definitely change that. Well, let me clarify: if the test case won't run by itself, try the AllTests for that component. Usually, however, you can run an individual test class by itself. Ok, understood. I did a fix for the HTTP client quite recently, and had no issues running tests; let me know if you need some assistance. The issue I had is with Zend Studio, I can't run it from there, but maybe I have to start it differently, maybe just as a regular php script. Individual unit tests run fine, but a test suite is not recognized. Of course, I can configure the commandline to work, I just like to do this within ZS. I have a vague recollection of that, actually. I usually run my tests from the CLI, so I don't run into those issues. I do the same now. Works fine, after an elaborate installation of PHPUnit on MAMP. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Re: Zend_Rest_Controller - Retrieve PUT data
Hi all, I read a few thoughts about Zend_Rest_Client and Zend_Http_Client on the mailinglist. If you filter the list by searching for the subject Zend_Rest_C you can check what others have written. We lately noticed quite a few problems with both Zend_Rest_Client and Zend_Http_Client, that can be fixed relatively easily if we treat them as issues. There is at least on issue reported in the issue tracker. In a project we circumvented the problem with the XML reponse from Zend_Rest_Client by inheritance and overriding the __call method. A pluggable responsehandler would be a nice and clean solution, as discussed by Matthew WOP nd Hector Virgen. We could not fix the restPut function because it is declared as final (Was God involved in writing that?). This is one of the things I'd like to change. Another issue is that Zend_Http_Client does not send PUT and DELETE data. There is a fix for that documented in the tracker. I tried that fix and it works, but I couldn't find the unit tests so far. Is Zend_Http_Client considered untestable? Or should AllTests.php be run? I wonder if others experience these problems too, or is simply no one using the components that way? Feedback on this is very much apprieciated. Bart McLeod Op 06-06-11 14:57, onur.ozgur.ozkan schreef: Your welcome. If you improve the helper, or find better solutions, let me know. It will be very good if you push request on github. Bugs and comments always welcome. Best regards. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Rest-Controller-Retrieve-PUT-data-tp3529898p3576840.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] slashes being replaced by \/. maybe a bug
Hi Diogo, The best you can do is file an issue for this and upload a unit test that proves this is a bug. It looks like a bug to me at first sight, mostly because I can't think of a reason to escape a forward slash. - Bart McLeod Op 14-07-11 00:57, xpete schreef: I'am doing this: http://zend-framework-community.634137.n4.nabble.com/How-to-Zend-Dojo-Form-Dependent-Selects-e-g-Country-City-td663650.html and if i do this: $this-view-form-getElement('subtipo')-setStoreParams(array('url' = 'http://localhost/~xpete/project/public/info/lookup/tipo/1')); I get this result on the generated html: subtipo_id = new dojo.data.ItemFileReadStore({url:http:\/\/localhost\/~xpete\/project\/public\/info\/lookup\/tipo\/1}); I mean, the '\' have been replaced by '\/'. There's any way i can avoid this? this is a Zend bug? I tried this with Zend FW 1.11.7 1.11.8 and 1.11.9 preview. thx Diogo -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/slashes-being-replaced-by-maybe-a-bug-tp3666299p3666299.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Re: Zend_Rest_Controller - Retrieve PUT data
Op 15-07-11 16:00, Matthew Weier O'Phinney schreef: -- Bart McLeodmcl...@spaceweb.nl wrote (on Friday, 15 July 2011, 12:22 PM +0200): Another issue is that Zend_Http_Client does not send PUT and DELETE data. There is a fix for that documented in the tracker. I tried that fix and it works, but I couldn't find the unit tests so far. Is Zend_Http_Client considered untestable? Or should AllTests.php be run? You should run AllTests when in the ZF1 repository -- in some components, it does some bootstrapping for the individual test cases to ensure that they have what they need. We're changing those strategies in ZF2 (often through test listeners), but for ZF1, continue this. This is good to know, since I was usually running individual tests and also recommending that as a good practice for bug fixing, so I will definitely change that. I did a fix for the HTTP client quite recently, and had no issues running tests; let me know if you need some assistance. The issue I had is with Zend Studio, I can't run it from there, but maybe I have to start it differently, maybe just as a regular php script. Individual unit tests run fine, but a test suite is not recognized. Of course, I can configure the commandline to work, I just like to do this within ZS. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] How would you handle dynamic forms and validation?
Hi Jamie, Are you sure about these own form tags for subforms? It is a while ago I used subforms, but I do not recall that. From what I recall, subform fields are rendered as name=subform1[field1] into the main form. Am I mistaken, is this deprecated long since? I do remember that I had to filter out the subforms from the request parameters, because I also dynamically added them. You could never know how many there were. So I had to loop over the fields to detect a new subform in the variables. I remember I also validated them one by one, but I am not completely sure about that either. -Bart Op 23-06-11 08:42, Jamie Krasnoo schreef: Hey all, I'm on a project where in the admin for users you have a static part of the form and a few dynamic parts. The static part is the usual user name, password, first name, last name, etc. The dynamic part is putting in street addresses, phone numbers and email addresses. They'll have to put in at least one of each in order to complete the form. The person entering the information will have the choice of opening up or dynamically adding address, phone or email field if they have additional information to put in. At first I thought that using Zend_Sub_Form would be ideal but then remembered that each sub form would be surrounded by its own form tags separating each of the sections from the others and I wanted the ability to submit all the fields at once while properly validating the form with its added sections. I was thinking of removing the default decorators from each of the sub forms so the form tags wouldn't be rendered and create a custom decorator for the entire form and custom code to deploy each section. But what about when additional address, phone or email sections are created? How would I add validation for those sections? What would you do to handle this? Jamie -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] ZF 2 Zend_Filter_Input vs Zend_Validate
Op 09-06-11 16:57, Matthew Weier O'Phinney schreef: -- Bart McLeodmcl...@spaceweb.nl wrote (on Thursday, 09 June 2011, 01:15 PM +0200): This has come up in #zftalk.dev Zend_Filter_Input and Zend_Validate have overlapping functionality when considered as validation chains. How will we approach this in ZF 2? Will we keep both or will we let Zend_Validate take over what is currently the added value of Zend_Filter_Input? So that current users of Zend_Filter_Input will have a good replacement? So, there's actually even more overlap than that. Zend_Filter_Input creates and utilizes both filter and validation chains... without using the related functionality from either component. Additionally, it has the concepts of aggregated error messages, treatment of not/empty values, and treatment of required values. Finally, these chains and concepts are _per_ value; in other words, Zend_Filter_Input deals in _sets_ of values. So, it has a lot of added value over either. My feeling on it is that we need to: * Add concepts for required and allow empty to validation chains * _use_ the chaining functionality from each of the filter and validator components If those are all in place, the InputFilter can actually become the core (if not full) functionality of Zend_Form (assuming we can then move decoration into the view layer and have it query the elements for potential view metadata). For now, that answers my question as I am thinking about a proposal for Zend_Validate_Csv, that could use a validation chain for validation of columns in the csv data. This chain could best be Zend_Validate, based on your answer. -Bart -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
[fw-general] ZF 2 Zend_Filter_Input vs Zend_Validate
Hi all, This has come up in #zftalk.dev Zend_Filter_Input and Zend_Validate have overlapping functionality when considered as validation chains. How will we approach this in ZF 2? Will we keep both or will we let Zend_Validate take over what is currently the added value of Zend_Filter_Input? So that current users of Zend_Filter_Input will have a good replacement? -Bart -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Zend_Form_SubForm within a Zend_Form_DisplayGroup
Hi Marco, You can't mix displaygroups and subforms unfortunately. That's why a few years ago I built a system that involved a formbuilder and groupingdefinitions that could be nested. This worked really well and also performed reasonably well. This however required a lot of work from my part. The easiest way would be to write your form html using regular templates and type in the code to spit out the form elements. This way, you would have complete freedom without the complexity. -Bart Op 27-05-11 11:20, Marco Pivetta schreef: Hello there, A customer of mine requires me to create some kind of locked for fields. Not entering in the details for this stuff, but I need to store somewhere: a) the Zend_Form_Element value b) the Zend_Form_Element_Checkbox value (a checkbox that defines the field as locked) Here's the big trouble: this customer is completely focused on graphic details (omg!) and absolutely wants display groups. Here's a preview of what I currently have and that has to be reworked in a Zend_Form based implementation: http://marco-pivetta.com/screenshots/Zend_Form_DisplayGroup_and_parallel_fields.png (the switches on the right are checkboxes hidden by css sprites) In a normal case I would have built some form like this one: //Pseudocode $form = new MyForm(array( 'field1' = new LockedFieldForm(( new Zend_Form_Element_Text('field', /*...*/), new Zend_Form_Element_Checkbox('lock', /*...*/) )), 'field2' = new LockedFieldForm(( new Zend_Form_Element_Textarea('field', /*...*/), new Zend_Form_Element_Checkbox('lock', /*...*/) )), 'field3' = new LockedFieldForm(( new Zend_Form_Element_Select('field', /*...*/), new Zend_Form_Element_Checkbox('lock', /*...*/) )), 'field1' = new LockedFieldForm(( new Zend_Form_Element_OtherStuff('field', /*...*/), new Zend_Form_Element_Checkbox('lock', /*...*/) )), )); This allows me to play around with decorators within a row of my form and encapsulate my field persistence logic within a LockedFieldForm, by hiding the entire lock stuff. I can also play around with decorators to let subforms look exactly like other form elements... The pitfall is that Zend_Form_DisplayGroup allows me to group only elements of the same form (as far as I know), and would also make it hard to couple fields with their locks. As you can see in the screenshot linked before, I need to separate some fields keeping them in the same form. This is what DisplayGroup(s) are for. What I was trying to achieve is something like: $displayGroup-addElement($form-getSubForm('field1')); //Obviously doesn't work... Any ideas/suggestions? Shall I tell my customer that I can't use display groups? Is there some other method to encapsulate the lock logic? Anything different from Zend_Form_SubForm? Extending Zend_Form_Element seems to be quite complicated... Thank you in advance for any hints :) Marco Pivetta @Ocramiushttp://twitter.com/Ocramius http://marco-pivetta.com -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
[fw-general] Fatal error: Call to undefined method Zend_View_Helper_Placeholder_Container::ksort() in /var/local/Zend/View/Helper/HeadLink.php on line 321
Fatal error: Call to undefined method Zend_View_Helper_Placeholder_Container::ksort() in /var/local/Zend/View/Helper/HeadLink.php on line 321 This reminds me of a similar error I found earlier, I do not remember the component. It seems some one is trying to sort a placeholder by it's keys. This is the latest from svn standard trunk. I have no backtrace or anything, just this fatal error, do not know what is causing it. I will have to look in the revision log and see if there is something to revert. Anyone else having this error? Regards, Bart McLeod -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] Fatal error: Call to undefined method Zend_View_Helper_Placeholder_Container::ksort() in /var/local/Zend/View/Helper/HeadLink.php on line 321
You may be right, this is on a newly installed vps, where they installed a smaller version then I had asked for. 5.1.6 I think. I will check against 5.3, yes, that seems to work as usual. I will inform the isp, thank you! Bart Op 7-6-2010 12:46, Саша Стаменковић schreef: Looks like you have old version of PHP. Which version are you using? Regards, Saša Stamenković On Mon, Jun 7, 2010 at 12:21 PM, Bart McLeod mcl...@spaceweb.nl wrote: Fatal error: Call to undefined method Zend_View_Helper_Placeholder_Container::ksort() in /var/local/Zend/View/Helper/HeadLink.php on line 321 This reminds me of a similar error I found earlier, I do not remember the component. It seems some one is trying to sort a placeholder by it's keys. This is the latest from svn standard trunk. I have no backtrace or anything, just this fatal error, do not know what is causing it. I will have to look in the revision log and see if there is something to revert. Anyone else having this error? Regards, Bart McLeod -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify! -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] Fatal error: Call to undefined method Zend_View_Helper_Placeholder_Container::ksort() in /var/local/Zend/View/Helper/HeadLink.php on line 321
Thank you all, yes I will ask them to install 5.3 Regards, Bart McLeod Op 7-6-2010 14:22, Саша Стаменковић schreef: Check http://framework.zend.com/manual/en/requirements.introduction.html, it says PHP 5.2.4 or later. Regards, Saša Stamenković On Mon, Jun 7, 2010 at 2:13 PM, Nicolas Grevet ngre...@alteo.fr wrote: See: http://www.php.net/manual/en/arrayobject.ksort.php On 06/07/2010 02:12 PM, Bart McLeod wrote: You may be right, this is on a newly installed vps, where they installed a smaller version then I had asked for. 5.1.6 I think. I will check against 5.3, yes, that seems to work as usual. I will inform the isp, thank you! Bart Op 7-6-2010 12:46, Саша Стаменковић schreef: Looks like you have old version of PHP. Which version are you using? Regards, Saša Stamenković On Mon, Jun 7, 2010 at 12:21 PM, Bart McLeod mcl...@spaceweb.nl wrote: Fatal error: Call to undefined method Zend_View_Helper_Placeholder_Container::ksort() in /var/local/Zend/View/Helper/HeadLink.php on line 321 This reminds me of a similar error I found earlier, I do not remember the component. It seems some one is trying to sort a placeholder by it's keys. This is the latest from svn standard trunk. I have no backtrace or anything, just this fatal error, do not know what is causing it. I will have to look in the revision log and see if there is something to revert. Anyone else having this error? Regards, Bart McLeod -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify! -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify! -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
[fw-general] Call to undefined function () in D:\ZendFramework\library\Zend\Form\Decorator\HtmlTag.php on line 88
Call to undefined function () in D:\ZendFramework\library\Zend\Form\Decorator\HtmlTag.php on line 88 Anyone encountered this one? It occurs after update from svn this morning. (GMT +1) Bart McLeod -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] Call to undefined function () in D:\ZendFramework\library\Zend\Form\Decorator\HtmlTag.php on line 88
This used to work in revision 21963, where the code was simpler in that particular line. Lamba_13 seems to be the function that is missing. Anyone has forgotten a commit? Otherwise I will have to revert to previous version. New code: if (array_key_exists('callback', $val)) { $val = $val['callback']($this); } else { $val = implode(' ', $val); } Old code (working) $val = implode(' ', $val); Looks to me as if less code was better :-) -Bart Bart McLeod schreef: Call to undefined function () in *D:\ZendFramework\library\Zend\Form\Decorator\HtmlTag.php* on line *88 *Anyone encountered this one? It occurs after update from svn this morning. (GMT +1) Bart McLeod* * -- --
Re: [fw-general] Call to undefined function () in D:\ZendFramework\library\Zend\Form\Decorator\HtmlTag.php on line 88
I'm sorry that I do not remember which part of my app triggered the error. It was fatal, so there wasn't much of a stacktrace either. I just reverted the code and went on after reporting it. If it is really important to you, I can put the erroneous code back and try to reproduce it. Just not tonight :-) -Bart Op 22-4-2010 21:27, Christian Albrecht schreef: Indeed that was me, good to know that this resolves the problem :) Beeing curios, what exactly made this fail? I didn't imagine someone would give an multidimensional associative array with second level key 'callback' as an attribute to a Form Element. Greetings, Christian I can see that you or someone else already added a fix. That was quick! Good check to is_callable. For those interested, this is the new code: if (is_array($val)) { if (array_key_exists('callback', $val) is_callable($val['callback'])) { $val = $val['callback']($this); } else { $val = implode(' ', $val); } } -Bart Op 22-4-2010 18:29, Christian Albrecht schreef: Hey Bart, that was me who inserted this lines, see http://framework.zend.com/issues/browse/ZF-6741 what is your setup that this fails? Maybe that i can fix it properly. Greetings, Christian This used to work in revision 21963, where the code was simpler in that particular line. Lamba_13 seems to be the function that is missing. Anyone has forgotten a commit? Otherwise I will have to revert to previous version. New code: if (array_key_exists('callback', $val)) { $val = $val['callback']($this); } else { $val = implode(' ', $val); } Old code (working) $val = implode(' ', $val); Looks to me as if less code was better :-) -Bart Bart McLeod schreef: Call to undefined function () in *D:\ZendFramework\library\Zend\Form\Decorator\HtmlTag.php* on line *88 *Anyone encountered this one? It occurs after update from svn this morning. (GMT +1) Bart McLeod* * -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] Re: Can't get radiobuttons and checkboxes of form using getPost()
What do you mean by empty? Not checked? Not labelled? Not having any value when checked? -Bart Op 9-3-2010 15:56, debussy007 schreef: I understood that empty radio buttons and checkboxes are not included in the form by default. So I created hidden input fields to get a default values for these elements. -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] Zend_Auth::getInstance()-clearIdentity() doesn't seem to log me out?
Hi Cameron, Just some ideas. I assume you are using latest from trunk. If I try in my system to logout, I can logout. So nothing is wrong with the framework I think. So we are looking at a problem in your logic somewhere. The first thing I thought was there could be something with redirecting the way you do. May you should be forwarding to your default action instead, so that the clearance of the identity can take effect before you redirect. I do this in my logout action: public function logoutAction() { Globals::logout(); $this-_forward('index'); } You can see that I do not redirect, but I forward. In this case to the default action of the login controller. Globals does the following: public static function logout() { $auth = Zend_Auth::getInstance(); Zend_Registry::get('log')-info('Trying to clear identity'); $auth-clearIdentity(); } Since there is not much of a difference with your code, I think it must be the redirect. If that is not the issue, then I start to think of caching. Do you return cached content before you check the identity? In that case, logging out won't help once pages are cached. Just a thought. Regards, Bart McLeod Cameron schreef: I'm logged in because I can still access the entire application, something I can't do until I'm authorized. As for cookies, I dunno... there's nothing in the application that manually writes anything to a cookie, so it could only be Zend or general PHP session related... On Fri, Mar 5, 2010 at 12:54 PM, Jake McGraw jmcgr...@gmail.com wrote: On Thu, Mar 4, 2010 at 11:39 PM, Hector Virgen djvir...@gmail.com wrote: Anything in your cookies causing you to stay logged in? -- Hector On Thu, Mar 4, 2010 at 7:30 PM, Cameron themsel...@gmail.com wrote: Hi guys, I'm really not sure where I'm going with this one, it seems like I must be doing something completely wrong, but I'm not really sure where to even start looking. Here's my logout action: public function logoutAction() { Zend_Auth::getInstance()-clearIdentity(); $this-_helper-redirector('/'); } Pretty simple, right? The redirect certainly works, but for some reason, I'm still logged in! I've even tried $_SESSION = ''; to brute force the session to be deleted, but there i am, still logged in. Anyone got any ideas on this one? How are you confirming that you're still logged in? Perhaps that's the issue? - jake -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
[fw-general] **call for votes** issues with Zend_View_Helper_Url
Hi all, Because of an issue with get parameters from the query string that do not get reproduced by Zend_View_Helper_Url I looked in our very slow issue browser to see what issues are already here for this class. There are quite a few unresolved issues. While I only came to add the issue about the get parameters, I thought it would be a could idea to try and fix a few of the issues at the same time, because tackling a few issues in the same run might save some time if the same code needs to be touched. So I would like to ask all of you who use this class to vote for the issues that are yet unresolved and that you think particularly important. Your participation is very much appreciated. Please note that I did not yet add the issue with the get parameters to the issue tracker, feel free to do so if you get there before me. This will give me a priority list when I starting building unit tests to confirm the issues. Regards, Bart McLeod -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] **call for votes** issues with Zend_View_Helper_Url
This is a permalink to the filter I will be using: http://framework.zend.com/issues/secure/IssueNavigator.jspa?reset=truejqlQuery=%28summary+~+View_Helper_Url+OR+description+~+View_Helper_Url+OR+comment+~+View_Helper_Url%29+AND+status+%3D+Open It lists everything matching "View_Helper_Url" status==open I would have loved to share the filter, but I can't find where I can change it from private to shared. Anyway, you can vote on these issues. If you want any other issue regarding Zend_View_Helper_Url to be taking into accout, make sure it can be found using this filter. Regards, Bart McLeod Op 5-3-2010 14:06, Jurian Sluiman schreef: These are all the issues for the Zend_View component, matching the query "helper url" and aren't closed, invalid or whatsoever: http://framework.zend.com/issues/secure/IssueNavigator.jspa?reset=truejqlQuery=project+%253D+ZF+AND+%2528summary+%257E+%2522helper+url%2522+OR+description+%257E+%2522helper+url%2522%2529+AND+resolution+in+%2528Unresolved%252C+Incomplete%252C+%2522Needs+Proposal%2522%252C+%2522Cannot+Reproduce%2522%2529+AND+component+%253D+Zend_View+AND+status+in+%2528Open%252C+%2522In+Progress%2522%252C+Reopened%252C+Postponed%2529 Regards, Jurian -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] Zend_Auth::getInstance()-clearIdentity() doesn't seem to log me out?
My guess is that it will only help if you allow the request to complete within your application logic. That is why I suggest a _forward instead of a _redirect, but even that was a guess. I didn't yet try if a _redirect would break my application to. But now I have verified it, and it works equally well with a redirect as with a _forward. Even if I redirect to a complete different website. Anyway, clearIdentity should be enough within normal application flow. It may go wrong if you login someone automatically based on session data outside the reach of Zend_Auth. If you logout and then get logged in automatically based on derived session data, not encapsulated within Zend_Auth, then you are doing something wrong. clearIdentity() does the job. If it doesn't, something got out of control somewhere. I think you should be looking at how identity checking is done. Is it actually being performed for each access to your application? Regards, Bart McLeod Op 5-3-2010 14:21, Gina-Marie Rollock schreef: I have the following in my logout action: Zend_Session::destroy(true); after I clear my identity. Will that help? From: Bart McLeod [mailto:mcl...@spaceweb.nl] Sent: Friday, March 05, 2010 4:06 AM To: Cameron Cc: Jake McGraw; Hector Virgen; Zend Framework - General Subject: Re: [fw-general] Zend_Auth::getInstance()-clearIdentity() doesn't seem to log me out? Hi Cameron, Just some ideas. I assume you are using latest from trunk. If I try in my system to logout, I can logout. So nothing is wrong with the framework I think. So we are looking at a problem in your logic somewhere. The first thing I thought was there could be something with redirecting the way you do. May you should be forwarding to your default action instead, so that the clearance of the identity can take effect before you redirect. I do this in my logout action: public function logoutAction() { Globals::logout(); $this-_forward('index'); } You can see that I do not redirect, but I forward. In this case to the default action of the login controller. Globals does the following: public static function logout() { $auth = Zend_Auth::getInstance(); Zend_Registry::get('log')-info('Trying to clear identity'); $auth-clearIdentity(); } Since there is not much of a difference with your code, I think it must be the redirect. If that is not the issue, then I start to think of caching. Do you return cached content before you check the identity? In that case, logging out won't help once pages are cached. Just a thought. Regards, Bart McLeod Cameron schreef: I'm logged in because I can still access the entire application, something I can't do until I'm authorized. As for cookies, I dunno... there's nothing in the application that manually writes anything to a cookie, so it could only be Zend or general PHP session related... On Fri, Mar 5, 2010 at 12:54 PM, Jake McGraw jmcgr...@gmail.com wrote: On Thu, Mar 4, 2010 at 11:39 PM, Hector Virgen djvir...@gmail.com wrote: Anything in your cookies causing you to stay logged in? -- Hector On Thu, Mar 4, 2010 at 7:30 PM, Cameron themsel...@gmail.com wrote: Hi guys, I'm really not sure where I'm going with this one, it seems like I must be doing something completely wrong, but I'm not really sure where to even start looking. Here's my logout action: public function logoutAction() { Zend_Auth::getInstance()-clearIdentity(); $this-_helper-redirector('/'); } Pretty simple, right? The redirect certainly works, but for some reason, I'm still logged in! I've even tried $_SESSION = ''; to brute force the session to be deleted, but there i am, still logged in. Anyone got any ideas on this one? How are you confirming that you're still logged in? Perhaps that's the issue? - jake -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify! -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] array elements in a .ini file
My guess would be that you can't do this using ini configuration. It is limited compared to custom OO forms. And correct documentation is hard to find. -Bart Op 25-2-2010 22:27, David Mintz schreef: On Thu, Feb 25, 2010 at 2:55 PM, Mike Wright mike.wri...@mailinator.com wrote: Hi all, (3 hrs later) I know I've seen this explained before but searching for non-alphanumeric characters just doesn't google and I can't find it again anywhere. How do I specify within a config.ini file an element whose name may be an array? e.g. input name='test[i]' type='text' / elements.test[].type = "text" ;doesn't work. (and you'd probably get a good laugh out of some of the things I've tried ;) Just a wild guess, because this is not my strong suit, but --- the solution may be to forget about array notation and have a look at belongsTo. -- Support real health care reform: http://phimg.org/ -- David Mintz http://davidmintz.org/ -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] Form decorators not formatting
of producing multiple form inputs with same name but different input tag IDs (without which there would be invalid markup) from this example taken from Keith Pope's book (as a general reference): ? foreach($this-products as $product): ? div class="productitem clearfix" ?=$this-productImage($product-defaultImage, array('class' = 'img-center'))-thumbnail(); ? h4a href=""?=$this-Escape($product-name); ?/a/h4 p?=$this-Escape($product-shortDescription); ?/p p?=$this-productPrice($product); ?/p ?=$this-Cart()-addForm($product); ? /div ? My thanks in advance... Mike On 18 Dec 2009 at 21:06, Daniel Latter wrote: No problem, we all have them ;). Matthew Weier O'Phinney has just given a really good webinar on just this topic, it takes a bit to wrap your head around, heres a link to the recording: http://www.zend.com/en/resources/webinars/framework Good luck :) 2009/12/18 Mike A mik...@hotmail.co.uk On 18 Dec 2009 at 20:42, Daniel Latter wrote: Hi, What do you mean " many ids with productid produces validation error "? It is left upto the coder to set a unique id for each element? What are you trying to do, may be it wil shed more light? Also, if im not mistaken both the examples you refer to are the same? are you trying to dosomthing like this: .. id="producid_11" .. ? Yes - my bad. I used Nabble for the first post, it took out some of my text. Then my brain went daft on the required example. By validation I'm referring to markup. As sson as I read your reply I realised I had not passed id value to the form. Been at this too long today - 14 hours :( Also, trying to get pretty markup via decorator - it's driving me nuts! Many thanks Dan Thanks Dan 2009/12/18 Mike A mik...@hotmail.co.uk Apologies - my previous post did not format correctly, so I repeat. When constructing a form element I use this... $this-addElement('hidden', 'productId', array( 'decorators' = array(array('ViewHelper'), array('HtmlTag', array('tag' = 'p')), ), )); which formats as html (precisely) this way... p input type="hidden" name="productId" value="11" id="productId" //p There are two problems with this. First, many input ids with "productId" produces a validation error. Second, mark-up format is wrong. What must I do to produce this (with value added to id)... p input type="hidden" name="productId" value="11" id="productId" / /p TIA... Mike -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] Failed commit on Zend_Translate
Nicolas GREVET schreef: Hi everyone, I guess something went wrong during the last commit of 'Thomas' (number 19457) on Zend_Translate. The Zend/Translate/Adapter/Xliff was commited with a var_dump($this-_data) on line 92. Could someone tell him? Regards, -- Nicolas Grevet Can you not just take out the var_dump and commit that? Or do you have no access? -Bart
Re: [fw-general] problem with headers already sent
my 2 cents: did you try with output buffering enabled? do you have (ANYWHERE) some debug statements like var_dump or echo? before you register a session? jQuery datepickers definitely work, albeit that the integrated version is more complex to use than just using jQuery plain. -Bart Jigal sanders schreef: Hello I have a strange problem. I am trying to enable Zendx_JQuery_Form So I have created a class as you can see here: http://pastebin.com/m2a43e1c2 The problem is that my jquery datepicker fields don't work. I only get the following error in firebug: br / bFatal error/b: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in /var/www/nrka/application/controllers/EventsController.php, line 1' in /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php:282 Stack trace: #0 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php(300): Zend_Controller_Response_Abstract-gt;canSendHeaders(true) #1 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php(727): Zend_Controller_Response_Abstract-gt;sendHeaders() #2 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Front.php(984): Zend_Controller_Response_Abstract-gt;sendResponse() #3 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Application/Bootstrap/Bootstrap.php(77): Zend_Controller_Front-gt;dispatch() #4 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Application.php(358): Zend_Application_Bootstrap_Bootstrap-gt;run() #5 /var/www/nrka/public/index.php(26): Zend_Application-gt;run in b/home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php/b on line b282/bbr / But in eventController.php in starts with ?php right at the beginning. There is no empty space. Can anyone tell me what I am doing wrong? thanks, J. Sanders
Re: [fw-general] problem with headers already sent
I wonder why you are extending Zend_Form if you want datepickers. Why not extend ZendX_JQuery_Form, because you want datepickers the integrated way? -Bart Jigal sanders schreef: Yes I thought so. But i checked all files and using bluefish but i cant find the space. On Fri, Dec 4, 2009 at 2:22 PM, Matthew Weier O'Phinney matt...@zend.com mailto:matt...@zend.com wrote: -- Jigal sanders jigalroe...@gmail.com mailto:jigalroe...@gmail.com wrote (on Friday, 04 December 2009, 01:09 PM +0100): Hello I have a strange problem. I am trying to enable Zendx_JQuery_Form So I have created a class as you can see here: http://pastebin.com/m2a43e1c2 The problem is that my jquery datepicker fields don't work. I only get the following error in firebug: br / bFatal error/b: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in /var/www/nrka/application/controllers/EventsController.php, line 1' in /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php:282 Most likely you have some whitespace in your EventsController.php file at the top or _following_ a closing ? tag. Stack trace: #0 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php(300): Zend_Controller_Response_Abstract-gt;canSendHeaders(true) #1 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php(727): Zend_Controller_Response_Abstract-gt;sendHeaders() #2 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Front.php(984): Zend_Controller_Response_Abstract-gt;sendResponse() #3 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Application/Bootstrap/Bootstrap.php(77): Zend_Controller_Front-gt;dispatch() #4 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Application.php(358): Zend_Application_Bootstrap_Bootstrap-gt;run() #5 /var/www/nrka/public/index.php(26): Zend_Application-gt;run in b/home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php/b on line b282/bbr / But in eventController.php in starts with ?php right at the beginning. There is no empty space. Can anyone tell me what I am doing wrong? thanks, J. Sanders -- Matthew Weier O'Phinney Project Lead| matt...@zend.com mailto:matt...@zend.com Zend Framework | http://framework.zend.com/ -- Met vriendelijke groet, Jigal Sanders A.J. Ernststraat 739 1082 LK Amsterdam Mobiel: 06-42111489
Re: [fw-general] problem with headers already sent
I would like to add that for me, it only started working when I extended ZendX_etc. -Bart Bart McLeod schreef: I wonder why you are extending Zend_Form if you want datepickers. Why not extend ZendX_JQuery_Form, because you want datepickers the integrated way? -Bart Jigal sanders schreef: Yes I thought so. But i checked all files and using bluefish but i cant find the space. On Fri, Dec 4, 2009 at 2:22 PM, Matthew Weier O'Phinney matt...@zend.com mailto:matt...@zend.com wrote: -- Jigal sanders jigalroe...@gmail.com mailto:jigalroe...@gmail.com wrote (on Friday, 04 December 2009, 01:09 PM +0100): Hello I have a strange problem. I am trying to enable Zendx_JQuery_Form So I have created a class as you can see here: http://pastebin.com/m2a43e1c2 The problem is that my jquery datepicker fields don't work. I only get the following error in firebug: br / bFatal error/b: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in /var/www/nrka/application/controllers/EventsController.php, line 1' in /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php:282 Most likely you have some whitespace in your EventsController.php file at the top or _following_ a closing ? tag. Stack trace: #0 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php(300): Zend_Controller_Response_Abstract-gt;canSendHeaders(true) #1 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php(727): Zend_Controller_Response_Abstract-gt;sendHeaders() #2 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Front.php(984): Zend_Controller_Response_Abstract-gt;sendResponse() #3 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Application/Bootstrap/Bootstrap.php(77): Zend_Controller_Front-gt;dispatch() #4 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Application.php(358): Zend_Application_Bootstrap_Bootstrap-gt;run() #5 /var/www/nrka/public/index.php(26): Zend_Application-gt;run in b/home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php/b on line b282/bbr / But in eventController.php in starts with ?php right at the beginning. There is no empty space. Can anyone tell me what I am doing wrong? thanks, J. Sanders -- Matthew Weier O'Phinney Project Lead| matt...@zend.com mailto:matt...@zend.com Zend Framework | http://framework.zend.com/ -- Met vriendelijke groet, Jigal Sanders A.J. Ernststraat 739 1082 LK Amsterdam Mobiel: 06-42111489
Re: [fw-general] problem with headers already sent
Now we're at it, you'd better not override the constructor, but the init() method instead That might even help... And also, to focus on the problem, create a test page, that echoes your form and nothing else and see what you get. -Bart Jigal sanders schreef: this is mij form class ?php class JS_Form_NewEventForm extends ZendX_JQuery_Form{ public function __construct($options=null){ parent::__construct($options); $this-setName(newEvent); //naam $evtName = new Zend_Form_Element_Text(evt_name); $evtName-setLabel(Evenement Naam: ) -setRequired(true); // omschrijving $evtDescription = new Zend_Form_Element_Textarea(evt_description); $evtDescription-setLabel(Evenement omschrijving: ); // begin datum //$evtStartDate = new Zend_Form_Element_Text(evt_startdate); $evtStartDate = new ZendX_JQuery_Form_Element_DatePicker(evt_startdate); $evtStartDate-setLabel(Begin datum); // eind datum $evtEndDate = new Zend_Form_Element_Text(evt_enddate); $evtEndDate-setLabel(Eind datum); // begin tijd $evtStartTime = new Zend_Form_Element_Text(evt_starttime); $evtStartTime-setLabel(Begin Tijd); // eind tijd $evtEndTime = new Zend_Form_Element_Text(evt_endtime); $evtEndTime-setLabel(Eind tijd); // aantal personen $amountPersons = new Zend_Form_Element_Text(evt_amtpersons); $amountPersons-setLabel(Aantal personen nodig ); $save = new Zend_Form_Element_Submit(save); $save-setLabel(Opslaan); $elem = new ZendX_JQuery_Form_Element_DatePicker( datePicker1, array(label = Date Picker:) ); $elem-setJQueryParam('dateFormat', 'dd.mm.yy'); $this-addElements(array($evtName,$evtDescription,$evtStartDate,$evtEndDate,$evtStartTime,$evtEndTime,$amountPersons,$elem,$save)); $this-setMethod('post'); $this-setAction(Zend_Controller_Front::getInstance()-getBaseUrl().'/events/add'); } } but still the same error. On Fri, Dec 4, 2009 at 3:07 PM, Bart McLeod mcl...@spaceweb.nl mailto:mcl...@spaceweb.nl wrote: I would like to add that for me, it only started working when I extended ZendX_etc. -Bart Bart McLeod schreef: I wonder why you are extending Zend_Form if you want datepickers. Why not extend ZendX_JQuery_Form, because you want datepickers the integrated way? -Bart Jigal sanders schreef: Yes I thought so. But i checked all files and using bluefish but i cant find the space. On Fri, Dec 4, 2009 at 2:22 PM, Matthew Weier O'Phinney matt...@zend.com mailto:matt...@zend.com wrote: -- Jigal sanders jigalroe...@gmail.com mailto:jigalroe...@gmail.com wrote (on Friday, 04 December 2009, 01:09 PM +0100): Hello I have a strange problem. I am trying to enable Zendx_JQuery_Form So I have created a class as you can see here: http://pastebin.com/m2a43e1c2 The problem is that my jquery datepicker fields don't work. I only get the following error in firebug: br / bFatal error/b: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in /var/www/nrka/application/controllers/EventsController.php, line 1' in /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php:282 Most likely you have some whitespace in your EventsController.php file at the top or _following_ a closing ? tag. Stack trace: #0 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php(300): Zend_Controller_Response_Abstract-gt;canSendHeaders(true) #1 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php(727): Zend_Controller_Response_Abstract-gt;sendHeaders() #2 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Front.php(984): Zend_Controller_Response_Abstract-gt;sendResponse() #3 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Application/Bootstrap/Bootstrap.php(77): Zend_Controller_Front-gt;dispatch() #4 /home/jigal/Public/ZendFramework-1.9.6/library/Zend/Application.php(358): Zend_Application_Bootstrap_Bootstrap-gt;run() #5 /var/www/nrka/public/index.php(26): Zend_Application-gt;run in b/home/jigal/Public/ZendFramework-1.9.6/library/Zend/Controller/Response/Abstract.php/b on line b282/bbr / But in eventController.php
Re: [fw-general] Applying Zend_Acl to Zend_Form_Element
Cameron schreef: Hi guys, this is pretty pie in the sky, but I was wondering if anyone had seen it done / had a good trick for it. What I'd like to do is come up with a really clean way of controlling which users can see which form fields. Example being a role field in the user form - admins can set the user's role, but regular users cannot. I know that I can wrap the odd if ($acl-isAllowed($params)) call around the element in my form init, but it seems to me that it'd be really nice to be able to mark form elements as being a certain resource name and then apply the permissions tools in exactly the same way as an action plugin does, without explicitly defining the code, just setting up the ACL lists. It's like we need a form helper or something... It seems to me that the fewer inline ACL checks we have to perform, the easier and safer our overall permission structure is going to be. Anyone managed to do something like this? Hi Cameron, I didn't do it yet, but you can implement the resource infterface on any custom element. So just make sure you use only custom elements where you need this behavior and have those implement the resource interface and let them check against the ACL themselves, using a decoractor for example. But you would still have to write code... -Bart
[fw-general] bug hunt has increased interest in issue tracker
I have difficulty reaching the issue tracker. I just wanted to comment on one, as a reply to Benjamin, but it has become unresponsive. -Bart -- Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
Re: [fw-general] Front Controller Plugin Problems
James Hargreaves schreef: Hello I am trying to implement some functionality via a couple of Controller Plugins - my requirements are as follows: 1) load custom configuration and make this information available in the view 2) check the input URL contains a language code and re-route to holding page (where they can select a language) if it does not Obviously these are two completely separate requirements, hence I would like to do this using two completely separate plugins. Anyway, my first question is ... where do I register the plug-in? I am using the Latest Release of ZF. The index.php generated when I created the project does not obviously have anywhere to load my plug-ins. So, instead I have created a new init method in my Bootstrap.php: protected function _initPlugins() { $front = Zend_Controller_Front::getInstance(); $front-registerPlugin(new MyPlugin()); $front-registerPlugin(new MyOtherPlugin()); } Is that the right way to do this? If I register the plug-ins this way will all hooks into the application stack (eg - routeStartup, dispatchLoopStartup, etc) be available to my plug-in? Yes, it is the right way to do this, but I don't see why you put it in a function. Is this inside your bootstrap class? In that case I understand. Okay, so assuming what I have done above is okay, onto plug-in (1). I have a configuration file custom.ini that contains, among other things, a Google Maps API key. I want to make this information available in all views throughout the application, so I would do something like: class MyPlugin extends Zend_Controller_Plugin_Abstract { public function routeStartup(Zend_Controller_Request_Abstract $request) { $config = new Zend_Config_Ini('/path/to/config.ini', $this-env); $this-view-google_maps_api_key = $config-google_maps_api_key; } } I would say Zend_Registry::set('my_config', $config); and retrieve this whenever you need it as Zend_Registry::get('my_config'); Is that going to work? I am assuming that $this in this context is not actually the Zend_Application, so $this-env will not yield anything useful, likewise setting anything on $this-view is not going to make this attribute available in the view. Is there someway to access the application via $this - eg - $this-application-env. Onto plug-in (2). I don't really have any idea how to implement this, but my initial thoughts are: I don't have time to read all this, but I think you should be looking at using a custom route. $router = $front-getRouter(); $router-addRoute(-your new route-); -Bart - http://www.mydomain.com/ should show a holding page, where a language can be selected - http://www.mydomain.com/lang/ (where lang is a two-character language code such as 'en' or 'de') is the home page for the language-specific version of the site - http://www.mydomain.com/lang/abc/ is a specific page on the language-specific site - the plug-in should check a valid language code is provided in the URL and redirect accordingly. - I don't want to provide duplicate controllers for each language, so the following URLs should use the same controller: http://www.mydomain.com/en/abc/ http://www.mydomain.com/de/abc/ In each case the view script should be lang.phtml, as oppose to the default index.phtml, so that the language of the page can be easily defined. The last bit is just thinking outloud. It might be easier to accomplish what I want by splitting the views by the language at the top level of the hierarchy - eg: APPLICATION_PATH/views/scripts/en/abc/index.phtml As oppose to: APPLICATION_PATH/views/scripts/abc/en.phtml I don't really mind either way. But I definitely do not want to duplicate the controllers. Anyway, that's what I need to do. Apologies for the lengthy post, but as you can see there are quite a few issues I need to address, I think mainly because I am new to ZF and still not fully sure how it all hangs together. Any help would be appreciated :) Thanks Jay
Re: [fw-general] Zend Form - _forward() and submit questions
_getAllParams() ? magrytos1 schreef: Thanks Matthew, your answer helped me a lot. Although I have another question. When I'm passing an array in _forward(), how can I get this array in action, were forward sent me. Thx Matthew Weier O'Phinney-3 wrote: -- magrytos1 magry...@wp.pl wrote (on Thursday, 16 July 2009, 02:19 AM -0700): I have an action like that: public function addAction() { $this-view-title = Add Request; $this-view-headTitle($this-view-title, 'PREPEND'); $form = new Form_Add(); $this-view-form = $form; if ($this-getRequest()-isPost()) { $formData = $this-_request-getPost(); if ($form-isValid($formData)) { $reqName = $form-getValue('requestName'); $type= $form-getValue('type'); $request = $form-getValue('request'); $requests = new Model_DbTable_Requests(); $requests-addRequest($reqName, $type, $request); $this-_forward('question'); } } } 1. Function addRequest adds the records to db. The problem is that after pushing my submit button, it goes to 'question', but it adds nothing to db. Why? That, I do not know. You'll need to step through the addRequest() method of your model to debug it. 2. What is all about this _forward function. I mean after call it, I'm in question view, but in my adress bar I still have public/index/add? I red ref guide, but I couldn't understand it :/ _forward() invokes another action *in the same request*. If you want the address bar to change, you're wanting a redirect, and should use the _redirect() method or the Redirector action helper. 3. Question about submit: having 2 sub buttons I want them to send me to a different actions. I did something like this: if($form-yes-isChecked()){ $form-setAction('critere'); } else { $form-setAction('index'); } but my if-condition is always false The isChecked() method checks the value assigned to the button. You need to first populate the form for it to work correctly: $form-populate($this-getRequest()-getPost()); if ($form-yes-isChecked()) { } else { } Second, the form action is only going to affect the action attribute in the form; it sounds like what you want to happen is to select which controller action is invoked based on the button selected. If this is the case, use _forward() or simply call the action directly: $this-indexAction(). One note: _forward() will ensure the appropriate view script is selected automatically but requires an additional dispatch cycle, whereas calling the action directly will require you update the action in the request object manually, or manually select the view script to render. -- Matthew Weier O'Phinney Project Lead| matt...@zend.com Zend Framework | http://framework.zend.com/
[fw-general] [Fwd: Re: [fw-mvc] Autoloading in zf 1.8.4]
forwarded because I forgot to reply to all ---BeginMessage--- I think I remember, didn't use it much yet myself, only once when I did a build from the commandline. Isn't the Bootstrap class the class that you define yourself in your index.php to set everything up that your application needs? From the web: A Bootstrap.php file exists in the application directory which represents a class called Bootstrap. It's purpose is to initialise the Zend Framework, adjust environment settings (for example, timezone and error_reporting level), and otherwise make application specific tweaks and additions before a HTTP request is processed. Most tutorials take an alternative view and put Bootstrap code into index.php. I strongly suggest you avoid this and use an actual class to organise the Bootstrap code - it makes it a lot easier to read if nothing else! So you just have to create it yourself. Read more here (for example): http://blog.astrumfutura.com/archives/355-An-Example-Zend-Framework-Blog-Application-Part-3-A-Simple-Hello-World-Tutorial.html -Bart Raavi Raaj schreef: Even if I comment out the 'require_once Zend/Application.php'. I keep getting the same error. *Fatal error*: Class 'Bootstrap' not found in *C:\...\library\Zend\Application.php* on line *292* -R On 7/17/09, *Bart McLeod* mcl...@spaceweb.nl mailto:mcl...@spaceweb.nl wrote: You still have a require_once 'Zend/Application.php' so it could be that you have to update your include_path after the upgrade? Ohterwise try commenting the line where you require Application.php and see if it complains about not finding Zend_Application... -Bart Raavi Raaj schreef: Hi, Just upgraded (my zf app) form 1.7.8 to 1.8.4. Everything went smooth. Was trying out the performance tips at http://framework.zend.com/manual/en/performance.classloading.html#performance.classloading.striprequires.sed My /public/index.php ?php defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); set_include_path(implode(PATH_SEPARATOR, array( APPLICATION_PATH . '/../library', get_include_path() ))); require_once 'Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance(); require_once 'Zend/Application.php'; $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/config.php' ); $application-bootstrap()-run(); *Commented out* all require_once statements except the one in Zend/Loader/Autoloader.php Now I get this error... *Fatal error*: Class 'Bootstrap' not found in *C:\...\library\Zend\Application.php* on line *292* My Bootstrap.php exists in /application/Bootstrap.php Any clues what I am doing wrong. All help is appreciated. -R P.S. Without the commenting out of require_once statements, the app runs fine. ---End Message---
Re: [fw-general] [Fwd: Re: [fw-mvc] Autoloading in zf 1.8.4]
And then forwarded to the wrong list, must have another coffee :-) Bart McLeod schreef: forwarded because I forgot to reply to all Onderwerp: Re: [fw-mvc] Autoloading in zf 1.8.4 Van: Bart McLeod mcl...@spaceweb.nl Datum: Fri, 17 Jul 2009 14:23:23 +0200 Aan: Raavi Raaj raaviraa...@gmail.com Aan: Raavi Raaj raaviraa...@gmail.com I think I remember, didn't use it much yet myself, only once when I did a build from the commandline. Isn't the Bootstrap class the class that you define yourself in your index.php to set everything up that your application needs? From the web: A Bootstrap.php file exists in the application directory which represents a class called Bootstrap. It's purpose is to initialise the Zend Framework, adjust environment settings (for example, timezone and error_reporting level), and otherwise make application specific tweaks and additions before a HTTP request is processed. Most tutorials take an alternative view and put Bootstrap code into index.php. I strongly suggest you avoid this and use an actual class to organise the Bootstrap code - it makes it a lot easier to read if nothing else! So you just have to create it yourself. Read more here (for example): http://blog.astrumfutura.com/archives/355-An-Example-Zend-Framework-Blog-Application-Part-3-A-Simple-Hello-World-Tutorial.html -Bart Raavi Raaj schreef: Even if I comment out the 'require_once Zend/Application.php'. I keep getting the same error. *Fatal error*: Class 'Bootstrap' not found in *C:\...\library\Zend\Application.php* on line *292* -R On 7/17/09, *Bart McLeod* mcl...@spaceweb.nl mailto:mcl...@spaceweb.nl wrote: You still have a require_once 'Zend/Application.php' so it could be that you have to update your include_path after the upgrade? Ohterwise try commenting the line where you require Application.php and see if it complains about not finding Zend_Application... -Bart Raavi Raaj schreef: Hi, Just upgraded (my zf app) form 1.7.8 to 1.8.4. Everything went smooth. Was trying out the performance tips at http://framework.zend.com/manual/en/performance.classloading.html#performance.classloading.striprequires.sed My /public/index.php ?php defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); set_include_path(implode(PATH_SEPARATOR, array( APPLICATION_PATH . '/../library', get_include_path() ))); require_once 'Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance(); require_once 'Zend/Application.php'; $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/config.php' ); $application-bootstrap()-run(); *Commented out* all require_once statements except the one in Zend/Loader/Autoloader.php Now I get this error... *Fatal error*: Class 'Bootstrap' not found in *C:\...\library\Zend\Application.php* on line *292* My Bootstrap.php exists in /application/Bootstrap.php Any clues what I am doing wrong. All help is appreciated. -R P.S. Without the commenting out of require_once statements, the app runs fine.
[fw-general] Re: [fw-mvc] Re: [fw-general] [Fwd: Re: [fw-mvc] Autoloading in zf 1.8.4]
My guess is that your base autoloading mechanism finds all the classes and Zend_Application does not. And/Or, you have a circular require_once. That is something I struggled with this morning. Class A requires Class B and Class B requires_once class A...? So they sort of wait for each other, when you uncomment the line, you break the circle? Raavi Raaj schreef: OK when I uncomment the below line (line 290 in Zend/Application.php), the my app seems to function. require_once $path; Any clue why the above works? -R On 7/17/09, *Raavi Raaj* raaviraa...@gmail.com mailto:raaviraa...@gmail.com wrote: I have my Bootstarp in /application/Bootstrap.php. Below is the sample of my bootstrap /application/Bootstrap.php ?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initAutoload() { $moduleLoader = new Zend_Application_Module_Autoloader(array( 'namespace' = '', 'basePath' = APPLICATION_PATH)); return $moduleLoader; } ... /public/index.php ?php // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); // Set include path to vendor library set_include_path(implode(PATH_SEPARATOR, array( APPLICATION_PATH . '/../library', get_include_path() ))); // Autoloading require_once 'Zend/Loader/Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader-suppressNotFoundWarnings(false); // Create application, bootstrap, and run $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/config.php'); $application-bootstrap()-run(); -R On 7/17/09, *Bart McLeod* mcl...@spaceweb.nl mailto:mcl...@spaceweb.nl wrote: And then forwarded to the wrong list, must have another coffee :-) Bart McLeod schreef: forwarded because I forgot to reply to all Onderwerp: Re: [fw-mvc] Autoloading in zf 1.8.4 Van: Bart McLeod mcl...@spaceweb.nl mailto:mcl...@spaceweb.nl Datum: Fri, 17 Jul 2009 14:23:23 +0200 Aan: Raavi Raaj raaviraa...@gmail.com mailto:raaviraa...@gmail.com Aan: Raavi Raaj raaviraa...@gmail.com mailto:raaviraa...@gmail.com I think I remember, didn't use it much yet myself, only once when I did a build from the commandline. Isn't the Bootstrap class the class that you define yourself in your index.php to set everything up that your application needs? From the web: A Bootstrap.php file exists in the application directory which represents a class called Bootstrap. It's purpose is to initialise the Zend Framework, adjust environment settings (for example, timezone and error_reporting level), and otherwise make application specific tweaks and additions before a HTTP request is processed. Most tutorials take an alternative view and put Bootstrap code into index.php. I strongly suggest you avoid this and use an actual class to organise the Bootstrap code - it makes it a lot easier to read if nothing else! So you just have to create it yourself. Read more here (for example): http://blog.astrumfutura.com/archives/355-An-Example-Zend-Framework-Blog-Application-Part-3-A-Simple-Hello-World-Tutorial.html -Bart Raavi Raaj schreef: Even if I comment out the 'require_once Zend/Application.php'. I keep getting the same error. *Fatal error*: Class 'Bootstrap' not found in *C:\...\library\Zend\Application.php* on line *292* -R On 7/17/09, *Bart McLeod* mcl...@spaceweb.nl mailto:mcl...@spaceweb.nl mailto:mcl...@spaceweb.nl mailto:mcl...@spaceweb.nl wrote: You still have a require_once 'Zend/Application.php' so it could be that you have to update your include_path after the upgrade? Ohterwise try commenting the line where you require
Re: [fw-general] Zend_Validate_Regex issue
Hi Thomas, Only today I set aside my stubborness and tried to set the INVALID message, which worked fine. I just don't understand why this was changed and why BC was broken. Do you know? -Bart Thomas Weidner schreef: The regex validator has also a INVALID message which you did not set. Which type has the value you want to validate ? Try a var_dump of the value. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: Bart McLeod mcl...@spaceweb.nl To: fw-general fw-general@lists.zend.com Sent: Thursday, July 09, 2009 2:17 PM Subject: [fw-general] Zend_Validate_Regex issue Hi all, I searched the mailing list and the issue tracker, but I can't find an issue for this. However, I would like to double check with you all, before creating a new issue. Maybe I am just coding wrong or there already exists an issue that you can point me to. Here's the problem: I add a Regex validator to a form. I set the a custom message on Zend_Validate_Regex::NOT_MATCH. I do not get the custom message, but instead I get: Invalid type given, value should be string, integer or float Which makes no sense at all (at least to me). Anyone? My version is latest trunk, it also affects existing solutions that worked fine for months. The code: $phoneValidator = new Zend_Validate_Regex($pattern); $phoneValidator-setMessage(U mag de volgende tekens gebruiken: + - ( ) een spatie en cijfers., Zend_Validate_Regex::NOT_MATCH ); $telephone-addValidator($phoneValidator); $form-addElement($telephone); Regards, Bart McLeod
Re: [fw-general] Zend Form - setAction()
are you looking for $this-_forward('critere'); after your submit action has completed? -Bart magrytos1 schreef: Hi. I have action add and a form for this action. After click on submit button i want to add a data that I chose to my database and also I want to go to the next page of my form 'critere'. When i put setAction('critere'); in my form add form, after pushing submit button it goes to form critere, but it doesn't add any data to my db. If I comment setAction() function, it adds data, but it stays in add form. Is it possible to put an array as an arguments for setAction()? If not, how can I do 2 actions by pushin one button. public function addAction() { $this-view-title = Add Request; $this-view-headTitle($this-view-title, 'PREPEND'); $form = new Form_Add(); //$this-view-form = $form; if ($this-getRequest()-isPost()) { $formData = $this-_request-getPost(); if ($form-isValid($formData)) { $reqName = $form-getValue('requestName'); $type = $form-getValue('type'); $request = $form-getValue('request'); $requests = new Model_DbTable_Requests(); $requests-addRequest($reqName, $type, $request); } } $this-view-form = $form; } thx
[fw-general] Zend_Validate_Regex issue
Hi all, I searched the mailing list and the issue tracker, but I can't find an issue for this. However, I would like to double check with you all, before creating a new issue. Maybe I am just coding wrong or there already exists an issue that you can point me to. Here's the problem: I add a Regex validator to a form. I set the a custom message on Zend_Validate_Regex::NOT_MATCH. I do not get the custom message, but instead I get: Invalid type given, value should be string, integer or float Which makes no sense at all (at least to me). Anyone? My version is latest trunk, it also affects existing solutions that worked fine for months. The code: $phoneValidator = new Zend_Validate_Regex($pattern); $phoneValidator-setMessage(U mag de volgende tekens gebruiken: + - ( ) een spatie en cijfers., Zend_Validate_Regex::NOT_MATCH ); $telephone-addValidator($phoneValidator); $form-addElement($telephone); Regards, Bart McLeod
Re: [fw-general] Problems with the Soap class
You should be using either Zend_Soap_Client or Zend_Soap_Server for which you will find the files in Zend/Soap directory :-) -Bart Jaume Presas schreef: Hello there. I'm having problems using the Zend_Soap class. Better said: not using it, since I can't even load it. The weird thing is that it's because the file Soap.php is not in the Zend folder, it's simply missing. I downloaded the most recent version (1.8) of the ZF and it's not there. Can someone tell me where I can find this file? Or just tell me what I'm doing wrong, I'm loading the class as usual: Zend_Loader::loadClass('Zend_Soap'); Thanks in advance. Jaume Presas
Re: [fw-general] Zend_Validate_Regex issue
Hi Thomas, Thanks for the reply. What is validated is the output of an HTML form. So everything comes in as a string. The format of the string is intentionally crap, something like dkfj;sdrfhpthqew;rjhn;kfhe to mimic the behavior of some very irritating spambots. The reason I use a very simple regex validator, that still allows for /invalid /phone numbers, is that if someone enters a value that is definitely not part of a phone number, like x or a, the validator will return false and the spambot will not succeed in sending the form. I simply can't see why the input should conform to a certain type, while I am checking against a pattern. By the way, the type is string, which is valid according to the validator message. Also note that this validator AND setting a custom message used to work, so it is broken since some recent point in time. Any help still appreciated, but if I am /not /wrong in how I use it, I would like to know if others are encountering the same issue and if an issue is/needs to be filed in the issue tracker. -Bart Thomas Weidner schreef: The regex validator has also a INVALID message which you did not set. Which type has the value you want to validate ? Try a var_dump of the value. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: Bart McLeod mcl...@spaceweb.nl To: fw-general fw-general@lists.zend.com Sent: Thursday, July 09, 2009 2:17 PM Subject: [fw-general] Zend_Validate_Regex issue Hi all, I searched the mailing list and the issue tracker, but I can't find an issue for this. However, I would like to double check with you all, before creating a new issue. Maybe I am just coding wrong or there already exists an issue that you can point me to. Here's the problem: I add a Regex validator to a form. I set the a custom message on Zend_Validate_Regex::NOT_MATCH. I do not get the custom message, but instead I get: Invalid type given, value should be string, integer or float Which makes no sense at all (at least to me). Anyone? My version is latest trunk, it also affects existing solutions that worked fine for months. The code: $phoneValidator = new Zend_Validate_Regex($pattern); $phoneValidator-setMessage(U mag de volgende tekens gebruiken: + - ( ) een spatie en cijfers., Zend_Validate_Regex::NOT_MATCH ); $telephone-addValidator($phoneValidator); $form-addElement($telephone); Regards, Bart McLeod
Re: [fw-general] jQuery DatePicker with Zend_Form
The proposed solution is the non-integrated way to use JQuery with any form (not Zend_Form in particular). You should look at the ZendX library and the integrated JQuery solution. This will give you a ZendX_JQuery_Form and a ZendX_JQuery_Form_Element_DatePicker $elem = new ZendX_JQuery_Form_Element_DatePicker('begin'); //$elem-setJQueryParam('changeMonth', true); $elem-setJQueryParam('changeYear', true); $elem-setLabel('begin')-setValue($dummy-begin);//$dummy is my default database object $this-addElement($elem);//$this is a ZendX_JQuery_Form -Bart Ehask71 schreef: You should be able to place the Javascript and tell it to use date_start Here is one of my templates vehicle.phtml script type=text/javascript $(document).ready(function(){ $('#ship_date').datepicker({dateFormat: 'yy-mm-dd'}); }); /script ?=$this-vehicleForm-render()? Of course make sure you have the included files in the layout head for the datepicker Eric Haskins Simeon Goranov-3 wrote: Hello, I am interested in creating a form with a calendar element. I decided to use jQuery date picker, but I don't know how to integrate it into the form. Bellow is the form code: $form = new Zend_Form(); $form-setName('form_add_service'); $form-setMethod('post'); $element = new Zend_Form_Element_Text('date_start'); $element-setLabel('Start Date'); $element-setRequired(true); $form-addElement($element); I want to tell to the element to be jQuery date picker. Is there any way to do it ? Thanks in advance, S.G.
Re: [fw-general] Re: Form tree element
my 2 cents: If you look at other form elements, you will see that they use a view helper for rendering. So I guess it would be 'better' if you created a view helper for it. -Bart Daniel Latter schreef: sorry when I said: /which calls a recursive function/ I meant: which calls a recursive method of the Tree element class that extends Zend_Form_Element Thank You Daniel Latter 2009/5/1 Daniel Latter dan.lat...@gmail.com mailto:dan.lat...@gmail.com Hi all, I have created a form element that displays a tree structure of categories along with a checkbox a user can select as a html UL element, this requires a recursive function. The way I have implemented this is to extend Zend_Form_Element and then overrode the render method which calls a recursive function that eventually returns the tree as a UL list, with each LI being the category name and checkbox. I was wondering if this is the best way to create such an element? Any advice appreciated.. Thank You Daniel Latter
Re: [fw-general] Replacing Zend_Loader by Zend_Loader_Autoloader
*Notice*: Zend_Loader::Zend_Loader::registerAutoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *207* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* *Notice*: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in *E:\ZendFramework\library\Zend\Loader.php* on line *186* What about Backwards Compatibility? This doesn't look good for sure. Makes me think I should wrap the framework... Bart Matthew Weier O'Phinney schreef: -- holografix . hologra...@gmail.com wrote (on Monday, 27 April 2009, 02:34 PM +0100): I have an application developed with ZF 1.7 and it works fine up to ZF 1.7.8. After update developpment box to ZF to latest trunk version, starting to get notices about Zend_Loader::registerAutoload(), saying it's deprecated and will be removed in 2.0.0. This application follows ZF directory structure and it registers a front controller plugin where resources are initialized. New code in bootstrap.php: require_once 'Zend/Loader/Autoloader.php'; $loader = Zend_Loader_Autoloader::getInstance()-setFallbackAutoloader(true); $loader-registerNamespace('ZendExt_'); $front = Zend_Controller_Front::getInstance(); $front-registerPlugin(new ZendExt_Plugin_Initialize(APPLICATION_ENV)); Resources are initialized but have some problems with loading a form. When opening the application, if one is not logged in, it redirects to index/ login (Form_Login.php) http://application = http://application/login Forms are in a dir called forms under application dir. In login action I have this code public function loginAction() { include APPLICATION_PATH . /forms/Form_Login.php; $loginForm = new Form_Login(); ... validation and authentication } The output is wrong form action=/login method=post id=formlogin name=formlogin fieldset legendLogin/legend form id=username/form form id=password/form form id=submit/form /fieldset /form With Zend_Loader there are no problems. How can I fix the problem ? Use a module autoloader: $module = new
Re: [fw-general] Replacing Zend_Loader by Zend_Loader_Autoloader
For all of you who are also wondering what is needed to replace the good old require_once 'Zend/Loader.php'; Zend_Loader::registerAutoLoad(); This is what is needed in it's most basic form: require_once 'Zend/Loader/Autoloader.php'; $loader = Zend_Loader_Autoloader::getInstance()-setFallbackAutoloader(true); -Bart holografix . schreef: The form class in APPLICATION_PATH\forms\Login.php class Form_Login extends Zend_Form { public function init() { $this-setAction('/login') -setMethod('post') -setName('formlogin') -setAttrib('id', 'formlogin'); // Create and configure username element $username = $this-createElement('text', 'username'); $username-setLabel('User') -addValidator('alnum') -addValidator('stringLength', false, array(3, 15)) -setRequired(true) -setAttrib(size, 20) -setAttrib('maxLength', 20); // Create and configure password element $password = $this-createElement('password', 'password'); $password-setLabel('Password') -addValidator('StringLength', false, array(3, 15)) -setAttrib(size, 20) -setAttrib('maxLength', 20) -setRequired(true); // Create and configure submit button element $submit = $this-createElement('submit', 'submit'); $submit-setRequired(false) -setIgnore(true) -setLabel('Login'); // Add elements to form $this-addElement($username) -addElement($password) -addElement($submit); return $this; } } Thanks for the support holo 2009/4/27 Matthew Weier O'Phinney matt...@zend.com mailto:matt...@zend.com -- holografix . hologra...@gmail.com mailto:hologra...@gmail.com wrote (on Monday, 27 April 2009, 04:18 PM +0100): problem I forgot to tell that this dev box is Win Vista 32 In bootstrap.php: $module = new Zend_Application_Module_Autoloader(array( 'namespace' = '', 'basePath' = APPLICATION_PATH . '/forms' )); Warning: include(C:\wwwroot\devapp\application/forms/forms//Login.php) [ function.include]: failed to open stream: No such file or directory I change 'basePath' from APPLICATION_PATH . '/forms' to APPLICATION_PATH $module = new Zend_Application_Module_Autoloader(array( 'namespace' = '', 'basePath' = APPLICATION_PATH )); Renamed APPLICATION_PATH\forms\Form_Login.php to Login.php and removed the include of this file in controller action. My bad -- I jumped the gun. Yes, basePath = APPLICATION_PATH is what I meant to write. The file is loaded but the output is the same: form action=/login method=post id=formlogin name=loginform fieldset legendLogin/legend form id=username/form form id=password/form form id=submit/form /fieldset /form Can you provide the form class itself so I can take a look at it? Right now, I have no idea what's wrong, nor how it could be generated. Thanks! Cheers holo 2009/4/27 Matthew Weier O'Phinney matt...@zend.com mailto:matt...@zend.com -- holografix . hologra...@gmail.com mailto:hologra...@gmail.com wrote (on Monday, 27 April 2009, 02:34 PM +0100): I have an application developed with ZF 1.7 and it works fine up to ZF 1.7.8. After update developpment box to ZF to latest trunk version, starting to get notices about Zend_Loader::registerAutoload(), saying it's deprecated and will be removed in 2.0.0. This application follows ZF directory structure and it registers a front controller plugin where resources are initialized. New code in bootstrap.php: require_once 'Zend/Loader/Autoloader.php'; $loader = Zend_Loader_Autoloader::getInstance()-setFallbackAutoloader (true); $loader-registerNamespace('ZendExt_'); $front = Zend_Controller_Front::getInstance(); $front-registerPlugin(new ZendExt_Plugin_Initialize(APPLICATION_ENV)); Resources are initialized but have some problems with loading a form. When opening the application, if one is not logged in, it redirects to index/ login (Form_Login.php) http://application http://application/ = http://application/login Forms are in a dir called forms under application dir. In login action I have this code public
Re: [fw-general] How to set up dependant dropdowns in form
You should be using dojo selects in the first place, I have a working example (4files): file index.phtml (in scripts/ directory) ?php echo $this-doctype() ? html head ?php echo $this-headTitle() ? ?php echo $this-headMeta() ? ?php echo $this-headLink() ? ?php echo $this-headStyle() ? ?php $this-dojo()-setLocalPath('/zf/js/dojo/dojo.js') -addStyleSheetModule('dijit.themes.tundra'); echo $this-dojo()-enable(); echo $this-headScript(); ? /head body class=tundra ?php echo $this-form ? ?php echo $this-inlineScript() ? /body /html //following files in root directory file index.php: ?php require_once 'autoload.php'; $view = new Zend_View(); Zend_Dojo::enableView($view); $form = new Zend_Dojo_Form('myform'); $form-setView($view); $autoComplete1 = new Zend_Dojo_Form_Element_FilteringSelect('sel_1'); //$autoComplete1 = new Zend_Form_Element_Select('sel_1'); $autoComplete1-setMultiOptions( array('Cats', 'Dogs') ); $autoComplete1-setAttrib('onchange', dijit.byId('sel_2').searchAttr = dijit.byId('sel_1').getValue();return true); $autoComplete1-setLabel('Select 1'); $form-addElement($autoComplete1); $searchAttribute = @$_GET['sel_1']; if( ! in_array($searchAttribute, array('0', '1'))){ $searchAttribute = '0'; } $form-addElement( 'FilteringSelect', 'sel_2', array( 'label' = 'Select 2', 'storeId' = 'myData', 'storeType'= 'dojo.data.ItemFileReadStore', 'storeParams' = array( 'url' = '/zf/dojo.php',), 'dijitParams' = array( 'searchAttr' = $searchAttribute, ), ) ); $form-addElement('submit','go'); $form-populate($_GET); $view-form = $form-render(); $view-addBasePath('E:\werk\zf fixes\testsite'); echo $view-render('index.phtml'); ? file dojo.php: ?php require_once 'autoload.php'; $data = new Zend_Dojo_Data(); $data-setIdentifier('name'); $cats = array('Lion', 'Cheeta', 'Cat'); foreach ($cats as $key = $cat) { $data-addItem(array('name' = $key, '0' = $cat)); } $dogs = array(3 = 'Bello', 4 = 'Blix', 5 = 'Freddy', 6 = 'Hungry Bill'); foreach ($dogs as $key = $dog) { $data-addItem(array('name' = $key,1 = $dog)); } echo $data; file autoload.php: (depecated) ?php require_once 'Zend/Loader.php'; /** * Loads all Zend Framework classes automagically * * @param string $className */ function __autoload($className){ Zend_Loader::loadClass($className); } ? Hope this helps, Bart 411161 schreef: Ace Paul wrote: I have a form, which I would like to use dependent drop downs in. I can't seem to find anything about it hear, after looking all morning trying to work it out. I have one field race_country when an option is selected I would like to show the cities in that country. The following is what I have currently in the form, which will show all countries and all cities. Any help would be great. thanks $table = new Country(); foreach ($table-fetchAll() as $c) { $country-addMultiOption($c-country_id, $c-country_name); } $this-addElement( $country); $city = new Zend_Form_Element_Select('race_city'); $city-setLabel('City') -setRequired(true); $table = new City(); foreach ($table-fetchAll() as $c) { $city-addMultiOption($c-city_id, $c-city_name); } $this-addElement( $city); Does anyone have a complete example of this? I used this example to get it up and going: http://techchorus.net/autocomplete-example-zenddojoformelementfilteringselect-and-zenddojodata With the change located in the comments: div dojoType=dojo.data.ItemFileReadStore url=/strain/list jsId=strainStore/div but I am having trouble trying to do dependent drop downs. Any good references out there, or is this too early to attempt with Zend Dojo?
Re: [fw-general] ZendX_JQuery not loaded using Zend_Application
I think you should call enable() on your jQuery() view helper. This is what is done automatically if you use the ajaxLink, hence the different behavior. -Bart Bagus Nugroho schreef: Hi, I have put ?= $this-jQuery() ? in the head, but JQuery still not loaded on browser. Is anyone have same problem? Thanks, Regards, bn *From:* Jay M. Keith [mailto:googla...@gmail.com] *Sent:* Fri 17-Apr-2009 11:12 *To:* Bagus Nugroho *Cc:* fw-general *Subject:* Re: [fw-general] ZendX_JQuery not loaded using Zend_Application In your layout (if you're using layouts), do you have something like ?= $this-jQuery() ? in the head? Regards, Jay M. Keith On Thu, Apr 16, 2009 at 8:36 PM, Bagus Nugroho bnugr...@unisemgroup.com wrote: Hi All, I'm trying using ZendX_JQuery within Zend_Application, which generated by Zend_Tool and edited Bootstrap.php, refer 'storefront' to add ZendX_JQuery as the following : Bootstrap.php=== // protected function _initView() { $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $viewRenderer-init(); $this-_view = $viewRenderer-view; $this-_view-setEncoding('UTF-8'); $this-_view-doctype('XHTML1_STRICT'); $this-_view-headTitle('Development'); //Load themes $this-_view-headLink()-appendStylesheet('/themes/base/ui.all.css'); // Add jQuery $this-_view-addHelperPath('ZendX/JQuery/View/Helper','ZendX_JQuery_View_Helper'); $this-_view-jQuery()-setLocalPath('../scripts/jquery-1.3.2.min.js'); $this-_view-jQuery()-setUiLocalPath('../scripts/jquery.ui/jquery-ui.min.js'); Zend_Layout::startMvc(array('layout' = 'main', 'layoutPath' = APPLICATION_PATH . '/layouts/scripts' )); } // why jquery library not loaded when I'm load the page. But jquery library loaded, when I add the following code on scripts(index.phtml) index.phtml== ?= $this-ajaxLink(Show me something, /index/demo, array('update' = '#content')); ? div id=content/div Is I'm missing something? Thanks in advance, bn
Re: [fw-general] Zend_Form_Element_File and previewing
I haven't done this, but I would upload the files using ajax an I think you should be looking at Zend_Http_Request for that and store the filenames in hidden formElements for persistence. -Bart Justin Hendrickson schreef: I'm trying to create a Zend_Form that contains a couple of Zend_Form_Element_File elements, amongst other things. I want to support previewing the content before submitting, but I'm not sure how to make the file elements stick from the preview to the submit. Has anyone found a good way of handling this?
Re: [fw-general] Zend_Navigation
What I see mostly to solve this is: if (null !== ($t=$this-getUseTranslator())) { // it comes down to the same, but it is slightly more specific } Personally, I just ignore the complaints of ZS about assignments in conditions. -Bart Lucas Thompson schreef: On Wed, Apr 15, 2009 at 6:05 PM, Michael Scholl mich...@sch0ll.de wrote: I read many different things about that… (Zend Studio throws errors on asssignments in if/while statements) Would be really interesting how other developers think about that!!! FWIW, Zend Studio doesn't complain if you nest the assignment in another set of parenthesis: code if(($t=$this-getUseTranslator())) { // no warning from Zend Studio about } /code Personally, I don't mind that syntax as long as a sane default for $t is set beforehand.
Re: [fw-general] Decorate MultiCheckbox
Fire Eye'd Boy schreef: Hi people, I'm trying to create the following output from a MultiCheckbox: ul li input type=checkbox name=somename[] class=checkbox object!-- flash object --/object /li li input type=checkbox name=somename[] class=checkbox img src=some/image.jpg alt= /li etc... ul So, basically an unordered list. With each list item having a checkbox, with either a Flash object or an image as 'label' for the checkbox. But the 'real label' element is not necessery. In fact, I'ld rather ditch 'em in this case. I'm pretty sure this can't be done with standard decorators, but before I start writing my own viewhelper I wanted to consult you people to see if it is possible anyway. Especially since I'm in kind of a hurry and writing my own viewhelper would make me have to dig into the 'howto' of creating these first. So my question is: is the above example achievable with standard decorators? I don't think it is. -Bart Thank you in advance.
Re: [fw-general] classic: headers already sent
till schreef: On Thu, Apr 9, 2009 at 2:45 PM, Bart McLeod mcl...@spaceweb.nl wrote: shell_exec returns the output from the shell, any chance that is outputting something? -Bart Yeah, so I narrowed it down to a system() call (in another method which is used in the first) -- supposedly trapped in ob_start() and ob_end_clean(). I don't know why that didn't work. It still works on other PHP versions (see my first email in this thread). So what I am doing now is this: $response = shell_exec($cmd); And are you saying this works now, or still not? -Bart Before: ob_start(); system($cmd); $response = ob_get_contents(); ob_end_clean(); Till
Re: [fw-general] classic: headers already sent
shell_exec returns the output from the shell, any chance that is outputting something? -Bart till schreef: On Thu, Apr 9, 2009 at 12:41 PM, Matthew Weier O'Phinney matt...@zend.com wrote: -- till klimp...@gmail.com wrote (on Thursday, 09 April 2009, 11:36 AM +0200): I've updated one of our nodes to Apache 2.2.11 and PHP 5.2.9 today, since then I've been getting the following error: [Wed Apr 08 14:21:14 2009] [error] [client 10.0.0.10] PHP Fatal error: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in , line 0' in /usr/www/5.2/library/Zend/Controller/Response/Abstract.php:281\nStack trace:\n#0 /usr/www/5.2/library/Zend/Controller/Response/Abstract.php(299): Zend_Controller_Response_Abstract-canSendHeaders(true)\n#1 /usr/www/5.2/library/Zend/Controller/Response/Abstract.php(727): Zend_Controller_Response_Abstract-sendHeaders()\n#2 /usr/www/5.2/library/Zend/Controller/Front.php(972): Zend_Controller_Response_Abstract-sendResponse()\n#3 /usr/www/5.2/www/index.php(28): Zend_Controller_Front-dispatch()\n#4 {main}\n thrown in /usr/www/5.2/library/Zend/Controller/Response/Abstract.php on line 281, referer: http://server/import/process Yeah -- no file and line 0. I've traced the exception to a redirector call, but I don't see what could have changed in between the PHP releases. It works with Apache 1.3.X and PHP 5.2.6 and 5.2.8. The version of the framework is 1.7.6 everywhere. I haven't tried more recent version since this looks like it's not a problem in userland code. Besides the Apache and the PHP I don't see any obvious differences - guess that is enough to break, but would anyone have any idea? Googling the error hints at a server misconfiguration, but I don't seem to be able to figure out what went wrong. Has anyone seen this before? Nope. Any chance there's an automatic prepend file setup in your php.ini? or that there's a trailing ? in one of your files that has trailing whitespace? None of that. We generally omit ? to combat that. The file in question works in other situations and now I've traced it down to a method where I call it, it breaks, when I don't -- it works. Inside this method are a bunch of shell_exec calls to run processors (for various ms office file types and pdf) on the shell. I mean, I guess it's possible that something breaks in there, but I have no idea why headers_sent() doesn't know about it then. Like it should tell me the filename and the line where something was issued. Then again, PHP could not know about what happens inside shell_exec() calls, right? That could be a fork caveat but since I had a httpd which forked before, I don't see the fundamental difference (yet). Till
Re: [fw-general] new line character in textarea
More specifically, this is caused by the default filter 'stringTrim'. You can set the element filters on the form to change filtering behavior. -Bart Vadim Gabriel schreef: Hey, I would assume this to be a standard feature. It trims empty spaces and lines. Why would you want to keep an extra empty line? For me for example this is the right way of doing this. And i don't see this as a bug. Vince. On Tue, Apr 7, 2009 at 12:23 PM, Aniketto aniket_ked...@rediffmail.com mailto:aniket_ked...@rediffmail.com wrote: Hi all, I am using lot many textarea elements in my project. I am facing following problem. 1. Hit Enter 2 times(i.e. enter two empty lines). 2. Enter some text. 3. Now I save this data using a submit button. 4. After submitting when the page reloads one enter(empty line ) in lost. The textarea field in zend framework is defined in such a way that one new line always gets lost. I think this is bug in zend framework. Can anybody suggest remedy to this? I am searching a generic solution which applied at one place will solve problem of all my textareas. Please help... Thanks, Aniketto -- View this message in context: http://www.nabble.com/new-line-character-in-textarea-tp22925431p22925431.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Vincent Gabriel. Lead Developer, Senior Support. Zend Certified Engineer. Zend Framework Certified Engineer.
Re: [fw-general] new line character in textarea
oops, sorry for the misinformation. I should have asked if maybe he had added a stringTrim filter, but then he would have lost both newlines...so that leaves us wondering which browser is doing this. Matthew Weier O'Phinney schreef: -- Bart McLeod mcl...@spaceweb.nl wrote (on Tuesday, 07 April 2009, 03:47 PM +0200): More specifically, this is caused by the default filter 'stringTrim'. You can set the element filters on the form to change filtering behavior. Actually... there are no default filters on any Zend_Form elements, much less a default filter of StringTrim. Most likely this is a browser behavior. Vadim Gabriel schreef: Hey, I would assume this to be a standard feature. It trims empty spaces and lines. Why would you want to keep an extra empty line? For me for example this is the right way of doing this. And i don't see this as a bug. Vince. On Tue, Apr 7, 2009 at 12:23 PM, Aniketto aniket_ked...@rediffmail.com wrote: Hi all, I am using lot many textarea elements in my project. I am facing following problem. 1. Hit Enter 2 times(i.e. enter two empty lines). 2. Enter some text. 3. Now I save this data using a submit button. 4. After submitting when the page reloads one enter(empty line ) in lost. The textarea field in zend framework is defined in such a way that one new line always gets lost. I think this is bug in zend framework. Can anybody suggest remedy to this? I am searching a generic solution which applied at one place will solve problem of all my textareas. Please help... Thanks, Aniketto -- View this message in context: http://www.nabble.com/ new-line-character-in-textarea-tp22925431p22925431.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Vincent Gabriel. Lead Developer, Senior Support. Zend Certified Engineer. Zend Framework Certified Engineer.
Re: [fw-general] Zend_Config_Ini and
Does there not exist something like unhtmlentities() that you can call on the value to get rid of amp;? -Bart PHPScriptor schreef: Well, I don't think that's going to work. 'Cause I want to use it for a unix command. in my config.ini: application.job = /usr/local/bin/php /home/admin/domains/app/jobs/job.php /dev/null 2 /dev/null With this command I execute a php job in the background with passthru, so that I don't have to wait until the script is finished. But the unix command doesn't know amp; vince. wrote: Hey, Use the HTML Entity which is amp; - visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/
Re: [fw-general] Zend_Config_Ini and
the quotes are indeed required by the ini format AND php 5.3 on *.nix (we found out lately), the manual has some examples without quotes... -Bart Paweł Chuchmała schreef: application.job = /usr/local/bin/php /home/admin/domains/app/jobs/job.php /dev/null 2 /dev/null Doesn;t work? On Mon, Apr 6, 2009 at 10:51, PHPScriptor cont...@phpscriptor.com wrote: Well, I don't think that's going to work. 'Cause I want to use it for a unix command. in my config.ini: application.job = /usr/local/bin/php /home/admin/domains/app/jobs/job.php /dev/null 2 /dev/null With this command I execute a php job in the background with passthru, so that I don't have to wait until the script is finished. But the unix command doesn't know amp; vince. wrote: Hey, Use the HTML Entity which is amp; - visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/ -- View this message in context: http://www.nabble.com/Zend_Config_Ini-and---tp22904165p22904651.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] new Translation functionality in Zend_Form buttons
Hi all, I just wanted to let you all know I have added new translation functionality to Zend_Form buttons: Submit, Reset, Button and Image. The title attribute is now translated automatically if you have a translator on your form (or registered in Zend_Registry with key 'Zend_Translate', of course). This means you can now have translated tooltips on your form buttons without having to translate those manually by passing in the translated value of the title attribute yourself. This is accomplished by the new Zend_Form_Decorator_Tooltip that does nothing but translate the title attribute before rendering the button. This decorator is loaded as the first decorator in loadDefalutDecorators inside Zend_Form_Element_Submit and Zend_Form_Element_Image. Reset and Button inherit from Submit. Since I have no experience with updating the manual and little English writing skills, I would appreciate it if anyone would care to update the manual accordingly. Note that if you replace all the decorators by calling setDecorators(), your tooltips will only get translated if you add the tooltip decorator as the first decorator. Bart McLeod
Re: [fw-general] Zend Framework SVN visualized
Nice, really! My username floating through the Zend Galaxy towards the end of 2008, really nice. I wish I got that bored at times... -Bart keith Pope schreef: Hi, I was bored and decided to visualize the trunk of the project: http://www.vimeo.com/3924986 Enjoy :)
[fw-general] Zend_Form_Element_Image title attribute does not get translated
Hi all, I am hesitating to file an issue about this, so I would like to know if anyone of you already has done so, or maybe I am just mistaken. If I use a Zend_Form_Element_Image to submit a form, I want a tooltip on the image, so that users do not have to guess what the image button does. To my surprise, when I use the title attribute for the tooltip it does not get translated, while every other label in the form and even multioptions do get translated. I have verified that translations are available for the tooltips in the *.csv language file. Anyone? If it is by design, please let me know, if it is just forgotten, I will file an issue and try to fix it. Bart
Re: [fw-general] Zend_Form_Element_Image title attribute does not get translated - proposal for translation
Please find a (working) proposal for translation of the title attribute of the image form element. Is this the right approach or do I need to specify elsewhere that this has to be translated? I guess a problem could arise because, for example, this test would fail (assert-same($title, $image-getAttrib('title'))) if the title has been translated...while being set. It is also easy to override the render method and translate the title attribute -if present- just before render. Do I need a whole different approach or is either of the two ok? Matthew? Jurrien? /** * Set the title (tooltip) for the image button. The tooltip will be translated if a translator * is available and not disabled. * * @param string $title * @return provides a fluent interface */ public function setTitle($title){ // translate title (tooltip) if (!$this-_translatorDisabled and $this-getTranslator()) { $title = $this-getTranslator()-translate($title); } $this-setAttrib('title', $title); return $this; } Bart McLeod schreef: Hi all, I am hesitating to file an issue about this, so I would like to know if anyone of you already has done so, or maybe I am just mistaken. If I use a Zend_Form_Element_Image to submit a form, I want a tooltip on the image, so that users do not have to guess what the image button does. To my surprise, when I use the title attribute for the tooltip it does not get translated, while every other label in the form and even multioptions do get translated. I have verified that translations are available for the tooltips in the *.csv language file. Anyone? If it is by design, please let me know, if it is just forgotten, I will file an issue and try to fix it. Bart
Re: [fw-general] file decorator not found, while present in latest trunk - gets even stranger
But this testfile.php runs without any trouble: ?php require_once 'Zend/Loader.php'; Zend_Loader::registerAutoLoad(); $view = new Zend_View(); $fileElement = new Zend_Form_Element_File('image'); echo $fileElement-render($view); Beats me. -Bart Bart McLeod schreef: both calls do no longer work in latest trunk: $image = $this-createElement('file', 'image_upload', array('label' = 'image')); NOR $image = new Zend_Form_Element_File('image_upload', array('label' = 'image')); This is the error: Exception caught by form: No file decorator found... unable to render file element Stack Trace: #0 E:\ZendFramework\library\Zend\Form\Decorator\FormElements.php(101): Zend_Form_Element_File-render() #1 E:\ZendFramework\library\Zend\Form.php(2595): Zend_Form_Decorator_FormElements-render('') #2 E:\ZendFramework\library\SpaceCMS\Form.php(46): Zend_Form-render(NULL) #3 E:\werk\cuddlefish\application\admin\models\forms\FormItem.php(93): SpaceCMS_Form-render(NULL) #4 E:\ZendFramework\library\Zend\Form.php(2610): FormItem-render() #5 E:\werk\cuddlefish\application\admin\views\scripts\items\form.phtml(1): Zend_Form-__toString() #6 E:\ZendFramework\library\Zend\View.php(107): include('E:\werk\cuddlef...') #7 E:\ZendFramework\library\Zend\View\Abstract.php(787): Zend_View-_run('E:\werk\cuddlef...') #8 E:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(902): Zend_View_Abstract-render('items/form.phtm...') #9 E:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(923): Zend_ in bE:\ZendFramework\library\Zend\Form.php/b on line b2615/bbr / While in the filesystem, I can see both the element and the decorator and I have autoloading enabled Anyone? A few days ago, this element seemed to work, according to the posts here. Bart
Re: [fw-general] file decorator not found, while present in latest trunk - gets even stranger
ok, was in my grouping definitions once more, I have to preserve the specific decorator for the file element -Bart Bart McLeod schreef: But this testfile.php runs without any trouble: ?php require_once 'Zend/Loader.php'; Zend_Loader::registerAutoLoad(); $view = new Zend_View(); $fileElement = new Zend_Form_Element_File('image'); echo $fileElement-render($view); Beats me. -Bart Bart McLeod schreef: both calls do no longer work in latest trunk: $image = $this-createElement('file', 'image_upload', array('label' = 'image')); NOR $image = new Zend_Form_Element_File('image_upload', array('label' = 'image')); This is the error: Exception caught by form: No file decorator found... unable to render file element Stack Trace: #0 E:\ZendFramework\library\Zend\Form\Decorator\FormElements.php(101): Zend_Form_Element_File-render() #1 E:\ZendFramework\library\Zend\Form.php(2595): Zend_Form_Decorator_FormElements-render('') #2 E:\ZendFramework\library\SpaceCMS\Form.php(46): Zend_Form-render(NULL) #3 E:\werk\cuddlefish\application\admin\models\forms\FormItem.php(93): SpaceCMS_Form-render(NULL) #4 E:\ZendFramework\library\Zend\Form.php(2610): FormItem-render() #5 E:\werk\cuddlefish\application\admin\views\scripts\items\form.phtml(1): Zend_Form-__toString() #6 E:\ZendFramework\library\Zend\View.php(107): include('E:\werk\cuddlef...') #7 E:\ZendFramework\library\Zend\View\Abstract.php(787): Zend_View-_run('E:\werk\cuddlef...') #8 E:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(902): Zend_View_Abstract-render('items/form.phtm...') #9 E:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(923): Zend_ in bE:\ZendFramework\library\Zend\Form.php/b on line b2615/bbr / While in the filesystem, I can see both the element and the decorator and I have autoloading enabled Anyone? A few days ago, this element seemed to work, according to the posts here. Bart
Re: [fw-general] file decorator not found, while present in latest trunk - gets even stranger
That is brilliant indeed, Bart Thomas Weidner schreef: In past you would just have wondered why file uploads do not work. Now you get an exception and are directly pointed to the problem. :-) Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: Bart McLeod mcl...@spaceweb.nl To: fw-general fw-general@lists.zend.com Sent: Tuesday, February 10, 2009 9:56 AM Subject: Re: [fw-general] file decorator not found, while present in latest trunk - gets even stranger ok, was in my grouping definitions once more, I have to preserve the specific decorator for the file element -Bart Bart McLeod schreef: But this testfile.php runs without any trouble: ?php require_once 'Zend/Loader.php'; Zend_Loader::registerAutoLoad(); $view = new Zend_View(); $fileElement = new Zend_Form_Element_File('image'); echo $fileElement-render($view); Beats me. -Bart Bart McLeod schreef: both calls do no longer work in latest trunk: $image = $this-createElement('file', 'image_upload', array('label' = 'image')); NOR $image = new Zend_Form_Element_File('image_upload', array('label' = 'image')); This is the error: Exception caught by form: No file decorator found... unable to render file element Stack Trace: #0 E:\ZendFramework\library\Zend\Form\Decorator\FormElements.php(101): Zend_Form_Element_File-render() #1 E:\ZendFramework\library\Zend\Form.php(2595): Zend_Form_Decorator_FormElements-render('') #2 E:\ZendFramework\library\SpaceCMS\Form.php(46): Zend_Form-render(NULL) #3 E:\werk\cuddlefish\application\admin\models\forms\FormItem.php(93): SpaceCMS_Form-render(NULL) #4 E:\ZendFramework\library\Zend\Form.php(2610): FormItem-render() #5 E:\werk\cuddlefish\application\admin\views\scripts\items\form.phtml(1): Zend_Form-__toString() #6 E:\ZendFramework\library\Zend\View.php(107): include('E:\werk\cuddlef...') #7 E:\ZendFramework\library\Zend\View\Abstract.php(787): Zend_View-_run('E:\werk\cuddlef...') #8 E:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(902): Zend_View_Abstract-render('items/form.phtm...') #9 E:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(923): Zend_ in bE:\ZendFramework\library\Zend\Form.php/b on line b2615/bbr / While in the filesystem, I can see both the element and the decorator and I have autoloading enabled Anyone? A few days ago, this element seemed to work, according to the posts here. Bart
[fw-general] file decorator not found, while present in latest trunk
both calls do no longer work in latest trunk: $image = $this-createElement('file', 'image_upload', array('label' = 'image')); NOR $image = new Zend_Form_Element_File('image_upload', array('label' = 'image')); This is the error: Exception caught by form: No file decorator found... unable to render file element Stack Trace: #0 E:\ZendFramework\library\Zend\Form\Decorator\FormElements.php(101): Zend_Form_Element_File-render() #1 E:\ZendFramework\library\Zend\Form.php(2595): Zend_Form_Decorator_FormElements-render('') #2 E:\ZendFramework\library\SpaceCMS\Form.php(46): Zend_Form-render(NULL) #3 E:\werk\cuddlefish\application\admin\models\forms\FormItem.php(93): SpaceCMS_Form-render(NULL) #4 E:\ZendFramework\library\Zend\Form.php(2610): FormItem-render() #5 E:\werk\cuddlefish\application\admin\views\scripts\items\form.phtml(1): Zend_Form-__toString() #6 E:\ZendFramework\library\Zend\View.php(107): include('E:\werk\cuddlef...') #7 E:\ZendFramework\library\Zend\View\Abstract.php(787): Zend_View-_run('E:\werk\cuddlef...') #8 E:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(902): Zend_View_Abstract-render('items/form.phtm...') #9 E:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(923): Zend_ in bE:\ZendFramework\library\Zend\Form.php/b on line b2615/bbr / While in the filesystem, I can see both the element and the decorator and I have autoloading enabled Anyone? A few days ago, this element seemed to work, according to the posts here. Bart
Re: [fw-general] partialLoop() best practice
I do not know if it's the best way, but could you not prepare all the arrays and variables and pass those to the first partialLoop, which passes certain levels to the next nested one and so on? -Bart bytte schreef: I use a partialLoop() to loop through query results in the view. So far so good. But for every item returned in the loop, I need to do another database query that returns another set of results that require a new partialLoop(). In the end I have a partialLoop() inside a partialLoop() inside a partialLoop(). But to be able to do the above, I have database queries and some php logic in the view inside every partialLoop() and that doesn't seem right if I want to follow the MVC principle. Is there a way to solve this?
Re: [fw-general] Unable to create issue in jira
did you sign your CLA? -Bart Giorgio Sironi schreef: I have an account in Jira (http://framework.zend.com/issues/secure/Dashboard.jspa) with the user name 'giorgiosironi' and I am able to login, but no to create a new issue for any Zend_* project. The button in the top green bar simply disappeared. I've read on some forums to login with a full-lowercase username, but it is already my case. -- Giorgio Sironi Piccolo Principe Ossigeno Scripter http://www.sourceforge.net/projects/ossigeno
Re: [fw-general] Unable to create issue in jira
Sorry for my disinformation at this point. -Bart Marco schreef: The phrase has to be changed in care to print a Cla, sign it, do a 1500+ pixel wide scan and send it to us, wait to be moved your issue tracker user in the developer group, and then file an issue?. IMHO lowering the entry barrier for an user should be useful, there's not intellectual property in a filed bug/feature request. AIUI you actually don't need to sign the CLA to post issues, you just need to send an email to c...@zend.com mailto:c...@zend.com with your username. This was done as Thomas said to stop spammers from hijacking the issue tracker. Regards Marco
Re: [fw-general] get the action in the view
in your action controller: $this-view-actionName = $this-getRequest()-getActionName(); in your view: you can download ?= $This-actionName ? free from... That should do it. Bart PHPScriptor schreef: Hey, Is it possible to get the action (and controller) name in the view? I have a menu at the left of my site where I show some tips depending on the page where the visitors are. e.g. If the url is http://localhost/php/zend I want to show the visitor a tip like 'you can download zend free from...'. If the url is http://localhost/php/pear 'you can download pear free from'... So I need the know the action. I don't mind if it is directly or through a view helper. thanks! - visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/
Re: [fw-general] get the action in the view
Much more professional approach this is, if you need it everywhere... Bart Rob Allen schreef: On 19 Jan 2009, at 08:01, Bart McLeod wrote: in your action controller: $this-view-actionName = $this-getRequest()-getActionName(); in your view: you can download ?= $This-actionName ? free from... If you need this in all your views, you can also automate it with a plug-in: class App_Controller_Plugin_ViewSetup extends Zend_Controller_Plugin_Abstract { public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) { $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $viewRenderer-init(); // set up variables that the view may want to know $viewRenderer-view-module = $request-getModuleName(); $viewRenderer-view-controller = $request-getControllerName(); $viewRenderer-view-action = "" } } and in your bootstrap: $frontController = Zend_Controller_Front::getInstance(); $frontController-registerPlugin(new App_Controller_Plugin_ViewSetup()); Regards, Rob... -- Bart McLeod Space Web Internet Team Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
[fw-general] Zend_Locale bug?
Anyone seen this one: $list = Zend_Locale::getTranslationList('language','en'); Gives a list of dialects instead of languages. It worked a few weeks ago, and now it has changed after a recent checkout from svn. I will search the issuetracker for it and if I do not find it, wil file an issue. Bart
Re: [fw-general] Zend_Locale bug?
I'm on a local box with a fresh project with no caching enabled or even implemented. Does it create a cache of its own accord? Bart Thomas Weidner schreef: Delete your cache. Probably cached data was overwritten by someone. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: Bart McLeod mcl...@spaceweb.nl To: fw-general fw-general@lists.zend.com Sent: Thursday, January 15, 2009 12:06 PM Subject: [fw-general] Zend_Locale bug? Anyone seen this one: $list = Zend_Locale::getTranslationList('language','en'); Gives a list of dialects instead of languages. It worked a few weeks ago, and now it has changed after a recent checkout from svn. I will search the issuetracker for it and if I do not find it, wil file an issue. Bart
Re: [fw-general] Zend_Locale bug?
No, it's not a bug just different behavior. I have to sort the list now to find the languages I'm looking for. There were just too many! I overlooked those I needed because the list was no longer sorted. Bart Bart McLeod schreef: I'm on a local box with a fresh project with no caching enabled or even implemented. Does it create a cache of its own accord? Bart Thomas Weidner schreef: Delete your cache. Probably cached data was overwritten by someone. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: Bart McLeod mcl...@spaceweb.nl To: fw-general fw-general@lists.zend.com Sent: Thursday, January 15, 2009 12:06 PM Subject: [fw-general] Zend_Locale bug? Anyone seen this one: $list = Zend_Locale::getTranslationList('language','en'); Gives a list of dialects instead of languages. It worked a few weeks ago, and now it has changed after a recent checkout from svn. I will search the issuetracker for it and if I do not find it, wil file an issue. Bart
Re: [fw-general] Updates to Zend_Wildfire (Firebug/FirePHP logger)
What I think is that you should do more promotion about firePHP offering ZF integration: I did regular firePHP and even put the libraries on the server, while I now understand they are actually in the framework (? or are the libraries still needed, will have to read more docs :-) where do I find the time). Keep up the good work! Bart Christoph Dorn schreef: I have made some important updates to Zend_Wildfire. Code is in the SVN trunk. When logging objects in frameworks like ZF there can be many object members that while important to the framework are of less interest when debugging. If these members are logged they bloat the log message that is sent to the client, they will slow down the client UI and make it harder to inspect the members you actually want to see. You can now exclude specific object members by class name and member name with: $firephp = Zend_Wildfire_Plugin_FirePhp::getInstance(); $firephp-setObjectFilter('Class_Name',array('Member1','Member2')); When logging objects and arrays you can now limit the depth with: $firephp-setOption('maxObjectDepth',3); $firephp-setOption('maxArrayDepth',3); You can also limit the number of steps in traces with: $firephp-setOption('maxTraceDepth',3); By default file and line information is now sent for each log message. You can disable this with: $firephp-setOption('includeLineNumbers',false); Let me know what you think! -- Christoph Dorn http://www.ChristophDorn.com/ -- Bart McLeod Space Web Internet Team Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!
[fw-general] bug in Zend_Config_Writer_Ini
Hi all, I created an issue: http://framework.zend.com/issues/browse/ZF-5544 It is about an ini file that can not be written if the Zend_Config object passed to the writer does not contain any sections. I also supplied a patch. Would appreciate if all of you ini writers would try if this patch does not break your current writing of ini files. Bart McLeod
Re: [fw-general] Best Practices: Eliminate redundancy within various controller init methods?
You can of course have a base custom controller, but you do not need to. Depending on what you need exactly you can use either an action helper in the init method or a plugin or both a plugin and an action helper. public function init(){ $this-_helper-myInit(); //instead of your six lines of code } Bart Giuliano Riccio schreef: You can make a custom controller to make all the others... something like this: class My_Controller_Action extends Zend_Controller_Action { public function init() { // your common code } } Then you will use it like this: class IndexController extends My_Controller_Action { // optional function to use to add more stuff to the default init public function init() { // some code parent::init(); // use this anywhere inside this function to call the default init // some code } } Hope it helps ;) Giuliano jasonzfw wrote: Hi, Been using the ZFW for a few weeks now, and love it. I have a pretty good grasp on the key features, however there's one obstacle I can't seem to surpass. My site is broken into about 7 different controllers, and I store all configuration data in config.ini. Currently within each controller init() method I redundantly include the same 5-6 lines of code which perform various calculations, such as determining the number of registered users. This information is subsequently displayed within the page header. For instance, you'll find this line within each of my controllers' init() methods: $this-view-totalUsers = $user-getUserCount(); (obviously this data is cached using Zend_Cache, I'm just keeping it simple here) For that matter, several of my controller actions use config.ini parameters, so the following line is currently found in every controllers' init() method: $this-config = Zend_Registry::get('config'); I've seemingly tried everything, including creating a custom front controller plugin and defining a preDispatch() method. However the variable scope seems limited to that method, as I'm unable to retrieve $this-config within my controllers. Surely there's a recommended way to manage these lines of code in a single location? While this works, I'd much rather avoid having to redundantly maintain the same lines of code in each controller action. Thank you! Jason
Re: [fw-general] Is javascript framework integration into ZF really that beneficial?
Yes, y're off base. What you write about a lot of work is totally true, compared to regular jquery work. However, once you have good integration, reuse is easy and constistent. Consistency will make your life easier in the end. If you want it real easy, use Zend_Dojo instead of JQuery. But keep in mind that Zend_Dojo will have to mature a little. Not everything advanced works a nicely as you would expect. Same is true for ZendX by the way. Bart sprynmr schreef: I'm still learning more about the javascript integration through the jquery xtra shipped with 1.7, but when I look at all the hoops you have to jump through to do some basic things with javascript in the Zend way... I just get the feeling its more trouble than its worth. The jquery plugin viewhelpers are nice... but do I really want my javascript that tied in to my php? And for that matter do I want to write a new view helper for every jquery plugin I develop (or use?) It seems like its handicapping you a little bit, or at the very least forcing you to do quite a bit of extra work to do anything advanced. I think I might go the way of dynamic javascript includes... where controllers not only automatically render their associated view (via name matching), but also include their associated javascript. This would be great for javascript instantiation. Then you could also have a library of reusable js that can be dynamically included via the various classes you use in your view (identified by their matching name). It really seems this jquery/zend integration is quite the opposite of the jquery motto... write less, do more. Am I totally off base? Robert
Re: [fw-general] Date format problem
What I learned recently is that if you are not using ISO dates, you should use the 'y'specifier instead of 'Y'. So Zend_Date::isDate('2009-01-02','-MM-DD'), maybe it has nothing to do with your problem, but you may try. Bart Bertil Wergelius schreef: Hi, I'm trying to know whats wrong with this: require_once 'Zend/Date.php'; if (Zend_Date::isDate('2009-01-02','-MM-DD')) { echo Date OK; } else { echo Not OK; } It works as expected locally on ubuntu (php 5.2.4, ZendF 1.7) Date OK but not on red hat enterprise server (php 516 ZendF 1.7) Not OK I started to test because this worked on ubuntu but not on the RH server: $datumValidering = new Zend_Validate_Date('d/m '); $datumruta-addValidator($datumValidering); Am I missing anything or is there something wrong with RH. The locale on the RH is sv_SE.iso885915 while it is sv_SE.UTF-8 on the ubuntu. Could that have something to do with it.
Re: [fw-general] Zend_Gdata problem
maybe take a look at Zend_File? I did not try it yet myself. Bart phpbrat schreef: Thanks a lot Bart ! it works now ! Another help needed :) how can i get video filetype 'n filesize for a video from youtube api using Zend framework ? thx again ... Bart McLeod wrote: try{ //have a party }catch(Zend_Gdata_App_HttpException $e){ //log error and continue your party if ($iNeedTheError){ log($e-getMessage()); } } -Bart phpbrat schreef: Hello all!, I am getting some errors when i am calling the function $yt-getVideoEntry() for fetching upoaded Video details through the Zend framework for Youtube API... It works fine for the successful uploads but it throws error for those Videos which are displayed as rejected/duplicates in MyVideos List. Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 404 Video not found' in How this error can be avoided so that script doesn't halts ??? can somebody suggest how to do this ?!!! Or any workaround needed in the Zend framework.. Plz reply ASAP. Thanks in Advance.. View this message in context: Re: Zend_Gdata problem http://www.nabble.com/Zend_Gdata-problem-tp18165877p21142264.html Sent from the Zend Framework mailing list archive http://www.nabble.com/Zend-Framework-f15440.html at Nabble.com.
Re: [fw-general] Custom form element - passing options to viewHelper
to see examples, take a look at how dojo view_helpers use options. Bart petewilliams1983 schreef: I'm trying to do exactly the same thing. So far the best solution I can come up with is to pass my custom options in via either the $attribs or $options arrays. You can then process those options within your view helper, and delete them from the array so that they aren't added to the element markup. However I'm pretty sure this isn't the best way of doing things. Pete
Re: [fw-general] Zend_Gdata problem
try{ //have a party }catch(Zend_Gdata_App_HttpException $e){ //log error and continue your party if ($iNeedTheError){ log($e-getMessage()); } } -Bart phpbrat schreef: Hello all!, I am getting some errors when i am calling the function $yt-getVideoEntry() for fetching upoaded Video details through the Zend framework for Youtube API... It works fine for the successful uploads but it throws error for those Videos which are displayed as rejected/duplicates in MyVideos List. Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 404 Video not found' in How this error can be avoided so that script doesn't halts ??? can somebody suggest how to do this ?!!! Or any workaround needed in the Zend framework.. Plz reply ASAP. Thanks in Advance..
[fw-general] question about use of Zend_Controller_Action_HelperBroker
Hi All, I want to use the redirector helper from within another action helper and I call: Zend_Controller_Action_HelperBroker::getHelper('redirector')-goto('index'); This yields an error: Fatal error: Cannot access protected property Shop_Action_Helper_InitShop::$_actionController in D:\ZendFramework\library\Zend\Controller\Action\HelperBroker.php on line 305 Should I use magic __get to return $this-_actionController, or is this a bug and should the helper broker call $this-getActionController for example? Or should I not call this static function from within an action helper? It also happens if I use this static call from within an action controller, but there I circumvented the error by: public $_actionController;//bug workaround in my action controller, but this is a hack of course. Or should I not be calling it statically at all? I think I saw an example somewhere that demonstrated static usage. Bart -- Bart McLeod Space Web Internet Team Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ i...@spaceweb.nl www.spaceweb.nl Bart McLeod is a Zend Certified Engineer. Click to verify!