Re: the white screen of death
From previous experience the main cause for this is when debug_backtrace() is called, in the global debug() declaration (basics.php:114). It chokes with undefined variables (in some installations, such MAMP, this is a pain) and sometimes with very deep associative arrays. This message is not too helpful since I have no idea how to solve this, other than using var_dump() or print_r() in WSOD situations. On Nov 6, 8:28 pm, Pedro Nascimento pnascime...@gmail.com wrote: I got one after copying some config options on files as database.php, core.php and app_controller.php using wrong symbols such as ` instead of '. It's a stupid mistake, but I have done it once or twice already. : On Fri, Nov 6, 2009 at 20:08, Tonu Tusk lvot...@googlemail.com wrote: OK, I doubt this will be of too much help, but the main causes of WSOD I have encountered have been models not being declared in a controllers $uses var (where a controller is using other than its standard related model) OR some bad relationships declared in model classes (I am still a bit unsure of it all, but if i had model A hasOne modelB and modelB belongs to modelA, that really seems to bomb things out for me even though it seems quite intuitive to do so) Oh yeah, and on one of my other recent posts I was getting random WSOD which turned out to be mod_security installed on my shared host which did not seem to like the combination of either large or a large number of input in post data in combination with being routed through mod_rewrite. Go figure. Has anyone else got any d'oh obvious and common errors which have led to WSOD to share? On Nov 6, 9:04 pm, gimperdan...@gmail.com gimperdan...@gmail.com wrote: Yep, I already do debug($variable), but when code gets long, it can get pretty frustrating to test everything. Not to mention that if I get the white screen than I can't see anything including debug(var). My debug option is set to 3. Which is the max, but it doesn't change anything. On Nov 6, 3:14 pm, Céryl c.a.h.wilt...@student.tue.nl wrote: In addition, if the debug level is 2 you can add debug($variable) (Either in controller or view) to your code to check that var... So you can see if it's an improperly set variable that causes you to white-out... On 6 nov, 21:00, jacmoe jac...@mail.dk wrote: Open app/config/core.php and set the debug level to 1 or 2. :) On Nov 6, 4:16 pm, gimperdan...@gmail.com gimperdan...@gmail.com wrote: More often that I would like to I get the white screen of death, which tells me something is wrong with my cold. Is there a way to get printed errors? instead of the white screen? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
E-mail component rendering a template fails with no error message
Hi there, Summary: when using EmailComponent I bump into a strange problem in the View class. Using CakePHP 1.3.0.0. I'm using EmailComponent in a very standard way. In my controller I have: $this-Email-to = 's...@email.com'; $this-Email-from = 'some.ot...@email.com'; $this-Email-subject = 'Message Subject'; $this-Email-template = 'template_name'; // under views/elements/ email/text/template_name.ctp $this-Email-sendAs = 'text' ; $this-Email-send(); The template exists and is just plain text, no special characters. This leads to a blank page, regardless of the E_ALL error reporting level. So I go down into the Email component class, adding die(here) calls and find out it fails on line 461: $content = explode(\n, str_replace(array(\r\n, \r), \n, $View- renderLayout($content))); Now I go to $View-renderLayout() and add the same die(here) calls there, and realize the problem is actually happening right before line 747, which is odd, because it's just: return $out; The thing is that if I do debug($out) right before 747, it outputs the message perfectly, but in the normal flow of the class, it just breaks and returns me a blank screen after some 5 seconds hanging, with no error neither on the screen or the logs. I tried everything and have absolutely no idea what to do from here. I fiddled with all the parameters, renamed the template, changed it's content, nothing works. It only works when I remove the $this-Email- template line and do like $this-Email-send('any text), but that's no good, obviously. One more curious thing: if above view.php:498 I add debug($data_for_layout); it fails in the exact same way (the request hangs for some 5 seconds and returns blank), but if I try pr($data_for_layout); it prints it's contents perfectly. Just thought this could be useful. Thank you so much for your attention, Bruno PS: I searched thoroughly for this both here and on Google, with no luck, so please forgive me if it's been answered already. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: E-mail component rendering a template fails with no error message
Hey Brian, Thanks for answering. die($content) returns the message, in pristine condition : ) die($View-layoutPath) returns the correct path, email/text die($View-renderLayout($content)) oddly returns: Fatal error: Call to a member function entity() on a non-object in (...)/cake/libs/view/helper.php on line 339 I'm not sure where to go from there. I can't find any calls to this method anywere in either the EmailComponent or the View class. And I checked the debug level in that line, it'ss 2. Going deeper, it's as if the debug_backtrace() call in debug() goes into infinite recursion or something, so PHP just gives up and returns nothing. Thanks again, Bruno On Oct 9, 1:18 pm, brian bally.z...@gmail.com wrote: On Fri, Oct 9, 2009 at 1:02 AM, Bruno Bergher bruno.berg...@gmail.com wrote: Hi there, Summary: when using EmailComponent I bump into a strange problem in the View class. Using CakePHP 1.3.0.0. I'm using EmailComponent in a very standard way. In my controller I have: $this-Email-to = 's...@email.com'; $this-Email-from = 'some.ot...@email.com'; $this-Email-subject = 'Message Subject'; $this-Email-template = 'template_name'; // under views/elements/ email/text/template_name.ctp $this-Email-sendAs = 'text' ; $this-Email-send(); The template exists and is just plain text, no special characters. This leads to a blank page, regardless of the E_ALL error reporting level. So I go down into the Email component class, adding die(here) calls and find out it fails on line 461: $content = explode(\n, str_replace(array(\r\n, \r), \n, $View- renderLayout($content))); Now I go to $View-renderLayout() and add the same die(here) calls there, and realize the problem is actually happening right before line 747, which is odd, because it's just: return $out; So renderLayout() is probably fine. If you add: die($View-renderLayout($content)); just before line 461 in the component, what do you get? Other things to check around that line: $content -- before the explode() call $View-layoutPath The thing is that if I do debug($out) right before 747, it outputs the message perfectly, but in the normal flow of the class, it just breaks and returns me a blank screen after some 5 seconds hanging, with no error neither on the screen or the logs. I tried everything and have absolutely no idea what to do from here. I fiddled with all the parameters, renamed the template, changed it's content, nothing works. It only works when I remove the $this-Email- template line and do like $this-Email-send('any text), but that's no good, obviously. One more curious thing: if above view.php:498 I add debug($data_for_layout); it fails in the exact same way (the request hangs for some 5 seconds and returns blank), but if I try pr($data_for_layout); it prints it's contents perfectly. Just thought this could be useful. That's likely just because debug has been set to 0 before that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple Inserts without a loop
Inserting 100 records all at once will always be better regarding data consistency. If something wrong happens with the DB server between two calls, how you you tell the application where to pick up next? By inserting them all at one (usgin Model::saveAll()) with the 'atomic' property set to the default of 'true' you won't have to worry about this. And the performance will certainly be much better, specially if the DB and Web servers are two different machines, perhaps in different locations. Best, Bruno On 21 ago, 08:22, RichardAtHome [EMAIL PROTECTED] wrote: I think the 1000 was for illustration only. I'd run a few quick benchmarks to see what the real difference between 1insertwith 1000 values() and 1000 queries would be. I'm betting it wont be much... On Aug 20, 11:04 pm, teknoid [EMAIL PROTECTED] wrote: AFAIK, the syntax you are proposing is MySQL (or at least DB vendor) specific. So, it won't be supported by cake. And do you reallyinsert1001 rows? On Aug 20, 5:51 pm, seth [EMAIL PROTECTED] wrote: Right, but how many inserts does this perform? - As many inserts as required Yes, but my whole point is that if you are inserting 1000 questions, this could be done in 2 interests or 1001... Is cake currently smart enough to do it in 2? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect to original page
REFERRER? On Mar 3, 7:41 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote: AuthComponent in 1.2 does it storing the original location in the session. You can use the AuthComponent or implement something like that on your own. On Mon, Mar 3, 2008 at 6:53 AM, bob [EMAIL PROTECTED] wrote: Should i use a session to save the original link? Or is there another better way to do this? On Mon, Mar 3, 2008 at 12:44 AM, bob [EMAIL PROTECTED] wrote: If I click on a link in my view, it redirects to the login page (i check if logged in via beforeFilter() in the controller). After i login, i want to redirect to the page that I clicked on, not another page. how do i do this in cakephp 1.2? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Plugin extension in Controller | Customizing app modules
Okay, this might sound a bit crazy at first, but there's real reasons for doing this. We're a design firm that developed a CMS to handle the advanced layout requirement of our projects. The main thing is being able to build pages which content fields change in name, amount and type. And that's really working fine. The problem is that the rest of the app services (blog, news, product) need to change from project to project. I mean: for a client's website, having a blog post with title and body fields is enough, but another one might need a summary and two picture fields added to that. What we've being doing to address this requirement is to start a new project with a basic deploy, common to all projects, and change the DB tables, models and controllers to fit the need of the client. The problem is that it starts to become hard to merge back the improvements we make in one project to the trunk, and then to use it in another project, because they can be specific and dependent of certain fields. So we discussed and came up with the idea of encapsulating the functionality of each feature in plugins, such as blog, news, catalog, each with their own models, controllers and basic views, so we could then extend those base classes into the functionality that is specific to the project. Objectively put: - There's the BaseBlogPostsController which has all the functionality we need. - There's the BlogPostsController, which works the same way, but needs three new methods and to change one of the base methods. That's simple, isn't it? Basic OOP: just make class BlogPostsController extends BaseBlogPostsController! (This last one in the inheritance chain extends AppController) Not quite so. I wrote a class and defined a workflow that enables the app classes to actually extend the base classes, through a singleton a series of App:import() calls. But there's one problem I just can't figure out, and here I hope you can help: Cake only looks for the view for an action in the app/views/ controller folder, even if I added the plugin view folder to the $viewPaths array in bootstrap.php. I tried in BlogPostsController function index() { $this-autoRender = false; parent::index(); } but the view that Cake looks for is in the App folder. And setAction() only accepts a string parameter, so I can't refer to another class. Does anyone has any idea? I hope I was able to explain the problem properly. If not, PLEASE tell me so and I'll try another way. Thanks a lot! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Default Admin Routing for Forms in 1.2 Pre Beta
Thanks a lot, people. I'll get to it on Monday and comment on the solution. On Nov 30, 2:34 am, Kalileo [EMAIL PROTECTED] wrote: I have suffered the same problems, but fear not, they are solved: There have been a few bugs which are all been fixed in the meantime. These fixes are already in the svn. Not in trunk though, but in branches. Take that and it will work again. If you have a modern OS, such as Linux, do something like svn cohttps://svn.cakephp.org/repo/branches/1.2.x.x cakephp_svn_branches or better svn exporthttps://svn.cakephp.org/repo/branches/1.2.x.x cakephp_svn_branches and it will download the latest svn branches code for you to the subdirectory cakephp_svn_branches Alternatively you could search trac for the bugfixes concerning admin routing and implement them yourself HTH Kalileo Bruno Bergher wrote: Hi everyone! We just moved an application we developed in 1.2.0.5427 alpha to the latest pre beta release. Everything worked fine except for just one thing: In admin 'edit' actions, FormHelper is being supplied with wrong action URLs. With index, view, add and deletr actions, there's absolutely no problem. With 'edit' actions, the form is created without our admin path in the URL. Out 'Routing.admin' configuration is set to 'publisher'. For example: When accessing through the browser URL '/publisher/posts/add', the form action is properly set to '/publisher/posts/add'. When accessing through the browser URL '/publisher/posts/edit/4', the form action is set to '/posts/edit/4', missing the admin portion of it. What I have found out so far: In router.php, line 676, if I replace $url[$admin] = true; with $url['admin'] = true; it works, while appending 'admin:1' to the URL. This is not great news, but might help. If I change my 'Routing.admin' setting to 'admin' (and rename the controller action and view filename to admin_), it also works. I believe the problem probably lies in Router::url(), line 700. The 'add' action sets $match to true, but the 'edit' action, for reason, does not. I havo also tried adding a mock id to the url (/publisher/posts/add/4) to see if it helps, but with no success. We've been struggling with this for while, and any help would be greatly appreciated. Thanks in advance! Best, Bruno --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Default Admin Routing for Forms in 1.2 Pre Beta
Hi everyone! We just moved an application we developed in 1.2.0.5427 alpha to the latest pre beta release. Everything worked fine except for just one thing: In admin 'edit' actions, FormHelper is being supplied with wrong action URLs. With index, view, add and deletr actions, there's absolutely no problem. With 'edit' actions, the form is created without our admin path in the URL. Out 'Routing.admin' configuration is set to 'publisher'. For example: When accessing through the browser URL '/publisher/posts/add', the form action is properly set to '/publisher/posts/add'. When accessing through the browser URL '/publisher/posts/edit/4', the form action is set to '/posts/edit/4', missing the admin portion of it. What I have found out so far: In router.php, line 676, if I replace $url[$admin] = true; with $url['admin'] = true; it works, while appending 'admin:1' to the URL. This is not great news, but might help. If I change my 'Routing.admin' setting to 'admin' (and rename the controller action and view filename to admin_), it also works. I believe the problem probably lies in Router::url(), line 700. The 'add' action sets $match to true, but the 'edit' action, for reason, does not. I havo also tried adding a mock id to the url (/publisher/posts/add/4) to see if it helps, but with no success. We've been struggling with this for while, and any help would be greatly appreciated. Thanks in advance! Best, Bruno --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---