Re: [fw-general] Ignoring matches in Zend_Controller_Router_Route_Regex (possible assemble() bug)
Try this: $route = new Zend_Controller_Router_Route_Regex( 'foo/(\d+)(?:/(\w+))?', array( 'module' = 'MyModule', 'controller' = 'Foo', 'action' = 'index' ), array( 1 = 'id', 2 = 'action' ), 'foo/%d/%s' ); ?: at the begin of the second match will tell PHP to ignore it. I didn't try it but should work. Giuliano Colin Guthrie-6 wrote: Hi, I've just run into a problem when trying to assemble a route into a link. Allow me to demonstrate: $route = new Zend_Controller_Router_Route_Regex( 'foo/(\d+)(/(\w+))?', array( 'module' = 'MyModule', 'controller' = 'Foo', 'action' = 'index' ), array( 1 = 'id', 3 = 'action' ), 'foo/%d/%s' ); $router = Zend_Controller_Front::getInstance()-getRouter(); $router-addRoute('MyRoute', $route); This route should match urls: * /foo/123 (action = index) * /foo/123/ (action = index) (this works due to the matcher striping off leading/trailing slashes) * /foo/123/bar (action = bar) If I were to put the / as a required part of the regexp like this: 'foo/(\d+)/(\w+)?' then this will never match the index case without specifying it explicitly (i.e. the first two example URLs above will not match). [...] -- View this message in context: http://www.nabble.com/Ignoring-matches-in-Zend_Controller_Router_Route_Regex-%28possible-assemble%28%29-bug%29-tp19747692p19756128.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Checkbox and Dojo_foRM validation, please help if anyone know how
So, are we back from conference? :) vladimirn wrote: Ah :) I would like i am there :) Have a nice time :) Matthew Weier O'Phinney-3 wrote: -- vladimirn [EMAIL PROTECTED] wrote (on Wednesday, 17 September 2008, 08:11 AM -0700): Anyone? :( Sorry, a lot of us are at ZendCon this week. ;) vladimirn wrote: Hello all, is anyone here able to help about form validation please? After pressing submit button expected behaviour is stopping form submission if checkbox is not checked. I have a bunch of stuffs in my form. So far, checkbox validation wont work. $agreements-addElement ( 'CheckBox', 'ages', array ('required' = true, 'label' = 'I\'m Over 18 years old') ) Submit button: $footer-addElement ( 'SubmitButton', 'submit', array ('label' = 'Submit!','style'='clear:both' ) ); view script: ? $this-dojo()-javascriptCaptureStart() ? function validateForm() { var form = dijit.byId(signup); if (!form.validate()) { alert(Invalid form); return false; } return true; } ? $this-dojo()-javascriptCaptureEnd() ? ? $this-dojo()-onLoadCaptureStart() ? function () { dojo.connect(dijit.byId(signup), onSubmit, validateForm); } ? $this-dojo()-onLoadCaptureEnd() ? div class=signupForm ?= $this-form ? /div -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19534303.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19756726.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Ignoring matches in Zend_Controller_Router_Route_Regex (possible assemble() bug)
Giuliano Riccio wrote: Try this: $route = new Zend_Controller_Router_Route_Regex( 'foo/(\d+)(?:/(\w+))?', array( 'module' = 'MyModule', 'controller' = 'Foo', 'action' = 'index' ), array( 1 = 'id', 2 = 'action' ), 'foo/%d/%s' ); ?: at the begin of the second match will tell PHP to ignore it. I didn't try it but should work. O, nice! That works perfectly That's very handy to know about regexps when used in this way. Perfect. Thanks for that Giuliano. A new tool added to my regexp armoury! http://xkcd.com/208/ :p Col PS I still cant think of a reason to nullify a match in a url at assembly time, but I wont loose sleep over it :D -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
Re: [fw-general] Request for Feedback: Interface for Zend_Controller_Action
Benjamin Eberlei wrote: I'd like some feedback if someone has Use-Cases for this issue (other then the ones i will specifiy later) or sees potential dangerous problems occuring to existing applications with this change. I can't see any problems in terms of code. Zend_Controller_Action doesn't change its behaviour. And it allows do write very short controller without thinking about all the magic in the base class. On the other hand it (could) changes conventions defined by this magic in Zend_Controller_Action, which might reading or maintaing code more complicated. nico
Re: [fw-general] W3C Markup Validation
After I sent my response last night, I was thinking more about the fact that the HTTP_REFERER is technically a form of user input since it's sent by the user's browser (in my understanding). For this reason, it should probably be filtered before used anywhere in the application to prevent SQL injection (not relevant in this example) or XSS. I can't think of a scenario where an XSS vulnerability could actually occurr using the HTTP_REFERER, but the fact remains that it's user input and should not be trusted because it can be tampered with. I'm not sure exactly what filter should be used, but something that makes sure it contains only a valid URL. On Tue, Sep 30, 2008 at 11:02 PM, Matthew Weier O'Phinney [EMAIL PROTECTED]wrote: -- Matthew Ishii [EMAIL PROTECTED] wrote (on Tuesday, 30 September 2008, 07:13 PM -0700): I am not sure if this has been brought up before (though most likely it has) however I will anyway, I am having issues validating my pages against the W3C webstandards for proper HTML markup. I am using the XHTML1_STRICT Doctype. It seems like the phtml webpage format is having difficulties working with the standards, for example, I have a 'back' link that is using the SERVER 'HTTP_REFERER' variable to direct users to the last visited page. When I attempt to validate the page with the following markup, I receive the following errors: Markup - p class=padded_paragrapha href=?php echo $_SERVER['HTTP_REFERER'] ? class=boldBack/a/p Error(s) - Line 92, Column 37: character is the first character of a delimiter but occurred as data. Warning Line 93, Column 9: character is the first character of a delimiter but occurred as data. bNotice/b: Undefined index: HTTP_REFERER in b/home1/ioforgec/zend/applic What I find strange is the notice, that the validation service catches in the source, but when viewed by me in the browser and when viewed in the post-rendered source I dont see such a notice. I suppose the HTTP_REFERER is not set for a robotic user, which is what the validation service must be manifesting as to my application. But how can I prevent this from causing the page not to validate? A couple things I see here. First, what are you validating? the .phtml file itself, or a page that renders that view script? Second, yes, HTTP_REFERER is something that may or may not be present based on the current request environment I'd suggest creating a view helper that generates the backlink; you could then add some logic in the helper to check for the existence of the key, and if not present, simply emit an empty string or an anchor. It might look like this: class My_View_Helper_BackLink extends Zend_View_Helper_Abstract { public function backLink() { $link = '#'; if (array_key_exists('HTTP_REFERER', $_SERVER)) { $link = $_SERVER['HTTP_REFERER']; } return 'a href=' . $link . ' class=boldBack/a'; } } -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- Bradley Holt [EMAIL PROTECTED]
Re: [fw-general] Zend_Db specify character set
Thank you for the responses! Rob On Wed, Oct 1, 2008 at 2:29 AM, Stefan Gehrig [EMAIL PROTECTED] wrote: Hi Rob, there is another possibility if you're using the Zend_DB-PDO-Adapters: $db=Zend_Db::factory('Pdo_Mysql', array( 'host' = 'localhost', 'username' = 'user', 'password' = 'pa$$w0rd', 'dbname' = 'database', 'driver_options' = array( PDO::MYSQL_ATTR_INIT_COMMAND = 'SET NAMES utf8' ) )); This ensures that the SET-NAMES-Command is issued with every reconnect of the underlying adapter. Best regards Stefan *Von:* Bradley Holt [mailto:[EMAIL PROTECTED] *Gesendet:* Dienstag, 30. September 2008 23:04 *An:* Rob Riggen *Cc:* fw-general@lists.zend.com *Betreff:* Re: [fw-general] Zend_Db specify character set Hi Rob - I usually do this by issuing a 'SET NAMES UTF8' query. On Tue, Sep 30, 2008 at 4:59 PM, Rob Riggen [EMAIL PROTECTED] wrote: Is there a way to force the character set on mysql db connections to UTF-8? Thanks, Rob *Robert Riggen* - Zend Certified Engineer *Big Yellow Technologies, LLC* Essex Junction, VT 05452 802.578.6719 [EMAIL PROTECTED] -- Bradley Holt [EMAIL PROTECTED] *Robert Riggen* - Zend Certified Engineer *Big Yellow Technologies, LLC* Essex Junction, VT 05452 802.578.6719 [EMAIL PROTECTED]
[fw-general] Zend_Config_Writer proposal ready for review
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Greetings folks, I'm happy to announce that Zend_Config_Writer is ready for review. I'd like too see your thoughts about it, and hopefully the development on it can soon start. http://framework.zend.com/wiki/display/ZFPROP/Zend_Config_Writer+-+Ben+Scholzen Ben - -- ... : ___ _ ___ ___ ___ _ ___: : | \ /_\ / __| _ \ _ (_) \ : : | |) / _ \\__ \ _/ / | |) | : : |___/_/:\_\___/_| |_|_\_|___/ : ::: : Web: http://www.dasprids.de : : E-mail : [EMAIL PROTECTED] : : Jabber : [EMAIL PROTECTED] : : ICQ: 105677955 : ::: -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFI43aM0HfT5Ws789ARAhWKAJ9Xe9HJoWHy63L731I/mfvponwy9gCgsBsm k/kp1/zBP6w/pBwet9gB/QQ= =nJMF -END PGP SIGNATURE-
Re: [fw-general] Trouble with adding view helpers
-- Ed West [EMAIL PROTECTED] wrote (on Tuesday, 30 September 2008, 09:06 PM -0700): I'm still having problems, though what you suggested made a difference. Now I have: $this-view-addHelperPath('/home/ewest/project/library/Zend/View/Helper'); $this-view-addHelperPath('/home/ewest/project/application/views/helpers', 'My_Helper'); My test page uses Zend_View_Helper_Layout, Zend_View_Helper_Doctype, and my own My_Helper_Url class. All three helpers are working. However, these errors are getting thrown: Error number: 2 Error string: fopen(/home/ewest/project/application/views/ helpers/Doctype.php) [function.fopen]: failed to open stream: No such file or directory Error number: 2 Error string: fopen(/home/ewest/project/application/views/ helpers/Layout.php) [function.fopen]: failed to open stream: No such file or directory Again, those two helpers are working-- the correct helpers are first getting loaded from '/home/ewest/project/library/Zend/View/Helper'. But it looks like the plugin loader is attempting to load the classes again from /home/ewest/ project/application/views/helpers, which causes the errors. This is fine, normal, and expected. Within Zend_Loader::isReadable(), we use fopen() with its third parameter to allow searching the include_path; this is many, many times faster than manually looping over paths. However, fopen() emits a warning when it is unable to find a file. We suppress this warning from display with the '@' operator, but if you are using the PHP error_log, it will still get logged. So, basically... all is working as expected. Nothing to see here, move along... On Tue, Sep 30, 2008 at 8:46 AM, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote: -- Ed West [EMAIL PROTECTED] wrote (on Tuesday, 30 September 2008, 07:50 AM -0700): I'm having trouble using Zend_View::addHelper to add additional helper paths. I have a project that lives in /home/ewest/project . The standard Zend_View_Helper classes live under /home/ewest/project/library/Zend/ View/ Helper. /home/ewest/project/library is also part of my PHP include path. My own helper classes reside under /home/ewest/project/application/views/ helpers. There, I have my own Url helper class that should override the standard Zend_View_Helper_Url-- my version takes a string argument instead of an array. In my base action class's initView method, I call: $this-view-addHelperPath('/home/ewest/project/library/Zend/View/ Helper', ''); $this-view-addHelperPath('/home/ewest/project/application/views/ helpers', ''); Zend_View does not allow adding helper paths with blank prefixes. Either omit the second argument (the prefix 'Zend_View_Helper' will be assumed), or specify your custom prefix. This will likely correct the issue you're observing. However, I get errors like this on my test page: Error number: 2 Error string: fopen(/home/ewest/project/application/views / helpers/Doctype.php) [function.fopen]: failed to open stream: No such file or directory Error file: /home/ewest/project/library/Zend/Loader.php Error line: 160 If I remove the second call to addHelper, then I end up with the error: Catchable fatal error: Argument 1 passed to Zend_View_Helper_Url::url() must be an array, string given It seems that only one path is being used at a time instead of both. I've checked the documentation-- does anyone have any idea what's going wrong? -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] W3C Markup Validation
-- Matthew Ishii [EMAIL PROTECTED] wrote (on Tuesday, 30 September 2008, 09:16 PM -0700): Thank you for the suggestions, and as everyone pointed out, the HTTP_REFERER is the issue here not the .phtml format. @Matthew - I was validating the markup .. the HTML that is rendered when you view it in a webbrowser. The W3C consortium is attempting to implement webstandards and practices in how developers create and display web pages. There are similar standards for CSS as well. I was simply trying to validate my HTML to these specific standards. I'm well aware of the W3C and its validators - I was simply wanting to know if you were trying to validate the original view script markup or the rendered markup, as it makes a difference. :P I've known people to attempt to validate their view scripts in the past; if you use short tags, validation will fail, but normal tags work fine. Since you were using short tags, there was a possibility that the validation error was from an attempt to validate the view script markup, and not the final, rendered result. On Tue, Sep 30, 2008 at 8:02 PM, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote: -- Matthew Ishii [EMAIL PROTECTED] wrote (on Tuesday, 30 September 2008, 07:13 PM -0700): I am not sure if this has been brought up before (though most likely it has) however I will anyway, I am having issues validating my pages against the W3C webstandards for proper HTML markup. I am using the XHTML1_STRICT Doctype. It seems like the phtml webpage format is having difficulties working with the standards, for example, I have a 'back' link that is using the SERVER 'HTTP_REFERER' variable to direct users to the last visited page. When I attempt to validate the page with the following markup, I receive the following errors: Markup - p class=padded_paragrapha href=?php echo $_SERVER['HTTP_REFERER'] ? class=boldBack/a/p Error(s) - Line 92, Column 37: character is the first character of a delimiter but occurred as data. Warning Line 93, Column 9: character is the first character of a delimiter but occurred as data. bNotice/b: Undefined index: HTTP_REFERER in b/home1/ioforgec/zend/applic What I find strange is the notice, that the validation service catches in the source, but when viewed by me in the browser and when viewed in the post-rendered source I dont see such a notice. I suppose the HTTP_REFERER is not set for a robotic user, which is what the validation service must be manifesting as to my application. But how can I prevent this from causing the page not to validate? A couple things I see here. First, what are you validating? the .phtml file itself, or a page that renders that view script? Second, yes, HTTP_REFERER is something that may or may not be present based on the current request environment I'd suggest creating a view helper that generates the backlink; you could then add some logic in the helper to check for the existence of the key, and if not present, simply emit an empty string or an anchor. It might look like this: class My_View_Helper_BackLink extends Zend_View_Helper_Abstract { public function backLink() { $link = '#'; if (array_key_exists('HTTP_REFERER', $_SERVER)) { $link = $_SERVER['HTTP_REFERER']; } return 'a href=' . $link . ' class=boldBack/a'; } } -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] Routing
I would still like to hear from the rest of the list. Does anyone have anything that they've done on this topic? Jason On Tue, Sep 30, 2008 at 12:13 PM, Michał Minicki [EMAIL PROTECTED] wrote: Jason Eisenmenger wrote: This is directed at Martel (since he's the route guy), but I thought I'd plug the list to see what you people have to say. Great idea, Jason. I don't have much time on my hand these days so I can't really get into it. But from the first glance your request seems very resonable. And yes, you're right, route chaining seems similar to nesting from what you say. What you can do right now is to put a proposal for users to comment on. Try starting with an interface (that's what the skeletons are there for, I suppose) and put it out for comments. There are lots of people with valuable opinions. And after that just try to implement your idea. It's a fact I'm the original author of the router and more or less the current maintainer. But the framework is a community driven project and you can (and even should) propose better solutions. Especially if you have everything worked out already ;) Jason Eisenmenger -- Michał Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | http://aie.pl/martel.asc =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Idleness is not doing nothing. Idleness is being free to do anything. -- Floyd Dell
[fw-general] Dojo always enabled
In some pages (where I put forms), I want to user Dojo forms. For this reason, I put Zend_Dojo::enableView($this-view); in that controller's actions. And I extend my form from Zend_Dojo_Form. In my layout, I've added : ?php if ($this-dojo()-isEnabled()) { $this-dojo()-setLocalPath($this-staticUrl('js/dojo/dojo.js')) -addStyleSheetModule('dijit.themes.tundra'); echo $this-dojo(); } ? And in my bootstrap: $view-addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper'); Now, I get in every page (and not only where I activated Dojo in my action) that HTML code: style type=text/css !-- @import /fourgon.net/public/js/dijit/themes/tundra/tundra.css; -- /style script type=text/javascript src=/fourgon.net/public/js/dojo/dojo.js/script ... I don't understand why Dojo seem to be enabled by default? - Guillaume ORIOL Sofware architect Technema -- View this message in context: http://www.nabble.com/Dojo-always-enabled-tp19762103p19762103.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Dojo always enabled
-- Guillaume Oriol [EMAIL PROTECTED] wrote (on Wednesday, 01 October 2008, 07:45 AM -0700): In some pages (where I put forms), I want to user Dojo forms. For this reason, I put Zend_Dojo::enableView($this-view); in that controller's actions. And I extend my form from Zend_Dojo_Form. In my layout, I've added : ?php if ($this-dojo()-isEnabled()) { $this-dojo()-setLocalPath($this-staticUrl('js/dojo/dojo.js')) -addStyleSheetModule('dijit.themes.tundra'); echo $this-dojo(); } ? And in my bootstrap: $view-addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper'); Now, I get in every page (and not only where I activated Dojo in my action) that HTML code: A couple of things. First, calling Zend_Dojo::enableView($view) does two things: it adds the dojo helper path to the view object -- which means you don't need that last call to addHelperPath() above -- and enables dojo. This brings me to my second point. If you're *ever* using Dojo in your application, do this in your bootstrap: Zend_Dojo::enableView($view); $view-dojo()-disable(); That way, you can selectively enable it in view scripts when you need it. If you have any requirements that are necessary any time dojo is enabled, set those in the bootstrap as well: $view-dojo()-setLocalPath($view-staticUrl('js/dojo/dojo.js')) -addStyleSheetModule('dijit.themes.tundra'); Then your layout script becomes really simple: ?= $this-dojo() ? If dojo is disabled, nothing will be emitted; if it's enabled, the proper statements will appear. style type=text/css !-- @import /fourgon.net/public/js/dijit/themes/tundra/tundra.css; -- /style script type=text/javascript src=/fourgon.net/public/js/dojo/dojo.js/script ... I don't understand why Dojo seem to be enabled by default? -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] Looking for a complete Complete Zend_Paginator example
I don't understand Matt. Could you provide an example? controller: public function paginateAction() { $select= $this-db-select()-from( 'runz_miles', 'EMPL_NO')-where('empl_no = ?', 31713); $this-view-result = $this-db-fetchAll($sql); $paginator = Zend_Paginator::factory($this-view-result); $paginator-setCurrentPageNumber(15); $this-view-paginator = $paginator; } Everytime I clock on a link it will come back to this action. Right? SO what prevents it from not calling the sql again? Matthew Ratzloff wrote: Use a Zend_Db_Select object for your query and pass the instance to factory(). If that doesn't suit your needs for some reason, you can easily write your own adapter by implementing Zend_Paginator_Adapter_Interface or extending Zend_Paginator_Adapter_DbSelect. Hope that helps, -Matt On Tue, Sep 30, 2008 at 8:13 AM, 411161 [EMAIL PROTECTED] wrote: Thanks. For some reason, I must have missed all that when I first looked at the reference guide. So what I have done now is, changed my view to add the following: ?= $this-paginationControl($this-paginator2, 'Sliding', 'p.phtml'); ? And in the p.phtml I have added the code from http://framework.zend.com/manual/en/zend.paginator.usage.html under the heading: Item pagination What I am still unsure of is how I can not go to the db each time I click one of my links(first, last). I can't seem to find that in the documentation. Not sure if this is where sessions come in or what. But I was hoping to see an example. 411161 wrote: I have it working, but I am not sure how to create links for next, last, first, previous, numbers, etc.. I am also not sure how to handle links in my controller. This is what I have so far. controller: public function paginateAction() { $sql = 'SELECT * FROM runz_miles WHERE empl_no = 31713'; $this-view-result = $this-db-fetchAll($sql); $paginator = Zend_Paginator::factory($this-view-result); $paginator-setCurrentPageNumber(15); $this-view-paginator = $paginator; } in my view I have: table ? foreach($this-paginator as $key = $row){ echo trtd .$row['EMPL_NO'] . /td\n; echo td .$row['PRISM_ORG_CODE'] . /td/tr\n; } ? /table How do I create the links and I how do I handle the action so that it will not try and call the sql again? -- View this message in context: http://www.nabble.com/Looking-for-a-complete-Complete-Zend_Paginator-example-tp19731530p19744120.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Looking-for-a-complete-Complete-Zend_Paginator-example-tp19731530p19764012.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Looking for a complete Complete Zend_Paginator example
In other words, instead of this: $select= $this-db-select()-from( 'runz_miles', 'EMPL_NO')-where('empl_no = ?', 31713); $this-view-result = $this-db-fetchAll($sql); $paginator = Zend_Paginator::factory($this-view-result); Do this: $select= $this-db-select()-from( 'runz_miles', 'EMPL_NO')-where('empl_no = ?', 31713); $paginator = Zend_Paginator::factory($select); Hope that helps, -Matt On Wed, Oct 1, 2008 at 9:17 AM, 411161 [EMAIL PROTECTED] wrote: I don't understand Matt. Could you provide an example? controller: public function paginateAction() { $select= $this-db-select()-from( 'runz_miles', 'EMPL_NO')-where('empl_no = ?', 31713); $this-view-result = $this-db-fetchAll($sql); $paginator = Zend_Paginator::factory($this-view-result); $paginator-setCurrentPageNumber(15); $this-view-paginator = $paginator; } Everytime I clock on a link it will come back to this action. Right? SO what prevents it from not calling the sql again? Matthew Ratzloff wrote: Use a Zend_Db_Select object for your query and pass the instance to factory(). If that doesn't suit your needs for some reason, you can easily write your own adapter by implementing Zend_Paginator_Adapter_Interface or extending Zend_Paginator_Adapter_DbSelect. Hope that helps, -Matt On Tue, Sep 30, 2008 at 8:13 AM, 411161 [EMAIL PROTECTED] wrote: Thanks. For some reason, I must have missed all that when I first looked at the reference guide. So what I have done now is, changed my view to add the following: ?= $this-paginationControl($this-paginator2, 'Sliding', 'p.phtml'); ? And in the p.phtml I have added the code from http://framework.zend.com/manual/en/zend.paginator.usage.html under the heading: Item pagination What I am still unsure of is how I can not go to the db each time I click one of my links(first, last). I can't seem to find that in the documentation. Not sure if this is where sessions come in or what. But I was hoping to see an example. 411161 wrote: I have it working, but I am not sure how to create links for next, last, first, previous, numbers, etc.. I am also not sure how to handle links in my controller. This is what I have so far. controller: public function paginateAction() { $sql = 'SELECT * FROM runz_miles WHERE empl_no = 31713'; $this-view-result = $this-db-fetchAll($sql); $paginator = Zend_Paginator::factory($this-view-result); $paginator-setCurrentPageNumber(15); $this-view-paginator = $paginator; } in my view I have: table ? foreach($this-paginator as $key = $row){ echo trtd .$row['EMPL_NO'] . /td\n; echo td .$row['PRISM_ORG_CODE'] . /td/tr\n; } ? /table How do I create the links and I how do I handle the action so that it will not try and call the sql again? -- View this message in context: http://www.nabble.com/Looking-for-a-complete-Complete-Zend_Paginator-example-tp19731530p19744120.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Looking-for-a-complete-Complete-Zend_Paginator-example-tp19731530p19764012.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] How to dynamically create filteringSelect
Hello, I have a page in my application to create invoices. All the form elements are created by Zend_Form and few use Dojo widgets. For a handy product select list, I am using filteringSelect widget generated by Zend_Form_Dojo. [snippet of code to show how I am creating the form element] $productId = new Zend_Dojo_Form_Element_FilteringSelect('productName); $productId-setLabel('Product Name') -setAutoComplete(true) -setStoreId('productStore') -setStoreType('dojo.data.ItemFileReadStore') -setStoreParams(array('url'='/product/jsonlist')) -setAttrib(searchAttr, name); [/snippet] This creates one input element with filteringSelect widget. I am fine till this point. There is a more products button on the page. When the user clicks on the button, another input element with filteringSelect widget should appear. This input element will also use JSON from the same URL and expects the user to select another product. The more products button should keep on generating more input elements with filteringSelect widget when clicked. How would you create the input fields with filteringSelect widgets dynamically in this situation? I presume, the store names have to be unique. Can you suggest the steps and the flow required to achieve this objective? Code snippets would be much appreciated. Regards, -- Sudheer Satyanarayana Binary Vibes Information Technologies Pvt. Ltd. Postal Address: #506, 10th B Main Road, I Block, Jayanagar, Bangalore – 560 011 URL : www.binaryvibes.co.in Phone: +91 80 41558451 * Mobile: +91 99005 07499 Community : http://lampcomputing.com
Re: [fw-general] help pls: headers being set, before preDispatch
change headers_sent() to headers_sent ($filename, $linenum) and see where the output started. 2008/10/1 Terre Porter [EMAIL PROTECTED] Help... I'm having a bit of a pain with some surprise headers being set somewhere... I've put this in my controllers preDispatch function for testing.. Code if (headers_sent()) { $this-logger('-- preDispatch - headers sent'); logger(headers_list()); } Code The logger simply writes to a log file. In the log file I have.. Log [ 2008-10-01T18:42:26-04:00 ] [ 3.06 MB ] [ INFO ] : -- preDispatch - headers sent [ 2008-10-01T18:42:26-04:00 ] [ 3.07 MB ] [ INFO ] : array(5) { [0] = string(23) X-Powered-By: PHP/5.2.5 [1] = string(38) Expires: Thu, 19 Nov 1981 08:52:00 GMT [2] = string(77) Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [3] = string(16) Pragma: no-cache [4] = string(23) Content-type: text/html } Log My question is WHERE are they coming from... It's driving me nuts as this does not happen on the development server but does when putting the code to the live server. I've added the check function before the $controller-dispatch(); and no headers, but by the time it gets to the controller there are headers... Anyone got some other ideas? Thanks Terre
RE: [fw-general] help pls: headers being set, before preDispatch
Ha That worked. There was a funky character at the end of one of my php includes... Not sure where it came from, but now that it's gone the pages are working again... Yay! Totally forgot about adding file and line number in that function... It's been a long day... Thank for the pointer it helped. Terre From: carlos koch [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 01, 2008 7:33 PM To: fw-general@lists.zend.com Subject: Re: [fw-general] help pls: headers being set, before preDispatch change headers_sent() to headers_sent ($filename, $linenum) and see where the output started. 2008/10/1 Terre Porter [EMAIL PROTECTED] Help... I'm having a bit of a pain with some surprise headers being set somewhere... I've put this in my controllers preDispatch function for testing.. Code if (headers_sent()) { $this-logger('-- preDispatch - headers sent'); logger(headers_list()); } Code The logger simply writes to a log file. In the log file I have.. Log [ 2008-10-01T18:42:26-04:00 ] [ 3.06 MB ] [ INFO ] : -- preDispatch - headers sent [ 2008-10-01T18:42:26-04:00 ] [ 3.07 MB ] [ INFO ] : array(5) { [0] = string(23) X-Powered-By: PHP/5.2.5 [1] = string(38) Expires: Thu, 19 Nov 1981 08:52:00 GMT [2] = string(77) Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [3] = string(16) Pragma: no-cache [4] = string(23) Content-type: text/html } Log My question is WHERE are they coming from... It's driving me nuts as this does not happen on the development server but does when putting the code to the live server. I've added the check function before the $controller-dispatch(); and no headers, but by the time it gets to the controller there are headers... Anyone got some other ideas? Thanks Terre
Re: [fw-general] help pls: headers being set, before preDispatch
This is a fine example of why we should leave off the closing ? on our PHP files! Terre Porter wrote: Ha That worked. There was a funky character at the end of one of my php includes... Not sure where it came from, but now that it's gone the pages are working again... Yay! Totally forgot about adding file and line number in that function... It's been a long day... Thank for the pointer it helped. Terre From: carlos koch [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 01, 2008 7:33 PM To: fw-general@lists.zend.com Subject: Re: [fw-general] help pls: headers being set, before preDispatch change headers_sent() to headers_sent ($filename, $linenum) and see where the output started. 2008/10/1 Terre Porter [EMAIL PROTECTED] Help... I'm having a bit of a pain with some surprise headers being set somewhere... I've put this in my controllers preDispatch function for testing.. Code if (headers_sent()) { $this-logger('-- preDispatch - headers sent'); logger(headers_list()); } Code The logger simply writes to a log file. In the log file I have.. Log [ 2008-10-01T18:42:26-04:00 ] [ 3.06 MB ] [ INFO ] : -- preDispatch - headers sent [ 2008-10-01T18:42:26-04:00 ] [ 3.07 MB ] [ INFO ] : array(5) { [0] = string(23) X-Powered-By: PHP/5.2.5 [1] = string(38) Expires: Thu, 19 Nov 1981 08:52:00 GMT [2] = string(77) Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [3] = string(16) Pragma: no-cache [4] = string(23) Content-type: text/html } Log My question is WHERE are they coming from... It's driving me nuts as this does not happen on the development server but does when putting the code to the live server. I've added the check function before the $controller-dispatch(); and no headers, but by the time it gets to the controller there are headers... Anyone got some other ideas? Thanks Terre
RE: [fw-general] help pls: headers being set, before preDispatch
I was thinking that myself... It's an old habbit of having the opening and closing ? ? Found another couple rogue spaces at the end of one of my controllers. I get to blame the add controller wizard in ZendNeon for creating those however. I'll just have to get in the habit of deleteing the ending ? Terre -Original Message- From: Jason Webster [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 01, 2008 10:10 PM To: Zend Framework - General Subject: Re: [fw-general] help pls: headers being set, before preDispatch This is a fine example of why we should leave off the closing ? on our PHP files! Terre Porter wrote: Ha That worked. There was a funky character at the end of one of my php includes... Not sure where it came from, but now that it's gone the pages are working again... Yay! Totally forgot about adding file and line number in that function... It's been a long day... Thank for the pointer it helped. Terre From: carlos koch [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 01, 2008 7:33 PM To: fw-general@lists.zend.com Subject: Re: [fw-general] help pls: headers being set, before preDispatch change headers_sent() to headers_sent ($filename, $linenum) and see where the output started. 2008/10/1 Terre Porter [EMAIL PROTECTED] Help... I'm having a bit of a pain with some surprise headers being set somewhere... I've put this in my controllers preDispatch function for testing.. Code if (headers_sent()) { $this-logger('-- preDispatch - headers sent'); logger(headers_list()); } Code The logger simply writes to a log file. In the log file I have.. Log [ 2008-10-01T18:42:26-04:00 ] [ 3.06 MB ] [ INFO ] : -- preDispatch - headers sent [ 2008-10-01T18:42:26-04:00 ] [ 3.07 MB ] [ INFO ] : array(5) { [0] = string(23) X-Powered-By: PHP/5.2.5 [1] = string(38) Expires: Thu, 19 Nov 1981 08:52:00 GMT [2] = string(77) Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [3] = string(16) Pragma: no-cache [4] = string(23) Content-type: text/html } Log My question is WHERE are they coming from... It's driving me nuts as this does not happen on the development server but does when putting the code to the live server. I've added the check function before the $controller-dispatch(); and no headers, but by the time it gets to the controller there are headers... Anyone got some other ideas? Thanks Terre
[fw-general] Newbie Question on Directory Structure
Hi am trying to get some clarification on directory structures. Here is what I have: Running WAMP Server 2.0 Have created an alias to my application. Url for my app is: http://localhost/myApp folder structure myApp -application -controllers -IndexController -ErrorController -AnotherController when I go to http://localhost/myApp/index I can render the default indexAction just fine. In addition I can also access other actions in my IndexController (see example) http://localhost/myApp/index http://localhost/myApp/index/sample1 http://localhost/myApp/index/sample2 Where I am having trouble is when I try to navigate to: http://localhost/myApp/another/ Not sure what I am doing wrong. M -- View this message in context: http://www.nabble.com/Newbie-Question-on-Directory-Structure-tp19773782p19773782.html Sent from the Zend Framework mailing list archive at Nabble.com.