[fw-general] Zend_Feed generation / validation
Hi all, I'm trying to generate a news feed with Zend_Feed respectively Zend_Feed_Builder, running ZF 1.7.6. I have encountered the following problems (sample code see below): -- How do I set the updatePeriod? e.g. sy:updatePeriodhourly/sy:updatePeriod -- How do I set the publication date (pubDate) per post item? e.g. pubDateThu, 08 Jan 2009 12:43:10 +/pubDate $feedArray = array( 'entries' = array( array( 'published' = 1235670030 'pubDate'= 1235670030 'lastUpdate' = 1235673630 Neither 'published' nor 'pubDate' will work (ok, both fields are no longer documented in the ZF API, I know...). The only field that gets generated is: updated2009-02-26T18:42:34+01:00/updated -- Why is the field 'description' required? Some RSS clients just display the description (e.g. Firefox, Apple Mail), others display the content even if there is a description present (e.g. Safari). Personally I prefer displaying the full content. But with Zend_Feed there doesn't seem to be a way of omitting the description. -- RSS 2.0 Problem (looks OK in Atom 1.0)... RSS does not validate due to missing 'link' tag. In Atom 1.0 it looks like this: link rel=self href=http://www.onlime.ch/news/feed; hreflang=de- ch/ Known RSS feeds that validate have a 'atom:link' tag, e.g.: atom:link href=http://www.onlime.ch/feed; rel=self type=application/rss+xml / The 'atom:link' tag does not get generated by Zend_Feed_Builder. Is there a way of adding extra custom defined tags next to the features supported by Zend_Feed_Builder? Validators give me the following errors: * content:encoded should not contain relative URL references * Missing atom:link with rel=self -- How do I set an author/editor per post item? e.g. dc:creatoriezzip/dc:creator -- 'author' field seems to act differently in Atom and RSS. valid Atom: author namePhilip Iezzi/name /author invalid RSS: managingEditor(Philip Iezzi)/managingEditor The feed setup should be transparent in Zend_Feed_Builder and both output (rss or atom) should be valid. Or am I wrong here? -- $feed-send() produces output of Content-Type application/rss+xml respectively application/atom+xml. Looks good! But is this really the recommended standard and do all modern browsers already support these content types? Can we call application/xml for RSS/Atom the old deprecated way? So many feeds out there deliver their content as application/xml. Any reason of doing so? == I have used the following validators: http://feedvalidator.org/ (service is currently down!) http://validator.w3.org/feed/ You'll find my test feeds here, ready to be validated: http://www.onlime.ch/news/feed - Atom 1.0 http://www.onlime.ch/news/rss - RSS 2.0 And that's my complete action code: -- public function feedAction() { $this-_helper-viewRenderer-setNoRender(); $this-_helper-layout-disableLayout(); // configuration $baseUrl = 'http://www.onlime.ch'; // get recent news $newsTbl = new News(); $select = $newsTbl-select(); $select-order('post_date DESC') -limit(10); $news = $newsTbl-fetchAll($select); $feedArray = array( 'title' = 'Onlime Webhosting News', 'link'= $baseUrl.'/news/feed, 'author' = 'Philip Iezzi', 'description' = 'Newsblog von Onlime Webhosting', 'language'= 'de-ch', 'charset' = 'utf-8', 'generator' = 'Zend Framework Zend_Feed', 'entries' = array() ); foreach ($news as $post) { $postDate = new Zend_Date($post-post_date, Zend_Date::ISO_8601); if (!isset($feedArray['lastUpdate'])) { $feedArray['lastUpdate'] = $postDate- get(Zend_Date::TIMESTAMP); } $feedArray['entries'][] = array( 'title' = $post-post_title, 'link'= $baseUrl.'/index/news/id/' . $post-id, 'guid'= $baseUrl.'/index/news/id/' . $post-id, 'description' = $post-post_description, 'published' = $postDate-get(Zend_Date::TIMESTAMP), 'lastUpdate' = $postDate-get(Zend_Date::TIMESTAMP), 'content' = $post-post_content ); } $feed = Zend_Feed::importArray($feedArray, 'atom'); // resp. 'rss' // send feed XML to client $feed-send(); } -- Sorry about that bunch of questions. Hope you can give me some hints. Thanks a lot! Regards, Philip
[fw-general] Why I am unable to access other actions than default?
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Hi guys, since saturday morning i am searching for a reason why my application is unable to display something else than module=default, controller=index and action=index. http://www.example.org/article/show/id/5 http://www.example.org/imprint http://www.example.org/category/1/Example All these urls will render index-action of index-controller of default-module and I have absolutly no idea why :-( I only can access other actions by setting these three parameters by myself using setModuleName(), setControllerName() and setActionName() or by using normal $_GET parameters (?module=defaultcontroller=articleaction=show). I can't find the mistake so I hope you help me finding it. http://www.pastie.org/403727 Directory structure http://www.pastie.org/403726 .htaccess http://www.pastie.org/403725 index.php http://www.pastie.org/403724 main.xml http://www.pastie.org/403723 Initialize.php Best regards, Jan -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iEYEAREDAAYFAkmqgOoACgkQAmDzOgJaVSHGyQCeIlceSONiTdij3WhsOd/wR7+t WtkAoK4+lFLNr6ndqCP6WwKBQaYMOF0k =yecR -END PGP SIGNATURE-
[fw-general] Input (file) from ini
hello, im having trouble getting my file input field to get the attribs from my ini file i get the element to display, but the attribs do not.. here is my code reseller.advertiserCreate.elements.logo.type = file reseller.advertiserCreate.elements.logo.options.label = Logo: reseller.advertiserCreate.elements.logo.options.required = false reseller.advertiserCreate.elements.logo.options.attribs.size = 13 reseller.advertiserCreate.elements.logo.options.attribs.class = logo_input reseller.advertiserCreate.elements.logo.options.attribs.tabIndex = 2 reseller.advertiserCreate.elements.logo.options.attribs.alt = Logo Upload Field reseller.advertiserCreate.elements.logo.options.destination = usr/logos reseller.advertiserCreate.elements.logo.options.decorators.type = ViewHelper any help would be great - Bob Hanson Web Developer SLC, UT -- View this message in context: http://www.nabble.com/Input-%28file%29-from-ini-tp22274917p22274917.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Form_Element_Hash best practices
Hi, I recently wrote a blog post about how I now use Zend_Form_Element_Hash, I hope someone might find it interesting/ userful. http://www.noginn.com/2009/03/01/preventing-csrf-properly/ I have outlined some issues with the standard approach and how to better tackle invalid CSRF tokens. Tom
[fw-general] Zend_Mail Zend_Mail_Transport_Sendmail (ZF 1.7.5) bugs. Can somebody confirm?
Hi all, Can anybody confirm that the latest Zend_Mail has the following bugs in combination with Zend_Mail_Transport_Sendmail. I'm not sure whether this relates to Zend_Mail_Transport_Smtp too. 1) Cc and Bcc recipients are also added to the To list: I think I traced this down to the following lines in the following methods: Zend_Mail::_addRecipientAndHeader() $this-_recipients[$email] = 1; Zend_Mail::getRecipients() return array_keys($this-_recipients); Zend_Mail_Transport_Abstract::send() $this-recipients = implode(',', $mail-getRecipients()); Zend_Mail_Transport_Sendmail::_sendMail() $result = mail( $this-recipients, etc... The first argument for mail() should only contain To addresses, not all addresses. This could very well only be related to Windows as per Zend_Mail_Transport_Sendmail::_prepareHeaders() if (0 === strpos(PHP_OS, 'WIN')) { etc... Can somebody confirm that this is accurate? 2) Cc's with $name gives 'SMTP server response: 501 5.5.4 Invalid Address' This could very well be related to bug 1 because the first argument to the mail() call now contains invalid filtered Cc addresses. Please confrim this with me, so I will file a bug report. Cheers System: OS: Windows XP SP3 Webserver: Apache 2.2.9 PHP: 5.2.6 _ Blijf altijd op de hoogte van wat jouw vrienden doen http://home.live.com
RE: [fw-general] Controller / Model routines
Keith, Thanks for the response. Perhaps it isn't all too bad to send the mail from the Model. It didn't feel right at first because I felt that the Controller should be responsible for the direct communication with the user. I filed 'mailing the user' under the same responsibilities. I like your idea of the MailService. I'm going to implement something similar now. Thanks! Date: Sat, 28 Feb 2009 16:55:35 + Subject: Re: [fw-general] Controller / Model routines From: mute.p...@googlemail.com To: fire-eyed-...@hotmail.com CC: fw-general@lists.zend.com I dont see a problem with having your Model send the email, what I would do though is put the mail code into a service, this way you keep mail logic out of your Model. This way for testing you can replace your mail service easily :) Model-signup() { ModelDbTable-startTransaction() try { ModelDbTable-insert() MailService-send(); ModelDbTable-commit() return true } catch( Exception ) { ModelDbTable-rollBack() return false } } 2009/2/28 fire-eyed-...@hotmail.com: Hey all, I'm trying to determine how I can have my Model rollback a transaction it made on a DB table when the calling Controller fails to send a confirmation mail afterwards. What is good practice? Am I approaching this in the wrong way perhaps? Should I send the Mail from within the Model? That just doesn't feel right. I'ld love to read your suggestions. Thank you in advance. In short this is what happens now in pseudo code (please read the comments inside the first catch, where I try to convey my point): == Controller == Controller-signup() { if( true == Model-signup() ) { try { Mail-send() } catch( Exception ) { // seems stupid to have the Model roll back the transaction from here, no? } } else { // do something when Model-signup() failed } } == Model == Model-signup() { ModelDbTable-startTransaction() try { ModelDbTable-insert() ModelDbTable-commit() return true } catch( Exception ) { ModelDbTable-rollBack() return false } } Cheers Twee keer zo leuk. Deel foto's terwijl je chat met de nieuwe Messenger -- -- [MuTe] -- _ De leukste online filmpjes vind je op MSN Video! http://video.msn.com/video.aspx?mkt=nl-nl
[fw-general] http://domain.com/index/index vs. http://domain.com
Hi, I understand that by default Zend Framework uses a route definition of :module/:controller/:action. As a result, if I have a domain called http://domain.com, the following urls will dispatch to the indexAction of the IndexController of the default module: http://domain.com/default/index/index http://domain.com/default/index http://domain.com/index/index http://domain.com/index http://domain.com I want to keep the default router and default route, but I only want users to access the index controller / index action by typing http://domain.com and not any of the other possible urls. Does anybody know how this can be accomplished, if at all? So far, the solution that I have in mind is to add a check in my indexAction() function of my IndexController so that if the $_SERVER['REQUEST_URI'] is not '/', then redirect to ErrorController::errorAction(). Any help will be appreciated. - Paul -- View this message in context: http://www.nabble.com/http%3A--domain.com-index-index-vs.-http%3A--domain.com-tp22277532p22277532.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Form_Element_Hash best practices
-- Tom Graham tom.gra...@jadu.co.uk wrote (on Sunday, 01 March 2009, 05:07 PM +): I recently wrote a blog post about how I now use Zend_Form_Element_Hash, I hope someone might find it interesting/userful. http://www.noginn.com/2009/03/01/preventing-csrf-properly/ I have outlined some issues with the standard approach and how to better tackle invalid CSRF tokens. This is a great writeup. Obviously, it's not something we can do generically within Zend_Form, but I'd love to add that example to the manual. Any objections? -- Matthew Weier O'Phinney Software Architect | matt...@zend.com Zend Framework | http://framework.zend.com/
[fw-general] Invalid XHTML attribute in Zend_Form_Element
Hello, I was trying to validate a page and verified that a Zend Form element creates an invalid XHTML attribute helper. Like helper=formText. How can I prevent it from rendering? Not that I unconditionally need my page to be valid but I'd like to. I tried $myElement-setAttrib('helper', null); but it gives an error when the Zend_Form_Decorator_ViewScript decorator is called. Thank you, Luiz Brandao
[fw-general] Zend Router Route dilemma and solution
Hi, I understand that by default Zend Framework uses a route definition of :module/:controller/:action. As a result, if I have a domain called http://domain.com, the following urls will dispatch to the indexAction of the IndexController of the default module: http://domain.com/default/index/index http://domain.com/default/index http://domain.com/index/index http://domain.com/index http://domain.com I really did not want users to be able to type any of the above urls to gain access to IndexController::indexAction(). Instead, I wanted users to type only the following to access IndexController::indexAction(): http://domain.com http://domain.com/index http://domain.com/index.html Here is how I did it: 1. I added a static route to the front controller to route http://domain.com/index.html to IndexController::indexAction(): $router = $front-getRouter(); $route = new Zend_Controller_Router_Route_Static( 'index.html', array( 'controller' = 'index', 'action' = 'index', 'module' = 'default' ) ); $router-addRoute('home', $route); 2. I created an error.phtml view script for the IndexController (app/view/scripts/index/error.phtml): h1An error occurred/h1 h2?= $this-message ?/h2 3. In my indexAction(), I check the REQUEST_URI and take the user to the error.phtml view script if the REQUEST_URI does not match any of the desired REQUEST_URI: public function indexAction() { $requestUri = explode(?, $this-_request-getRequestUri()); if ($requestUri[0] != '/' $requestUri[0] != '/index' $requestUri[0] != '/index.html') { $this-_response-setHttpResponseCode(404); $this-view-message = 'Page not found'; $this-_helper-viewRenderer-render('error'); } } -- View this message in context: http://www.nabble.com/Zend-Router-Route-dilemma-and-solution-tp22282054p22282054.html Sent from the Zend Framework mailing list archive at Nabble.com.