Re: [fw-general] ACL and Views
Hello Teemu, Have you already taken a look at the Simon Mundy's tutorial? I think you may find an answer to your question there. You'll find it under: http://www.zftutorials.com/zend-acl/ Cheers, Ivan. Teemu Välimäki schrieb: Hi, I'm not quite sure how I should use ACL with Views. I have a menu where I'd like items not to be visible if users role(s) have no access to it. So I was planning on doing array of the menu items and passing that to the view or passing the whole ACL object to view. Views should not contain logic so I'd be very glad to see a short example or explanation how to do this, to prevent wrong implementation. Virtual cookie for the one helping me out :) -- Loglan GmbH Ivan Ruiz Gallego Binzmühlestrasse 210 8050 Zürich Switzerland Office +41 44 310 19 20 Mobile +41 76 321 23 68 Net www.loglan.net
[fw-general] Problem with Zend_Http_Client $config['timeout'] value
Hello, I use Zend XmlRpc and I faced the following problem: When the function on our server needs more execution time, the connection times out, but no Exception is raised. Instead Unable to parse response or response is empty error is displayed. This is because when the connection times out, no response is returned and no timeout Exception is raised. In Zend_Http_Client there is protected $config = array( 'maxredirects'= 5, 'strictredirects' = false, 'useragent' = 'Zend_Http_Client', 'timeout' = 10, 'adapter' = 'Zend_Http_Client_Adapter_Socket', 'httpversion' = self::HTTP_1, 'keepalive' = false ); The $config['timeout'] is used for two different functions: fsockopen() and stream_set_timeout() but the timeout parameter has different meaning in each of them. * Note: * If you need to set a timeout for reading/writing data over the socket, use stream_set_timeout()http://bg2.php.net/manual/en/function.stream-set-timeout.php, as the * timeout* parameter to *fsockopen()* only applies while connecting the socket. - http://php.net/manual/en/function.fsockopen.php stream_set_timeout — Set timeout period on a stream - http://php.net/manual/en/function.stream-set-timeout.php I temporary resolved the problem by increasing the value from 10 to 60, but it should be fixed. There should be two different timeouts - connect_timeout and transfer_timeout. There should be Exception for timeout, because: When the stream times out, the 'timed_out' key of the array returned by stream_get_meta_data()http://bg.php.net/manual/en/function.stream-get-meta-data.phpis set to * TRUE*, although no error/warning is generated. - http://php.net/manual/en/function.stream-set-timeout.php Svetlin Tsvetanov -- http://www.gsoccer.info
RE: [fw-general] YAZFA
Very nice site redesign Chris Have you written any articles on your use of Zend Framework? Best wishes, Si
Re: [fw-general] Zend_Search_Lucene result sorting problem
On 3/13/07, Alexander Veremyev [EMAIL PROTECTED] wrote: Hi Graeme, I saw something like this once. But don't remember what was the problem... Which PHP version do you use? Hi Alexander. I'm running PHP Version 5.2.0 www.entropy.ch Release 3 which is for OSX Intel. Cheers, Graeme
[fw-general] Charset question
Hi As I've seen, some components of ZF works with UTF-8 by default (Zend_Search, Zend_Locale, ...). So, is it better for us to develop with UTF-8 for the entire application as ZF will work this way? We're developing applications only for a local market, so we're sure that iso-8859-1 is enough for us. Shall we change to UTF-8 to avoid future problems with the ZF? The database (postgresql) is in Latin1 and the PHP headers are in iso-8859-1, but i know PHP is not very utf8-friendy yet. -- Xavier Vidal Piera Enginyer Tècnic Informàtic de Gestió Tècnic Especialista Informàtic d'equips [EMAIL PROTECTED] 610.68.41.78
[fw-general] Writing Zend Article Site?
There are a number of fine Zend Framework related articles and tutorials on the web. I'm thinking about adding to the collection but am too lazy to setup and admin my own wiki type site. Does anyone know a good site where they will let you create a multi-page article/document with code syntax highlighting?
Re: [fw-general] Writing Zend Article Site?
Art Hundiak schreef: There are a number of fine Zend Framework related articles and tutorials on the web. I'm thinking about adding to the collection but am too lazy to setup and admin my own wiki type site. Does anyone know a good site where they will let you create a multi-page article/document with code syntax highlighting? You can setup your pages in ZFUSER if you like: http://framework.zend.com/wiki/display/ZFUSER/Home Please don't put them all in the root :) Best, -- Andries Seutens http://andries.systray.be Gecontroleerd op virussen door de JOJO Secure Gateway.
Re: [fw-general] Controller problem 0.8.0
umm thankx guys.. i found out one solution... i just added unset($_SERVER['REQUEST_URI']); in the index.php file.. and things work kul in IIS...
Re: [fw-general] ACL and Views
Hi! I'm not quite sure how I should use ACL with Views. I have a menu where I'd like items not to be visible if users role(s) have no access to it. So I was planning on doing array of the menu items and passing that to the view or passing the whole ACL object to view. Views should not contain logic so I'd be very glad to see a short example or explanation how to do this, to prevent wrong implementation. this is something that interests me a lot as well. Unfortunately, this topic is not covered in Simons article. Are there best practises for making views visible/invisible depending on particular user roles? Stephan
Re: [fw-general] ACL and Views
On 13/mar/07, at 20:02:02, Teemu Välimäki wrote: Hi, I'm not quite sure how I should use ACL with Views. I have a menu where I'd like items not to be visible if users role(s) have no access to it. So I was planning on doing array of the menu items and passing that to the view or passing the whole ACL object to view. Views should not contain logic so I'd be very glad to see a short example or explanation how to do this, to prevent wrong implementation. Virtual cookie for the one helping me out :) Definitely go for the array of menu items. A simple rule to follow is give the view simple data structures only. Otherwise, should your application code switch from Zend_Acl to something else, you would need to change every view involved. Federico
Re: [fw-general] ACL and Views
Hi Stephan In a few of my projects I created a Sitemap class that parsed a config file (e.g. Zend_Config) where each member has a title, a controller and an action. E.g. (in .ini format) [all] sitemap.home.title = Home sitemap.home.controller = home sitemap.home.action = index sitemap.news.title = News sitemap.news.controller = news sitemap.news.action = index sitemap.protected.title = Protected Section sitemap.protected.controller = protected sitemap.protected.action = index sitemap.contact.title = Contact sitemap.contact.controller = contact sitemap.contact.action = index The 'Sitemap' class takes both the Zend_Config instance and the Acl instance and iterates through the sitemap, testing each controller/ action against the Acl. This happens in the constructor. If a controller is allowed, it's added to the internal $_sitemap array as an object. So when it comes time to outputting it to my view, you simply iterate through the sitemap instance and there's no extra logic to be parsed. An example is:- class Sitemap implements Iterator, Countable { // A simplified sitemap, having only 1 level deep of navigation. // An exercise for the roll-your-own developer is to make a version that allows nesting/children protected $_data = array(); protected $_ptr = 0; public function __construct(Zend_Config $config, Zend_Acl, $acl, $role = null) { foreach ($config as $key = $value) { // We'll assume that non-existent resources are allowed for this exercise if (!$acl-has($value-controller) || $acl-isAllowed($role, $value-controller, $value- action))) { $this-_data[$key] = array('title' = $value, 'url' = array ('controller' = $value-controller, 'action' = $value-action)); } } } /** * Magic method for retrieving properties. * * @param string $key * @return mixed */ public function __get($key) { if (array_key_exists($key, $this-_data)) { return $this-_data[$key]; } return null; } /** * Magic method for setting properties. * * @param string $name * @param mixed $value * @return void */ public function __set($key, $value) { $this-_data[$key] = $value; } /** * Support isset() overloading on PHP 5.1 * * @param string $name * @return boolean */ protected function __isset($name) { return isset($this-_data[$name]); } /** * Defined by Countable interface * * @return int */ public function count() { return count($this-_data); } /** * Defined by Iterator interface * * @return mixed */ public function current() { return current($this-_data); } /** * Defined by Iterator interface * * @return mixed */ public function key() { return key($this-_data); } /** * Defined by Iterator interface * */ public function next() { if (next($this-_data) === false) { $this-_ptr = false; } else { $this-_ptr = true; } } /** * Defined by Iterator interface * */ public function rewind() { reset($this-_data); $this-_ptr = true; } /** * Defined by Iterator interface * * @return boolean */ public function valid() { return $this-_ptr; } } IN your bootstrap you instantiate it:- $acl = new Zend_Acl(); $acl-addResource(new Zend_Acl_Resource('protected')); $acl-deny(null, 'protected'); // Created a protected area for the purpose of demonstration $sitemapConfig = new Zend_Config(new Zend_Config_Ini('/path/to/ config.ini')); $sitemap = new Sitemap($sitemapConfig, $acl); // A 3rd arg $role can be added here if desired (see above) $view-sitemap = $sitemap; ...and in your view, it's as simple as:- ?php ul class=menu ?php foreach ($this-sitemap as $id = $section): ? lia href=?php echo $this-url($section-url, null, true); ? ?php echo $this-escape($section-title) ?/a/li ?php endforeach; ? /ul I can't say if it's best practice, but it works for me and the views end up being a lot cleaner for other designers/developers to read. Cheers this is something that interests me a lot as well. Unfortunately, this topic is not covered in Simons article. Are there best practises for making views visible/invisible depending on particular user roles? -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
[fw-general] Hooking your unit tests into the overall structure
This is probably a very stupid question that I have been unable to find the answers for, so feel free to educate me and point out where I went wrong. I'm trying to get Zend_Service_Audioscrobbler included in 0.9.0, and it's 99% there. The last thing I need to do is get my unit tests hooked in to the unit tests for the entire framework. How do I do that? Any help is greatly appreciated. -- Chris Hartjes My motto for 2007: Just build it, damnit! rallyhat.com - digital photo scavenger hunt @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard
Re: [fw-general] Zend_Search_Lucene partial word match
Hi Simon, No, wildcard queries or fuzzy search are not included into Zend_Search_Lucene yet. With best regards, Alexander Veremyev. Simon R Jones wrote: Is it possible for Zend_Search_Lucene to match partial words, for example simp to match simply? best wishes, Si
[fw-general] Fatal error in Zend_Mail_Transport_Smtp
Hi, There is a fatal error in Zend_Mail_Transport_Smtp: PHP Fatal error: Class 'Zend_Loader' not found in /home/httpd/phpinclude/ZendFramework/Zend/Mail/Transport/Smtp.php on line 175 To be more specific I use Zend_Mail in a very simple script which does not make use of Zend_Loader so I think Zend_Mail_Transport_Smtp should always includes it Olivier
Re: [fw-general] Zend_Search_Lucene result sorting problem
Hi Graeme, I've create an issue for this: http://framework.zend.com/issues/browse/ZF-1050 And I think, I've found what is the problem. Please test current SVN version or apply these changes: http://framework.zend.com/fisheye/browse/Zend_Framework/trunk/library/Zend/Search/Lucene.php?r1=3690r2=3924 With best regards, Alexander Veremyev. Graeme Merrall wrote: On 3/13/07, Alexander Veremyev [EMAIL PROTECTED] wrote: Hi Graeme, I saw something like this once. But don't remember what was the problem... Which PHP version do you use? Hi Alexander. I'm running PHP Version 5.2.0 www.entropy.ch Release 3 which is for OSX Intel. Cheers, Graeme
Re: [fw-general] ACL and Views
Yeah, I had thought of some sort of code library or article library but maybe not until ZF1.0 when there'll be less worry about API changes. Glad you found it useful! Hi Simon, your implementation looks really good! Wouldn't it be worth adding this code either to the ACL docs or to the existing ACL tutorial? regs, Stephan -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
Re: [fw-general] YAZFA
Simon Jones wrote: Very nice site redesign Chris Thanks! :-) Have you written any articles on your use of Zend Framework? Not yet, but that's a good idea. In order for such an article to focus on the positive aspects of ZF, I think I should wait until it has matured a bit. Chris -- Chris Shiflett http://shiflett.org/
Re: [fw-general] Zend_View Best-Practice Composite-View
Nesting of views is supported, but controllers can not currently be nested. Controllers can be chained using Zend_Controller_Action::_forward(). Unlike some other MVC patterns, views also do not contain sub-controllers. If you seek only nesting of views, see the recently added support for named segments in the response body: http://framework.zend.com/issues/browse/ZF-1024?page=com.cenqua.fisheye.jira:fisheye-tabpanel You might need to click on the FishEye link on the page above to see the relevant notes for the new methods. Named segments simplifies managing nested views, and assembling the results into a greater whole. The ZF Demo tutorial will include an example of nested views, after ZF 0.9 is released. Cheers, Gavin Kai Meder wrote: hello, has anybody information/ressources about a nice composite-view implementation? i need this for multiple nested templates, e.g.: - main-layout - controller-layout - view-layout - helper-layout etc... how do you solve this? thanks, kai
[fw-general] Building RESTful web services with ZF
I was googling around looking for some tutorials on implementing REST web services with ZF and found that Pádraic Brady's tutorial has disappeared off the web. Anyone have an archived copy kicking around they could share? -- Chris Hartjes My motto for 2007: Just build it, damnit! rallyhat.com - digital photo scavenger hunt @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard
Re: [fw-general] Building RESTful web services with ZF
On 3/14/07, Davey Shafik [EMAIL PROTECTED] wrote: Chris, Have you checked out the manual? It covers Zend_Rest_Server pretty well: http://framework.zend.com/manual/en/zend.rest.server.html I did...and I wonder if I am confusing REST with other web services. Check out this article (yes, I know it's not a PHP one) to see what I'm talking about: http://www.therailsway.com/2007/2/13/signout-part-1 It deals with creating RESTful interfaces. Perhaps Zend_Rest_Server isn't what I need here, instead I just need to create controller / action pairs that spit out XML as their response? -- Chris Hartjes My motto for 2007: Just build it, damnit! rallyhat.com - digital photo scavenger hunt @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard
Re: [fw-general] Building RESTful web services with ZF
Chris, Have you checked out the manual? It covers Zend_Rest_Server pretty well: http://framework.zend.com/manual/en/zend.rest.server.html - Davey On Mar 14, 2007, at 3:12 PM, Chris Hartjes wrote: I was googling around looking for some tutorials on implementing REST web services with ZF and found that Pádraic Brady's tutorial has disappeared off the web. Anyone have an archived copy kicking around they could share? -- Chris Hartjes My motto for 2007: Just build it, damnit! rallyhat.com - digital photo scavenger hunt @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard
[fw-general] A new diamond has been arised
Hy interrested fellows, I am very happy that I can announce you the inclusion of Zend_Translate into the core. It is avaiable since SVN 3933 and will be included within Release 0.9 This diamond or gem is the last milestone for all of you who want to create fully internationalized applications with the Zend_Framework. It has several great advantages. One is that it does not need any extension enabled even not for gettext. We have included a documentation with examples, so you can see how simple the creation of a internationalized application is. Included are Adapters for * Array * Gettext * Csv * Tmx * Xliff Additional adapters are planned and will be included after the release of 1.0 like a sql adapter or a qt adapter. I hope you enjoy our work and make good applications and websites with it ;-) Greetings Thomas I18N Team Leader and Main Coder for Zend_Translate
[fw-general] Thank you
Hi all, Short story: Thank you to everyone involved in the Zend Framework. You have re-ignited my interest in developing PHP applications and helped me learn a hell of a lot in the process :) Long story: As a self-taught developer, I started many years ago with a BBS system called Proboard. Proboard had a C SDK that allowed you to write add-ons (PEX) which where essentially executables that would run within Proboard and give access to the BBS's functions. After that, I wrote add-ons for various other programs / scripts until a couple of years ago when I started writing modifications for the vBulletin forum software. After about a year and a half I became disillusioned with the slow progress of vBulletin and decided to cast out and start writing fresh new PHP applications, rather than writing modifications for pre-built scripts and applications. It then became painfully obvious to me that writing complete PHP scripts was exceptionally hard. With Proboard / vBulletin / etc, all of the core bits where taken care of. For example, connection to databases, handling input filtering, and so on. After writing all of these methods / libraries from scratch I decided that perhaps PHP development wasn't for me. At this point, I decided to branch out in to Windows programming and played about with Visual C# for about 6 months until that one glorious day I accidentally discovered the Zend Framework. Without realising it, I had essentially been using frameworks all of my programming life in one form or another, be it the Probard SDK or extending vBulletin. To discover a nice, easy to use Framework for my favourite programming language (Yes, PHP :D) was incredible. Since I've started investigating / playing with the Zend Framework a month or 2 ago, I feel that I have learnt so much about PHP, OOP and software development as a whole. It has really opened my eyes to the possibilities that software development has to offer when done right. Anyway, I just wanted to say thank you to everyone involved in the Zend Framework project, and that I'm looking forward to v1.0 and the great new features that are bound to follow. Keep up the great work all! Kind regards, Alan.
Re: [fw-general] Hooking your unit tests into the overall structure
I'm not a phpunit pro, but normally it's very easy. There's a file called AllTests.php in the test root and every subdirectory and they are chained together (AllTests.php is included and called by AllTests.php in its parent directory). You'd normally just add your testcase files to the AllTests.php file and if had to create a new one you add it to the parent one. I just did what everyone else did in the existing files. If you need any configuration there's the file TestConfiguration.php.dist and TestConfiguration.php in the test root. The last one is ignored by svn and used if both exists. Just add some sane defaults to TestConfiguration.php.dist and your actual test configuration to the other. nico [14.03.2007 14:58] Chris Hartjes wrote: This is probably a very stupid question that I have been unable to find the answers for, so feel free to educate me and point out where I went wrong. I'm trying to get Zend_Service_Audioscrobbler included in 0.9.0, and it's 99% there. The last thing I need to do is get my unit tests hooked in to the unit tests for the entire framework. How do I do that? Any help is greatly appreciated. -- Chris Hartjes My motto for 2007: Just build it, damnit! rallyhat.com - digital photo scavenger hunt @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard
RE: [fw-general] Thank you
Thanks for the positive feedback! I'm happy we've managed to make it easy-to-use. We have always had a goal and strong bias in favor of usability. Best, Andi From: Alan Wagstaff [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 1:47 PM To: fw-general@lists.zend.com Subject: [fw-general] Thank you Hi all, Short story: Thank you to everyone involved in the Zend Framework. You have re-ignited my interest in developing PHP applications and helped me learn a hell of a lot in the process :) Long story: As a self-taught developer, I started many years ago with a BBS system called Proboard. Proboard had a C SDK that allowed you to write add-ons (PEX) which where essentially executables that would run within Proboard and give access to the BBS's functions. After that, I wrote add-ons for various other programs / scripts until a couple of years ago when I started writing modifications for the vBulletin forum software. After about a year and a half I became disillusioned with the slow progress of vBulletin and decided to cast out and start writing fresh new PHP applications, rather than writing modifications for pre-built scripts and applications. It then became painfully obvious to me that writing complete PHP scripts was exceptionally hard. With Proboard / vBulletin / etc, all of the core bits where taken care of. For example, connection to databases, handling input filtering, and so on. After writing all of these methods / libraries from scratch I decided that perhaps PHP development wasn't for me. At this point, I decided to branch out in to Windows programming and played about with Visual C# for about 6 months until that one glorious day I accidentally discovered the Zend Framework. Without realising it, I had essentially been using frameworks all of my programming life in one form or another, be it the Probard SDK or extending vBulletin. To discover a nice, easy to use Framework for my favourite programming language (Yes, PHP :D) was incredible. Since I've started investigating / playing with the Zend Framework a month or 2 ago, I feel that I have learnt so much about PHP, OOP and software development as a whole. It has really opened my eyes to the possibilities that software development has to offer when done right. Anyway, I just wanted to say thank you to everyone involved in the Zend Framework project, and that I'm looking forward to v1.0 and the great new features that are bound to follow. Keep up the great work all! Kind regards, Alan.
Re: [fw-general] Building RESTful web services with ZF
Hi Chris, My tutorial is still online at http://blog.astrumfutura.com/archives/245-RESTful-Web-Services-with-Zend-Framework.html Since I moved domains I managed to get the Serendipity plugin order for posts wrong so you'll have to forgive some of the malformed markup. Davey also made some mailing list posts around the date of this entry which you should also check since he answered a few of my questions about usage, particularly in handling method calls. Keep in mind this was written quite some time ago ;). Pádraic Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com - Original Message From: Chris Hartjes [EMAIL PROTECTED] To: Zend Framework General fw-general@lists.zend.com Sent: Wednesday, March 14, 2007 7:26:24 PM Subject: Re: [fw-general] Building RESTful web services with ZF On 3/14/07, Davey Shafik [EMAIL PROTECTED] wrote: Chris, Have you checked out the manual? It covers Zend_Rest_Server pretty well: http://framework.zend.com/manual/en/zend.rest.server.html I did...and I wonder if I am confusing REST with other web services. Check out this article (yes, I know it's not a PHP one) to see what I'm talking about: http://www.therailsway.com/2007/2/13/signout-part-1 It deals with creating RESTful interfaces. Perhaps Zend_Rest_Server isn't what I need here, instead I just need to create controller / action pairs that spit out XML as their response? -- Chris Hartjes My motto for 2007: Just build it, damnit! rallyhat.com - digital photo scavenger hunt @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard Need Mail bonding? Go to the Yahoo! Mail QA for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=listsid=396546091
Re: [fw-general] Building RESTful web services with ZF
On 3/14/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Chris, My tutorial is still online at http://blog.astrumfutura.com/archives/245-RESTful-Web-Services-with-Zend-Framework.html Since I moved domains I managed to get the Serendipity plugin order for posts wrong so you'll have to forgive some of the malformed markup. Davey also made some mailing list posts around the date of this entry which you should also check since he answered a few of my questions about usage, particularly in handling method calls. Keep in mind this was written quite some time ago ;). Thanks very much Padraic! -- Chris Hartjes My motto for 2007: Just build it, damnit! rallyhat.com - digital photo scavenger hunt @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard