[fw-general] Not able to get file upload to be working
Hi, I want to upload several pictures, and i try to use the Zend_Form_Element_File. These are the error messages i get: Notice: Undefined index: tmp_name in /library/Zend/File/Transfer/Adapter/Abstract.php on line 577 Warning: Invalid argument supplied for foreach() in /library/Zend/Validate/File/Count.php on line 217 Notice: Undefined index: tmp_name in /library/Zend/File/Transfer/Adapter/Abstract.php on line 577 Warning: Invalid argument supplied for foreach() in /library/Zend/Validate/File/FilesSize.php on line 94 Notice: Undefined index: tmp_name in /library/Zend/File/Transfer/Adapter/Abstract.php on line 577 Notice: Undefined index: name in /library/Zend/Validate/File/Extension.php on line 198 What am i doing wrong? In my form i have: $file = new Zend_Form_Element_File('file'); $file-setLabel('File') -setDestination('/tmp') -addFilter('Rename', '/tmp/') -setRequired(true) -addValidator('Count', false, 1) // ensure only 1 file -setMaxFileSize(10 * 1024 * 1024) // limit to 10M -addValidator('FilesSize', true, '10MB') -addValidator('Extension', true, 'png'); // PNG in my controller i have: $this-view-title = Zend_Form File Upload test; $this-view-baseUrl = $this-_request-getBaseUrl(); $form = new UploadForm(); if ($this-_request-isPost()) { $formData = $this-_request-getPost(); // success - do something with the uploaded file $uploadedData = $this-_request-getPost('file'); $adapter = $form-file-getTransferAdapter() try { $adapter-receive(); //-- here it goes wrong... } catch (Zend_File_Transfer_Exception $e) { Utils::log($e-getMessage()); $e-getMessage(); } the version i currently use is 1.6.2 but i also tried to use 1.6.1 and 1.7.0PR I hope anybody can help me or can supply me with a working sample. TIA Marc Gobel -- View this message in context: http://www.nabble.com/Not-able-to-get-file-upload-to-be-working-tp20536045p20536045.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] jQuery, jqGrid and ZF - pager doesn't work
On Fri, Nov 14, 2008 at 18:25, Benjamin Eberlei [EMAIL PROTECTED] wrote: Hello Pawel, To fix this you have to hack your Zend_Json output with preg_replace somehow to strip the around the pager: value. Maybe good idea is do it like in Zend_Db. If it is in parentheses it would be stripped and in future converted to Zend_Json_Expr. regards. -- Paweł Chuchmała pawel.chuchmala at gmail dot com
Re: [fw-general] Strange behaviour with Zend_Translate and caching in 1.7 Sanity c heck release
-- Robert Castley [EMAIL PROTECTED] wrote (on Monday, 17 November 2008, 12:09 PM -): Hi, I am just wondering why with the 1.7 release does Zend_Translate (with caching) create so many cache files now? Previously (in 1.6.x) there were only two cache files created now I have all these, nothing has change in my code, just an installed of 1.7. 17/11/2008 12:0598 zend_cache---internal-metadatas---Magik_Zend_Translate_Csv_Options 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_CVS_Entries_en_GB_Csv Looks like you have your CVS directories in your deployment, and it's scanning those directories when searching for the locale files -- giving you extra and extraneous files. 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_CVS_Repository_en_GB_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_CVS_Root_en_GB_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_CVS_Entries_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_CVS_Repository_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_CVS_Root_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js_CVS_Entries_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js_CVS_Repository_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js_CVS_Root_de_Csv 17/11/2008 12:0597 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js_lang_js_de_de_Csv 17/11/2008 12:0597 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_lang_de_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_CVS_Entries_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_CVS_Repository_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_CVS_Root_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js_CVS_Entries_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js_CVS_Repository_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js_CVS_Root_en_Csv 17/11/2008 12:0598 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js_lang_js_en_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_lang_en_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_CVS_Entries_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_CVS_Repository_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_CVS_Root_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js_CVS_Entries_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js_CVS_Repository_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js_CVS_Root_es_Csv 17/11/2008 12:0596 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js_lang_js_es_es_Csv 17/11/2008 12:0598 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_lang_es_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_fr_CVS_Entries_fr_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_fr_CVS_Repository_fr_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_fr_CVS_Root_fr_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_fr_js_CVS_Entries_fr_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_fr_js_CVS_Repository_fr_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_fr_js_CVS_Root_fr_Csv 17/11/2008 12:0598 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_fr_js_lang_js_fr_fr_Csv 17/11/2008 12:0598
[fw-general] setting style class of an element in navigation
Is there a way that I can set a tab to have a class such as active from the controller? So that the active tab would show as a different style? I know that this can be done with javascript, but I would like to know if it can be done within Zend framework for ease of use. thanks for any help -- View this message in context: http://www.nabble.com/setting-style-class-of-an-element-in-navigation-tp20541245p20541245.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] setting style class of an element in navigation
You could give each nav element an id and then just capture a little Css style in the view with help from the cature helper methods, the Id would be set to the current nav item from the Controller of the current page: In controller: $this-view-navactive = 'idofnavlink' In view: #$this-navactive { ... } You would also need to use capture start and cature end methods of helper obviously. HTH. On Nov 17, 2008, at 15:12, Ace Paul [EMAIL PROTECTED] wrote: Is there a way that I can set a tab to have a class such as active from the controller? So that the active tab would show as a different style? I know that this can be done with javascript, but I would like to know if it can be done within Zend framework for ease of use. thanks for any help -- View this message in context: http://www.nabble.com/setting-style-class-of-an-element-in-navigation-tp20541245p20541245.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] setting style class of an element in navigation
-- Ace Paul [EMAIL PROTECTED] wrote (on Monday, 17 November 2008, 07:12 AM -0800): Is there a way that I can set a tab to have a class such as active from the controller? So that the active tab would show as a different style? I know that this can be done with javascript, but I would like to know if it can be done within Zend framework for ease of use. Need some code here... not sure if you're talking a tab within Dojo, JQuery, or simply markup you're generating. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] Strange behaviour with Zend_Translate and caching in 1.7 Sanity check release
With 1.7 the translation cache works file based and no longer translation based. As normally you have multiple translation files, you will have one cache for each translation file. So, having more cache files is no problem but wished behaviour. This has a performance benefit for translation. In your case the ignore option is eighter erased by your configuration, or the scanned CVS directories do not start with a dot, as leading dots are ignored. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: Robert Castley [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, November 17, 2008 1:09 PM Subject: [fw-general] Strange behaviour with Zend_Translate and caching in 1.7 Sanity check release Hi, I am just wondering why with the 1.7 release does Zend_Translate (with caching) create so many cache files now? Previously (in 1.6.x) there were only two cache files created now I have all these, nothing has change in my code, just an installed of 1.7. 17/11/2008 12:0598 zend_cache---internal-metadatas---Magik_Zend_Translate_Csv_Options 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_CVS_Entries _en_GB_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_CVS_Reposit ory_en_GB_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_CVS_Root_en _GB_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_CVS_Entr ies_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_CVS_Repo sitory_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_CVS_Root _de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js_CVS_E ntries_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js_CVS_R epository_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js_CVS_R oot_de_Csv 17/11/2008 12:0597 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js_lang_ js_de_de_Csv 17/11/2008 12:0597 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_lang_de_ de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_CVS_Entr ies_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_CVS_Repo sitory_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_CVS_Root _en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js_CVS_E ntries_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js_CVS_R epository_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js_CVS_R oot_en_Csv 17/11/2008 12:0598 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js_lang_ js_en_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_lang_en_ en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_CVS_Entr ies_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_CVS_Repo sitory_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_CVS_Root _es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js_CVS_E ntries_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js_CVS_R epository_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js_CVS_R oot_es_Csv 17/11/2008 12:0596 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js_lang_ js_es_es_Csv 17/11/2008 12:0598 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_lang_es_ es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_fr_CVS_Entr ies_fr_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_fr_CVS_Repo sitory_fr_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_fr_CVS_Root _fr_Csv 17/11/2008 12:0599
RE: [fw-general] Strange behaviour with Zend_Translate and cachin g in 1.7 Sanity check release
Excellent, thank you :-) For the future could the ignore option accept an array of values i.e. multiple directories? Cheers, - Robert -Original Message- From: Thomas Weidner [mailto:[EMAIL PROTECTED] Sent: 17 November 2008 15:31 To: fw-general@lists.zend.com Subject: Re: [fw-general] Strange behaviour with Zend_Translate and caching in 1.7 Sanity check release With 1.7 the translation cache works file based and no longer translation based. As normally you have multiple translation files, you will have one cache for each translation file. So, having more cache files is no problem but wished behaviour. This has a performance benefit for translation. In your case the ignore option is eighter erased by your configuration, or the scanned CVS directories do not start with a dot, as leading dots are ignored. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: Robert Castley [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, November 17, 2008 1:09 PM Subject: [fw-general] Strange behaviour with Zend_Translate and caching in 1.7 Sanity check release Hi, I am just wondering why with the 1.7 release does Zend_Translate (with caching) create so many cache files now? Previously (in 1.6.x) there were only two cache files created now I have all these, nothing has change in my code, just an installed of 1.7. 17/11/2008 12:0598 zend_cache---internal-metadatas---Magik_Zend_Translate_Csv_Options 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_CVS_E ntries _en_GB_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_CVS_R eposit ory_en_GB_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_CVS_R oot_en _GB_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_CV S_Entr ies_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_CV S_Repo sitory_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_CV S_Root _de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js _CVS_E ntries_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js _CVS_R epository_de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js _CVS_R oot_de_Csv 17/11/2008 12:0597 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_js _lang_ js_de_de_Csv 17/11/2008 12:0597 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_de_la ng_de_ de_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_CV S_Entr ies_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_CV S_Repo sitory_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_CV S_Root _en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js _CVS_E ntries_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js _CVS_R epository_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js _CVS_R oot_en_Csv 17/11/2008 12:0598 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_js _lang_ js_en_en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_en_la ng_en_ en_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_CV S_Entr ies_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_CV S_Repo sitory_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_CV S_Root _es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js _CVS_E ntries_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js _CVS_R epository_es_Csv 17/11/2008 12:0599 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js _CVS_R oot_es_Csv 17/11/2008 12:0596 zend_cache---internal-metadatas---Magik_Zend_Translate_languages_es_js _lang_ js_es_es_Csv 17/11/2008 12:0598
[fw-general] Question about zend pagination
I have a problem with zend pagination. In my controller i have this: $result = $db-fetchAll ( $sql ); $page = $this-_getParam ( 'page', 1 ); $paginator = Zend_Paginator::factory ( $result ); $paginator-setItemCountPerPage ( 2 ); $paginator-setCurrentPageNumber ( $page ); $paginator-setPageRange ( 5 ); Zend_View_Helper_PaginationControl::setDefaultViewPartial ( 'paginator.phtml' ); $this-view-paginator = $paginator; Now in my view file i am getting this: Start | Previous | 1 2 3 | Next | End Page 1 of 3 Page 2 and 3 and Next are links, but when i click on them, my browser reload, but same result is display on the page. Actually i am not getting result for page 2, 3 or next. Same result as for page 1 is displayed. How to fix this? Thanks, V -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20543032.html Sent from the Zend Framework mailing list archive at Nabble.com.
[Fwd: [fw-general] Question about zend pagination]
Try not to pass the total $result array. Let paginator execute the query. $paginator = Zend_Paginator::factory($select); $paginator-setItemCountPerPage(10); $paginator-setCurrentPageNumber($page); $paginator-setPageRange(10); $paginator-setDefaultScrollingStyle('Sliding'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); $this-view-pages = $paginator-getPages(); This case you only query for the element needing (limit,offset). When linking make certain that you catch the selected like $page = $this-_request-getParam('page') Works fine for me vladimirn schrieb: I have a problem with zend pagination. In my controller i have this: $result = $db-fetchAll ( $sql ); $page = $this-_getParam ( 'page', 1 ); $paginator = Zend_Paginator::factory ( $result ); $paginator-setItemCountPerPage ( 2 ); $paginator-setCurrentPageNumber ( $page ); $paginator-setPageRange ( 5 ); Zend_View_Helper_PaginationControl::setDefaultViewPartial ( 'paginator.phtml' ); $this-view-paginator = $paginator; Now in my view file i am getting this: Start | Previous | 1 2 3 | Next | End Page 1 of 3 Page 2 and 3 and Next are links, but when i click on them, my browser reload, but same result is display on the page. Actually i am not getting result for page 2, 3 or next. Same result as for page 1 is displayed. How to fix this? Thanks, V ---BeginMessage--- I have a problem with zend pagination. In my controller i have this: $result = $db-fetchAll ( $sql ); $page = $this-_getParam ( 'page', 1 ); $paginator = Zend_Paginator::factory ( $result ); $paginator-setItemCountPerPage ( 2 ); $paginator-setCurrentPageNumber ( $page ); $paginator-setPageRange ( 5 ); Zend_View_Helper_PaginationControl::setDefaultViewPartial ( 'paginator.phtml' ); $this-view-paginator = $paginator; Now in my view file i am getting this: Start | Previous | 1 2 3 | Next | End Page 1 of 3 Page 2 and 3 and Next are links, but when i click on them, my browser reload, but same result is display on the page. Actually i am not getting result for page 2, 3 or next. Same result as for page 1 is displayed. How to fix this? Thanks, V -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20543032.html Sent from the Zend Framework mailing list archive at Nabble.com. ---End Message---
Re: [fw-general] Not able to get file upload to be working
First: Please use 1.7 and not 1.7PR. There has really much changed since the past releases. Second: You should validate your input before receiving the files. Otherwise the receivment will fail because you can not receive files which fail validation. What should be the reason for adding a validator when you don't validate something. :-) For me it looks like you tried to receive the files and there were no files given. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: MarcG [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, November 17, 2008 10:18 AM Subject: [fw-general] Not able to get file upload to be working Hi, I want to upload several pictures, and i try to use the Zend_Form_Element_File. These are the error messages i get: Notice: Undefined index: tmp_name in /library/Zend/File/Transfer/Adapter/Abstract.php on line 577 Warning: Invalid argument supplied for foreach() in /library/Zend/Validate/File/Count.php on line 217 Notice: Undefined index: tmp_name in /library/Zend/File/Transfer/Adapter/Abstract.php on line 577 Warning: Invalid argument supplied for foreach() in /library/Zend/Validate/File/FilesSize.php on line 94 Notice: Undefined index: tmp_name in /library/Zend/File/Transfer/Adapter/Abstract.php on line 577 Notice: Undefined index: name in /library/Zend/Validate/File/Extension.php on line 198 What am i doing wrong? In my form i have: $file = new Zend_Form_Element_File('file'); $file-setLabel('File') -setDestination('/tmp') -addFilter('Rename', '/tmp/') -setRequired(true) -addValidator('Count', false, 1) // ensure only 1 file -setMaxFileSize(10 * 1024 * 1024) // limit to 10M -addValidator('FilesSize', true, '10MB') -addValidator('Extension', true, 'png'); // PNG in my controller i have: $this-view-title = Zend_Form File Upload test; $this-view-baseUrl = $this-_request-getBaseUrl(); $form = new UploadForm(); if ($this-_request-isPost()) { $formData = $this-_request-getPost(); // success - do something with the uploaded file $uploadedData = $this-_request-getPost('file'); $adapter = $form-file-getTransferAdapter() try { $adapter-receive(); //-- here it goes wrong... } catch (Zend_File_Transfer_Exception $e) { Utils::log($e-getMessage()); $e-getMessage(); } the version i currently use is 1.6.2 but i also tried to use 1.6.1 and 1.7.0PR I hope anybody can help me or can supply me with a working sample. TIA Marc Gobel -- View this message in context: http://www.nabble.com/Not-able-to-get-file-upload-to-be-working-tp20536045p20536045.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Question about zend pagination
$paginator = Zend_Paginator::factory($select); $select has to be an instance of Zend_Db_Select Build your query with Zend_Db_Select and it shoud work $select = $this-db-select() -from(array('a' = 'banners '), array('*')) -where('active = ?', 'y') -where('programid = ?', $programid) -where('websiteid = ?', $websiteid) -where('bannertype = ?', $bannertype ) ; If i am doing this: $sql = select * from banners where active='y' and programid=' . $programid . ' and websiteid = ' . $websiteid . ' and bannertype= ' . $bannertype . '; //$result = $db-fetchAll ( $sql ); $paginator = Zend_Paginator::factory($sql); i am getting an error: Vladimir Nikolic schrieb: Daniel Tangermann wrote: Try not to pass the total $result array. Let paginator execute the query. $paginator = Zend_Paginator::factory($select); $paginator-setItemCountPerPage(10); $paginator-setCurrentPageNumber($page); $paginator-setPageRange(10); $paginator-setDefaultScrollingStyle('Sliding'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); $this-view-pages = $paginator-getPages(); This case you only query for the element needing (limit,offset). When linking make certain that you catch the selected like $page = $this-_request-getParam('page') Works fine for me vladimirn schrieb: I have a problem with zend pagination. In my controller i have this: $result = $db-fetchAll ( $sql ); $page = $this-_getParam ( 'page', 1 ); $paginator = Zend_Paginator::factory ( $result ); $paginator-setItemCountPerPage ( 2 ); $paginator-setCurrentPageNumber ( $page ); $paginator-setPageRange ( 5 ); Zend_View_Helper_PaginationControl::setDefaultViewPartial ( 'paginator.phtml' ); $this-view-paginator = $paginator; Now in my view file i am getting this: Start | Previous | 1 2 3 | Next | End Page 1 of 3 Page 2 and 3 and Next are links, but when i click on them, my browser reload, but same result is display on the page. Actually i am not getting result for page 2, 3 or next. Same result as for page 1 is displayed. How to fix this? Thanks, V Hello Daniel, How you build your sql query in this case? If i am doing this: $sql = select * from banners where active='y' and programid=' . $programid . ' and websiteid = ' . $websiteid . ' and bannertype= ' . $bannertype . '; //$result = $db-fetchAll ( $sql ); $paginator = Zend_Paginator::factory($sql); i am getting an error: Error! Application error Exception information: *Message:* No adapter for type string Stack trace: #0 D:\wamp\www\singlescash\application\controllers\BannersController.php(58): Zend_Paginator::factory('select * from b...') #1 D:\wamp\www\singlescash\library\Zend\Controller\Action.php(502): BannersController-displayAction() #2 D:\wamp\www\singlescash\library\Zend\Controller\Dispatcher\Standard.php(293): Zend_Controller_Action-dispatch('displayAction') #3 D:\wamp\www\singlescash\library\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard-dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #4 D:\wamp\www\singlescash\application\bootstrap.php(168): Zend_Controller_Front-dispatch() #5 D:\wamp\www\singlescash\index.php(2): require_once('D:\wamp\www\sin...') #6 {main} Thanks, V
Re: [fw-general] Question about zend pagination
Thank you for swift replay :) Now i went with this: $page = $this-_request-getParam('page') ; $db = Zend_Registry::get ( 'db' ); $select = $db-select () -from ( 'banners', array ('bannerurl', 'height', 'width', 'bannersize' ) ) -where ( 'active = ?', 'y' ) -where ('programid = ?', $programid) -where('websiteid = ?', $websiteid) -where('bannertype = ?', $bannertype) -order ( 'height', 'ASC' ); $paginator = Zend_Paginator::factory($select); $paginator-setItemCountPerPage(3); $paginator-setCurrentPageNumber($page); $paginator-setPageRange(3); $paginator-setDefaultScrollingStyle('Sliding'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); $this-view-paginator = $paginator; Still cant get proper results. Links are clickable, but not lead to next page. In display.phtml i have: ?php echo $this-paginator ? ?php foreach ( $this-paginator as $banner ) :? div div style=float:left; padding-left:20px ?php echo $banner['bannerurl'] ? /div /div ?php endforeach; ? Any suggestion? Thanks V -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20544008.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] WebDav w/ZF?
There a webdav-server implementation available for Zend_Framework? Thanks Alex
Re: [fw-general] Question about zend pagination
Can you provide a link? I am not using Zend_View but a smarty solution. When you dump $paginator, do you have the correct results? So only the necessary amount of rows? Are you sure $page is filled? Kinda like: $page = 1; if($this-_getParam('page ')){ $page = $this-_getParam('page '); } I am using it with success: $this-view-pages = $paginator-getPages(); (for the paginator.tpl, like $this-pages-pageCount -pagesInRange and $this-view-results = $paginator (for looping the results) My paginator.tpl looks like this, maybe it can help (remember this is smarty): {if $this-pages-pageCount 1} div class=paginationControl {assign var=url value=$url|rtrim:/} !-- Last page link -- {assign var=first value=$this-pages-first} {assign var=last value=$this-pages-last} {if !$this-pages-pagesInRange[$first]} a href={$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this-pages-first} lt;lt;/a {/if} {if $this-pages-pageCount 6} !-- Previous page link -- {if $this-pages-previous } a href={$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this-pages-previous} lt; Zurück/a | {/if} {/if} !-- Numbered page links -- {foreach from=$this-pages-pagesInRange key=myId item=i} {if $i != $this-pages-current } {assign var=j value=/seite/$i} a href={$url|regex_replace:'/\/seite\/\d+/':''}{$j} {$i}/a {else} strong{$i}/strong {/if} {if $this-pages-last != $i} | {/if} {/foreach} {if $this-pages-pageCount 6} !-- Next page link -- {if $this-pages-next} a href={$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this-pages-next} Weiter gt;/a {/if} {/if} !-- Last page link -- {if !$this-pages-pagesInRange[$last]} a href={$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this-pages-last} gt;gt;/a {/if} /div {/if} vladimirn schrieb: Thank you for swift replay :) Now i went with this: $page = $this-_request-getParam('page') ; $db = Zend_Registry::get ( 'db' ); $select = $db-select () -from ( 'banners', array ('bannerurl', 'height', 'width', 'bannersize' ) ) -where ( 'active = ?', 'y' ) -where ('programid = ?', $programid) -where('websiteid = ?', $websiteid) -where('bannertype = ?', $bannertype) -order ( 'height', 'ASC' ); $paginator = Zend_Paginator::factory($select); $paginator-setItemCountPerPage(3); $paginator-setCurrentPageNumber($page); $paginator-setPageRange(3); $paginator-setDefaultScrollingStyle('Sliding'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); $this-view-paginator = $paginator; Still cant get proper results. Links are clickable, but not lead to next page. In display.phtml i have: ?php echo $this-paginator ? ?php foreach ( $this-paginator as $banner ) :? div div style=float:left; padding-left:20px ?php echo $banner['bannerurl'] ? /div /div ?php endforeach; ? Any suggestion? Thanks V
Re: [fw-general] Tags for the memcached and APC backends for Zend_Cache - new approach
Hi, I don't understand how this TwoLevels cache should work and I see some odd results quick tests. Is that it will use fast cache for untagged entries, and slow for tagged entries? Cuz sometimes I see both entries in APC and in SQLite Sometimes I see it only in SQLite. With the two levels backend, there is an adaptive algorithm depending on : - the remaining space in the fast backend - the priority (between 0 and 10) given to the cache record (optional) === When you save datas which the two levels backend : ($usage is between 0 (nothing) and 100 (full)) if (($priority 0) (10 * $priority = $usage)) { = cache into the fast backend AND into the slow backend } else { = cache into the slow backend only } When saving a cache record into the fast backend, a special lifetime is used : $fastLifetime = (int) ($lifetime / (11 - $priority)); === When loading datas : we try the fast backend = hit = we use it = not hit = we try with the slow backend if the cache is hit and if auto_refresh_fast_cache is on, we refresh the lifetime of the fast backend (without of course making it bigger than the original lifetime) === When using tags : we use the slow backend (because tags are not reliable with fast backends) The whole thing is a simple algorithm but it tries to use the fast backend in the better way depending of remaining space and priority. Probably, some people will have different ideas. I'm ready to discuss them in the issue tracker. My quick testing using TwoLevels, showed that application became much slower than without the cache. I used APC-SQLite. It's possible, depending of your cache use. And sometimes it throws fatal erros when it tries to access cached data as array although it's object. Check file TwoLevels.php on line 206 (or so) Can you be more precise on this particular thing ? Are you sure to not share cache ids between different backends (because backends don't store same datas in the same way). Regards Fabien
Re: [fw-general] Question about zend pagination
i cant provide a link it is on my localhost :( However, i cant get it working.. -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20547855.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Not able to get file upload to be working
Hi Thomas, Thank you for your quick reply. I downloaded 1.7 and use it currently. Secondly i'm new to PHP (saw my first code two weeks ago) Basically what i try to do is upload a file (perhaps at first even without validation) and i'm not been able to do that so far. The reason i added the validations is because this seems a logical way to do but my main goal so far is succeed in uploading a file. So in order to reach that goal i stripped all the validations in order to remove al the clutter so this is what i have so far in the user form: public function __construct($options = null) { parent::__construct($options); $this-setName('upload'); $this-setAttrib('enctype', 'multipart/form-data'); $description = new Zend_Form_Element_Text('description'); $description-setLabel('Description') -setRequired(true) -addValidator('NotEmpty'); $file = new Zend_Form_Element_File('file'); $file-setLabel('File') -setDestination('/Applications/MAMP/htdocs/questimmo/tmp') -addFilter('Rename', '/Applications/MAMP/htdocs/questimmo/tmp') -setRequired(true); //-addValidator('Count', false, 1) // ensure only 1 file //-setMaxFileSize(10 * 1024 * 1024) // limit to 10M //-addValidator('FilesSize', true, '10MB') //-addValidator('Extension', true, 'png'); // PNG $submit = new Zend_Form_Element_Submit('submit'); $submit-setLabel('Upload'); Utils::log('adding the upload elements',1); $this-addElements(array($description, $file, $submit)); } and this in the controller: function indexAction() { $this-view-title = Zend_Form File Upload Test; $this-view-baseUrl = $this-_request-getBaseUrl(); $form = new UploadForm(); $this-view-form=$form; if ($this-_request-isPost()) { $postValues = $this-_request-getPost(); if (!empty($postValues) $form-isValid($postValues)) { } var_dump($_FILES, $form-getErrors(), $form-getValues()); } } when i try to upload a file i get these error messages: Notice: Undefined index: tmp_name in /Applications/MAMP/htdocs/questimmo/library/Zend/File/Transfer/Adapter/Abstract.php on line 583 Notice: Undefined index: name in /Applications/MAMP/htdocs/questimmo/library/Zend/Validate/File/Upload.php on line 152 Notice: Undefined index: tmp_name in /Applications/MAMP/htdocs/questimmo/library/Zend/Validate/File/Upload.php on line 156 Notice: Undefined index: error in /Applications/MAMP/htdocs/questimmo/library/Zend/Validate/File/Upload.php on line 169 Notice: Undefined index: tmp_name in /Applications/MAMP/htdocs/questimmo/library/Zend/Validate/File/Upload.php on line 171 array(0) { } array(3) { [description]= array(0) { } [file]= array(1) { [0]= string(21) fileUploadErrorAttack } [submit]= array(0) { } } array(3) { [description]= string(8) Test [file]= NULL [submit]= string(6) Upload } TIA Marc Gobel thomasW wrote: First: Please use 1.7 and not 1.7PR. There has really much changed since the past releases. Second: You should validate your input before receiving the files. Otherwise the receivment will fail because you can not receive files which fail validation. What should be the reason for adding a validator when you don't validate something. :-) For me it looks like you tried to receive the files and there were no files given. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: MarcG [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, November 17, 2008 10:18 AM Subject: [fw-general] Not able to get file upload to be working Hi, I want to upload several pictures, and i try to use the Zend_Form_Element_File. These are the error messages i get: Notice: Undefined index: tmp_name in /library/Zend/File/Transfer/Adapter/Abstract.php on line 577 Warning: Invalid argument supplied for foreach() in /library/Zend/Validate/File/Count.php on line 217 Notice: Undefined index: tmp_name in /library/Zend/File/Transfer/Adapter/Abstract.php on line 577 Warning: Invalid argument supplied for foreach() in /library/Zend/Validate/File/FilesSize.php on line 94 Notice: Undefined index: tmp_name in /library/Zend/File/Transfer/Adapter/Abstract.php on line 577 Notice: Undefined index: name in /library/Zend/Validate/File/Extension.php on line 198 What am i doing wrong? In my form i have: $file = new Zend_Form_Element_File('file'); $file-setLabel('File') -setDestination('/tmp')
Re: [fw-general] setting style class of an element in navigation
Thanks for the responses. Still a bit stuck. I haven't used the capture helpers, so its very new to me. Still working on my first ZF app. It seems to be a quick learning curve,but there is so much to learn. I have this section in the header.phtml file, in the layouts directory. The current and sub-current classes tell which page we are on. So that the navigation is highlighted in the header area. div id=navi ul id=navtabs li id=current Dashboard /li li /admin/business/ Businesses /li li Menu Item Two /li li Menu Item Three /li li Menu Item Four /li /ul div class=clear/div /div div id=subnavi ul id=subnav li id=sub-current Business List /li li Submenu Item /li li Submenu Item /li li Submenu Item /li li Submenu Item /li li Submenu Item /li /ul div class=clear/div /div -- View this message in context: http://www.nabble.com/setting-style-class-of-an-element-in-navigation-tp20541245p20552588.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Not able to get file upload to be working
Sorry, but there is something completly wrong. According to PHP manual the $_FILES array has to have the values: 'name', 'type', 'size', 'tmp_name' and 'error' As your $_FILES array has no 'tmp_name', no 'name' and no 'error'. 'type' and 'size' are not used by the file component. PHP itself says that this could impossible be a correct uploaded file. Therefor it throws a attack error when you try to upload the file. The file component return this with an 'fileUploadErrorAttack'. And because your $_FILES array is empty, I said that there is something completly wrong. This happens when you * Try to create a $_FILES array manually * Try to use two classes which process file uploading * Try to call move_uploaded_file/is_uploaded_file additional to the file components * Your configuration disallows file uploads Make an test example without the additional code from your application to see where the problem in your application is. Maybe your environment does not allow file uploads ? Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: MarcG [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Tuesday, November 18, 2008 1:11 AM Subject: Re: [fw-general] Not able to get file upload to be working Hi Thomas, Thank you for your quick reply. I downloaded 1.7 and use it currently. Secondly i'm new to PHP (saw my first code two weeks ago) Basically what i try to do is upload a file (perhaps at first even without validation) and i'm not been able to do that so far. The reason i added the validations is because this seems a logical way to do but my main goal so far is succeed in uploading a file. So in order to reach that goal i stripped all the validations in order to remove al the clutter so this is what i have so far in the user form: public function __construct($options = null) { parent::__construct($options); $this-setName('upload'); $this-setAttrib('enctype', 'multipart/form-data'); $description = new Zend_Form_Element_Text('description'); $description-setLabel('Description') -setRequired(true) -addValidator('NotEmpty'); $file = new Zend_Form_Element_File('file'); $file-setLabel('File') -setDestination('/Applications/MAMP/htdocs/questimmo/tmp') -addFilter('Rename', '/Applications/MAMP/htdocs/questimmo/tmp') -setRequired(true); //-addValidator('Count', false, 1) // ensure only 1 file //-setMaxFileSize(10 * 1024 * 1024) // limit to 10M //-addValidator('FilesSize', true, '10MB') //-addValidator('Extension', true, 'png'); // PNG $submit = new Zend_Form_Element_Submit('submit'); $submit-setLabel('Upload'); Utils::log('adding the upload elements',1); $this-addElements(array($description, $file, $submit)); } and this in the controller: function indexAction() { $this-view-title = Zend_Form File Upload Test; $this-view-baseUrl = $this-_request-getBaseUrl(); $form = new UploadForm(); $this-view-form=$form; if ($this-_request-isPost()) { $postValues = $this-_request-getPost(); if (!empty($postValues) $form-isValid($postValues)) { } var_dump($_FILES, $form-getErrors(), $form-getValues()); } } when i try to upload a file i get these error messages: Notice: Undefined index: tmp_name in /Applications/MAMP/htdocs/questimmo/library/Zend/File/Transfer/Adapter/Abstract.php on line 583 Notice: Undefined index: name in /Applications/MAMP/htdocs/questimmo/library/Zend/Validate/File/Upload.php on line 152 Notice: Undefined index: tmp_name in /Applications/MAMP/htdocs/questimmo/library/Zend/Validate/File/Upload.php on line 156 Notice: Undefined index: error in /Applications/MAMP/htdocs/questimmo/library/Zend/Validate/File/Upload.php on line 169 Notice: Undefined index: tmp_name in /Applications/MAMP/htdocs/questimmo/library/Zend/Validate/File/Upload.php on line 171 array(0) { } array(3) { [description]= array(0) { } [file]= array(1) { [0]= string(21) fileUploadErrorAttack } [submit]= array(0) { } } array(3) { [description]= string(8) Test [file]= NULL [submit]= string(6) Upload } TIA Marc Gobel thomasW wrote: First: Please use 1.7 and not 1.7PR. There has really much changed since the past releases. Second: You should validate your input before receiving the files. Otherwise the receivment will fail because you can not receive files which fail validation. What should be the reason for adding a validator when you don't validate something. :-) For me it looks like you tried to receive the files and there were no files given. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: MarcG [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, November 17, 2008 10:18 AM Subject: [fw-general] Not able to