paginator helper - link in a tag
how to apply a class to the link contained in the wrapping tag? previously mentioned at https://groups.google.com/d/topic/cake-php/IulU5bF-nzQ/discussion using cakephp 2.0 thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Using multiple domains on one app to create four seperate sites
You can use apache's namevirtualhost directive plus server aliases to point all the domains to the same web root. After that all you have to do is inspect the hostname in the $SERVER super global and use that to switch the app's theme (this gives you the flexibility to have domain specific layouts, views and elements) or just switch the layout. A good place to deal with this is the beforefilter callback. On Oct 1, 2010, at 9:26 AM, Jacob jacobsteri...@gmail.com wrote: Hello all, I am working on a website for a company, which needs five different websites. The five websites use the same database and mostly the same records. For site specific records there is a 'company' column in the table. With a parameter a function will know what records to get. The current setup exists of one app on the webroot en 4 others in a sub directory. This was the easiest way to solve the problem, but it has a down site. As the development is in a final stage, the controllers and views are modified a lot. For every change the other four apps need to be changed also. My question is: Is there a way to create the illusion of five different websites while it is actually one app? For example, based on the domainname used, the layout changes? (that would be the best solution I think) But is it possible en how should this be done? Best regards, Jacob Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Xampp Lite and CakePHP error
Just configure the propper timezone in php.ini date.timezone setting: http://www.php.net/manual/en/datetime.configuration.php date.timezone = America/Sao_Paulo On Mon, Mar 15, 2010 at 12:59 PM, Celso cels...@gmail.com wrote: I am migrating my cakephp app from USBwebserver to xampplite and i getting this error: Error: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for '-3.0/no DST' instead [CORE\cake\libs\cache.php, line 570] Anyone Help me? Thanks, Celso Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Subdomain Auth Problem
You also need to set the realm of the session cookie to your domain (it defaults to the hostname) and set the security level of the security component below 2 On 3/8/10, Kyle Decot kdec...@gmail.com wrote: Well my sessions.save is set to database in my core.php file. Also, I did $session-read() on my www page and I get all of my auth info, however if I do the same thing on, blog.mysite.com then auth is now empty. Any ideas on next steps to take towards solving this? Thanks guy. On Mar 7, 8:36 pm, Nabil Alsharif bli...@gmail.com wrote: My first guess would be that you lost session data when you went to the subdomain. Maybe because the session cookies weren't sent with the requests going to the subdomain or maybe something else, I'm can't see whats happening on your servers The point is it's easy to check if the session was lost, that wold be the first thing I'd look at. Good luck. On Sun, 2010-03-07 at 15:25 -0800, Kyle Decot wrote: Yep. It's all one Cake App. Any ideas? On Mar 7, 11:43 am, cricket zijn.digi...@gmail.com wrote: A subdomain is usually a completely separate site. Do you already have the same Cake app serving all of your subdomains? On Mar 6, 5:34 pm, Kyle Decot kdec...@gmail.com wrote: I have a couple different subdomains on my site but I am having some problems w/ the Auth Component. I login fine under the standard www subdomain but then if I go to a different subdomain, then I am no longer logged in. How do I make sure that my Auth login persists across all of my subdomains? Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 -- Sent from my mobile device Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Subdomain Auth Problem
I have it in my beforeFilter callback in app_controller: $this-Cookie-domain = '.mydomain.tld'; Note that the '.' before your domain name is what tells the browser that the cookie is valid for *.mydomain.tld. On Mon, Mar 8, 2010 at 4:50 PM, Kyle Decot kdec...@gmail.com wrote: Where do I set the realm for the session cookie? The security level in my core.php file is set to low. On Mar 8, 6:47 am, Bernardo Vieira bvieira.li...@gmail.com wrote: You also need to set the realm of the session cookie to your domain (it defaults to the hostname) and set the security level of the security component below 2 On 3/8/10, Kyle Decot kdec...@gmail.com wrote: Well my sessions.save is set to database in my core.php file. Also, I did $session-read() on my www page and I get all of my auth info, however if I do the same thing on, blog.mysite.com then auth is now empty. Any ideas on next steps to take towards solving this? Thanks guy. On Mar 7, 8:36 pm, Nabil Alsharif bli...@gmail.com wrote: My first guess would be that you lost session data when you went to the subdomain. Maybe because the session cookies weren't sent with the requests going to the subdomain or maybe something else, I'm can't see whats happening on your servers The point is it's easy to check if the session was lost, that wold be the first thing I'd look at. Good luck. On Sun, 2010-03-07 at 15:25 -0800, Kyle Decot wrote: Yep. It's all one Cake App. Any ideas? On Mar 7, 11:43 am, cricket zijn.digi...@gmail.com wrote: A subdomain is usually a completely separate site. Do you already have the same Cake app serving all of your subdomains? On Mar 6, 5:34 pm, Kyle Decot kdec...@gmail.com wrote: I have a couple different subdomains on my site but I am having some problems w/ the Auth Component. I login fine under the standard www subdomain but then if I go to a different subdomain, then I am no longer logged in. How do I make sure that my Auth login persists across all of my subdomains? Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Sent from my mobile device Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Guide on creating first application
What's your model name for the utilizadores table? My guess is CakePhp's inflector is not dealing very well with the portuguese plural rules Utilizador - Utilizadores. You could get the portuguese inflections maintened by the portuguese/brazilian cakephp community http://groups.google.com/group/cake-php-pt On Thu, Dec 10, 2009 at 10:50 AM, Délsio Cabá del...@gmail.com wrote: Hi all, I am about to create my first application with cakephp. Actuallly I'm an experienced php programmer. I already went to the guide on creating the blog application. Find attached my database structure. As you can see I have many relationships. I tried through the console creating the forms, but for some reason I can't get them to work, I get this error when I try to add a new record: *Notice* (8): Undefined property: Utilizadore::$Utilizadorescategoria [*APP/controllers/utilizadores_controller.php*, line *51*] Code | Context $this-data = $this-Utilizadore-read(null, $id); } $utilizadorescategorias = $this-Utilizadore-Utilizadorescategoria-find('list'); $id = 1 UtilizadoresController::edit() - APP/controllers/utilizadores_controller.php, line 51 Object::dispatchMethod() - CORE/cake/libs/object.php, line 125 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 240 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 206 [main] - APP/webroot/index.php, line 83 *Fatal error*: Call to a member function find() on a non-object in * /home/webmasters/domains/sioas/public_html/app/controllers/utilizadores_controller.php * on line *51* All I need to now is to have forms to fill all those tables. Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Find from multiple similar tables
I don't think there is a very cakeish way to do this, of course you could use a UNION statement in your sql query but then you wouldn't get any of the benefits from the ORM. On Thu, Oct 29, 2009 at 5:23 PM, ge...@dinnerbooking.com ge...@dinnerbooking.com wrote: I have two tables: houses houses_stat The two tables are the same but old data from houses are moved to houses_stat by a cron job. Now I want to find all houses in both tables where price equals 1000 A find in one table would be: $houses-find(all, array(conditions = array(price = 1000))); but how do I lookup data in both tables in one find? How do I do that? Do I need to use some kind of bindModel or? --~--~-~--~~~---~--~~ 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: Fulltext and Order By
You have to include a the fields array in your query, and add a new field for the score column. The only drawback is that once you supply a fields array to your query cake no longer builds it for you automatically, so, in order to achieve the SELECT * effect you'd have to include all the fields from your movie table. Naturaly you can do this looping the Model:;_schema hash. Here's a method I use (place it in your model): function fulltextsearch($query) { $fields = array(); $conditions = MATCH(Movie.movie_name) AGAINST('$query'); foreach (array_keys($this-_schema) as $field) { $fields[] = sprintf(%s.%s,$this-alias,$field); } $fields[] = sprintf(%s AS score,$conditions); $order = array('score DESC','Movie.year DESC'); return $this-find('all', compact($fields,$conditions,$order)); } On Fri, Aug 21, 2009 at 9:36 AM, Shaun sbef...@gmail.com wrote: I would like to edit the following MySQL statement to use CakePHP conventions: SELECT *, MATCH(movie_title) AGAINST('$keywords') AS score FROM movies WHERE MATCH(movie_title) AGAINST('$keywords') ORDER BY score DESC, movie_year DESC The idea is to order the movies by search relevancy, but when there is a Hollywood remake of an old movie (same title, same relevancy), the newer movie should appear above the older movie, sorted by movie_year DESC. I have a model called Movie. As of now, the database is being queried like this: $conditions = array(MATCH(Movie.movie_name) AGAINST('$keywords')); $matches = $this-Movie-find('all', array('conditions' = $conditions)); $this-set('movies', $matches); The results are ordered by the fulltext relevancy, but how can I order by both fulltext relevancy and movie year? I'm not sure how to assign the fulltext results to a fake field called score. Thanks. --~--~-~--~~~---~--~~ 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: views management
Theming you app is a piece of cake ;). All you have to do is set a couple of controller fields: class MyController extends AppController { var $view = 'Theme'; var $theme = 'mytheme'; } then in your views and webroot directories you´d create: views\ themed\ mytheme\ layouts\ elements\ any_other_views_you_want_to_override\ (...)\ webroot\ themed\ mytheme\ css\ js\ img\ (...)\ Then as long as you stick to using cake helpers for css, images, javascript and so on the framework is smart enough to look for whatever asset you require in the correponding theme directory and move up the tree into the base directory if it's not found. This is quite handy as it allows you to customize only the necessary bits for your new themes. You can also employ some theme switching code in one of AppControllers callbacks to allow for user selectable themes or configuration based themes. As for maintining admin views in separete folders, I can't recall any way of doing it, but then again I've never needed this type of functionality. You could probably manage to do it setting the $viewPath field in the controller but I haven't tried it. Another thing you could do is create an admin theme and have something like this in your AppController: beforeFilter(0 { parent::beforeFilter(); if (isset($this-params[Configure::read('Routing.admin')]) $this-params[Configure::read('Routing.admin')]) { $this-view = 'Theme'; $this-theme = 'admin'; } } shahgeb wrote: Hy i am new to cakephp. I want to maintain different directories for admin view and client view, meanwhile i want to make themeable as well. any idea from seniors ??? thanks --~--~-~--~~~---~--~~ 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: When/how do you publish Bakery articles?
+1 Bert Van den Brande wrote: Since I also use EclipsePDT as my Cake dev environment I'm very interested in this article :) On Tue, Jul 14, 2009 at 4:02 PM, GravyFacegravyf...@gmail.com wrote: I wrote a tutorial on CakePHP + EclipsePDT autocomplete almost a month ago and it hasn't been published yet. If there's a submittal/workflow I'm not aware of, let me know. --~--~-~--~~~---~--~~ 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: Searching and filtering on id -- problem with form behavior (forms helper)
Hi, echo $form-input('Budget.id',array('type' = 'text')); Have you tried something like that? geste wrote: Hello! I have a table where the primary key, id is not autoincremented, but is in fact a 6-digit real value. I want to give people the ability to search and filter by ID and a few other fields like budget_name. I have implemented a filter component that I found (here: http://blog.uplevel.pl/index.php/2008/06/cakephp-12-filter-component/) and it all works well up to a point, but I am encountering problems with the way forms helper works by default. I'll give 2 examples: If I add the following form bits to my index view: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('id'); echo $form-input('budget_name'); echo $form-end('Search'); both inputs appear but neither are applied by the filter when I hit search. So I got the notion to qualify each input with the model name like so: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('Budget.id'); echo $form-input('Budget.budget_name'); echo $form-end('Search'); Now I get 1 input for budget_name and searching/filtering works, but the input for id no longer appears. I looked at the generated HTML and the input for id is made hidden (as in this example): !-- form id=BudgetsAddForm method=post action=/app/budgets/index fieldset style=display:none;input type=hidden name=_method value=POST //fieldset input type=hidden name=data[Budget][id] value= id=BudgetId / div class=input textlabel for=BudgetBudgetNameBudget Name/ label input name=data[Budget][budget_name] type=text maxlength=30 value= id=BudgetBudgetName //div div class=submitinput type=submit value=Search //div/ form -- So, am I right in assuming that forms helper handles id in this conventional way (make it hidden) and is there a way to override this without breaking general behavior of forms helper. I looked at the 1.2 Cookbook and I only found a hidden method, no unhidden method. Jim (apologies for my formatting. I wasn't sure how Google Groups handle in-line code snippets. Automagically, I think.) --~--~-~--~~~---~--~~ 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: When/how do you publish Bakery articles?
Cool... following that thread you pointed out I realized that I've done all that already following Mark Story's blog post [1]. I was really hoping for a better way to autocomplete models for controllers, have you made any progress in that area? As apps grow it becomes a real burden to keep updating thoes phpDoc blocks to get autocomplete to work. I think cake's dynamic loading of models doesn't really help in that area. Anyway, thanks for the link and I look forward to your article. [1] http://mark-story.com/posts/view/code-completion-for-cakephp-in-eclipse GravyFace wrote: Found it -- the original source (well, some of it) from the following convo a few years ago; this is what I based my Bakery article on (which I should edit it and give due credit): http://groups.google.com/group/cake-php/browse_thread/thread/04b94b593714b394/9c71e02157bcaacd Check out voidstate and schneimi's comments further down. On Wed, Jul 15, 2009 at 12:01 PM, Bernardo Vieirabvieira.li...@gmail.com wrote: +1 Bert Van den Brande wrote: Since I also use EclipsePDT as my Cake dev environment I'm very interested in this article :) On Tue, Jul 14, 2009 at 4:02 PM, GravyFacegravyf...@gmail.com wrote: I wrote a tutorial on CakePHP + EclipsePDT autocomplete almost a month ago and it hasn't been published yet. If there's a submittal/workflow I'm not aware of, let me know. --~--~-~--~~~---~--~~ 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: $javascript-link(main.js) doesn't work
Try *echo *$javascript-link('*main*'); sulong wrote: Hi, I am new to cakephp. I want to add a script/script tag to the head the page. I add the ?php echo $scripts_for_layout ? in the layout's head/head block, and ?php $javascript-link(main.js); ? in the view. But I can not see any script tag in the output html. Why? --~--~-~--~~~---~--~~ 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: Hard problem on a save operation
You should either check if $this-data is present before running the save operation or if you need to access results from the model before the save method you show use find instead of read. marco.rizze...@gmail.com wrote: Hi I have this situation. I use cake 1.2 stable. I have a save operation on a model. Now if I make a read operation on a model before the save operation I get that in the $this-data I have also data that come from the read operation. How can I avoid this situation? Many Thanks --~--~-~--~~~---~--~~ 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: containable and (left/inner) JOINS
Maybe that's the queue to develop a new 'Joinable' behavior based on the Containable behavior. Mark (Germany) wrote: i guess i did forget to mention that i already tried that but it gets totally ignored. and besides this fact, i would already be happy if it would do any (e.g. left) join instead of producing many thousand queries where it would be only one... do you have a simple approach to that one? with this trick conditions-array(Model1.id=Model2._model1_id) inside the containable arrays it does not work either (sql errors) On 19 Jan., 19:01, rtconner rtcon...@gmail.com wrote: I think you misunderstand what the containable does. Your complaint is with model bindings in general, and not with this behavior. In any case, I'll leave you to expiriment and learn, but I wanted to tell you, to do an inner join in cake you use the config.. 'type'='INNER' in your binding definition. --~--~-~--~~~---~--~~ 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: Defining website structure with CakePHP
Take a look at wildflower cms, it's a cakephp based cms that does that. Stuart wrote: I've been reading about the MVC approach, and am considering moving to cakePHP as I think it would speed up my development in the long term. One thing I can't quite fathom - how does one structure their website with CakePHP? Is the normal approach to store the page hierarchy as a Tree? (http:// book.cakephp.org/view/91/Tree) The website is a mixture of dynamic/static content, and ideally I'd like to store the static content in the database so it's editable, but then I wasn't sure how to handle when a page wasn't static... would the tree have to store a link to a separate PHP page with the dynamic code in? Any examples of how others have gone about this? Thanks for any responses. --~--~-~--~~~---~--~~ 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: Nicer way to make a link to show/hide elements?
If you just need to show / hide content you can do something like this: ?php echo $html-link('Show/Hide','#',array('id' = 'togglelink')); echo $javascript-event('togglelink','$(\'toggle_content\').toggle(); Event.stop(event);'); ? div id=toggle_content style=display: none pQuisque volutpat arcu et dolor? Vestibulum eu odio id neque laoreet tempus./p /div Nancy wrote: Hi Miles! I did look at $ajax-link, fooled around with it for what seemed like hours, and couldn't figure out how to have it just show/hide the div without specifying a url or link to some controller function/view. An example would be great if you've got the code in your fingertips. On Jan 18, 3:41 pm, Miles J mileswjohn...@gmail.com wrote: You dont have to use $html-link. Just write the anchor element manually. $html-link is usually used for internal linkings and routing. BUT you may take a look at $ajax-link. --~--~-~--~~~---~--~~ 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: XAMMP for Windows with cakePHP
mod_rewrite comes disabled in xampp by default, have you checked it? Edit c:\xampp\apache\conf\httpd.conf, uncomment to mod_rewrite line, restart apache and have fun. Sharmo wrote: I am not sure if my first post worked. I am therefore posting again. I am using XAMPP for Windows as my localhost server. When I try tho view my application after baking it. There is no CSS or images being renered. I have tred the forums at both XAMPP and PHPVideotutorials without success. Please help. Regards Peter --~--~-~--~~~---~--~~ 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: Insertar un archivo en la carpeta app del cake
try putting it in your app/webroot folder. garza2002 wrote: Buenas. Querria insertar un archivo html independiente del cake en la carpeta app del cake. El problema es que me da erro como de no conexion con la base de datos cuando intento acceder a el: por ej: localhost/cake/app/ prueba.htm. Es como si tuviese que darle permiso desde algun sitio del cake...como si estuviese capado la opcion de acceder a archivos independientes de cake. Sabeis si hay algun sitio q controle esto? Un saludo y gracias --~--~-~--~~~---~--~~ 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: How to trip error manually...
You can use Model::invalidate(); Johnathan Henderson wrote: Is there a way to activate and set the text of a $form-error outside a validation rule? I've got some complicated validation logic in the controller and I would like the error to show near the offending field instead of using setFlash. -John --~--~-~--~~~---~--~~ 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: Beginner: Cake PHP and XAMPP (windows)
Xampp comes with mod_rewrite disabled by default. Edit c:\xampp\apache\conf\httpd.conf, uncomment the LoadModule mod_rewrite line, restart apache and you should be good do go. Celso wrote: Hello! I am new in cakephp, I am with a proposal to replace the asp by php here in my work. Tentei http://www.sitepoint.com/article/application-development-cakephp/2/, but does not work in XAMPP ... Celso --~--~-~--~~~---~--~~ 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: A new discussion about controllers which extend another-controller-other-than-AppController
Just one question though, why can't you just use app_controller for this? Or better yet, for added flexibility, put whatever you need in a component and use it in the controllers where you need remoting capabilities. Graham Weldon wrote: Hey, Better than including php files, use the CakePHP App::import() and ClassRegistry::init() methods. These locate, include and in the case of the ClassRegistry, instantiate and return the object for you. You would in this case, do something like: App::import('Controller', 'RemotingController'); class RemotingUsersController extends RemotingController { /// implementation } Run a few tests with that, but its my understanding that this method should make the components available for the RemotingUsersController class. If not, ensuring that the __construct() passes back to the parent should ensure that the parent class is processed properly, but this should happen by default. Try the App::import() and let me know how you go with the components. Cheers, Graham On Thu, 15 Jan 2009 12:47:58 -0800 (PST), caminante running.ba...@gmail.com wrote: Being released 1.2 final version of CakePHP, I opened this discussion to try to bring some light together to this issue. My need: What's in the subject of this discussion; I have a couple of special controllers to be called from flash (through cakeswxphp). What I need is those controllers extending a RemotingController (with it's set of thingies for communication with flash) which in turn extends AppController. Sounded easy when I thought it, it's a common practice in OOP and I cannot see why it wouldn't be implemented in an OOP framework as CakePHP. Let's see: 1) class RemotingController extends AppController {} // dir: app/ or app/controllers/ 2) class RemotingUsersController extends RemotingController {} // dir: app/controllers/ When I make a request to an action in RemotingUsersController, Class 'RemotingController' not found, either putting it at app/ or app/ controllers/. Ok, CakePHP didn't noticed RemotingController class existed. There are a couple of (old or even antique) discussions on the subject: http://groups.google.com/group/cake-php/browse_thread/thread/83bad7a3498001c7 (from 2005) and a more recent one: http://groups.google.com/group/cake-php/browse_thread/thread/f3c62f08147fcfe9/ (from mid 2007) Neither seemed to found a (nice?) way to do this and according to dates, they were discussing on different stages in the evolution of the framework. I applied something said in the first one, suggesting the following: require_once('parent_controller.php'); class ChildController extends ParentController {} The requirement for the php file with my RemotingController class would work fine (though not being a pretty/frameworkian solution, but I can live with that). Now my class seems to be recognized by Cake but I have another problem: The components I declare for this class don't work (Call to a member function requestedWith() on a non-object, for example). Seems that leaving a little bit the CakePHP rigorous- mechanics/convention-over-configuration of Cake, there are some things that stop working automagically, such as automatic components initialization. My questions: How, then, can I initialize components? (and maybe why there's nothing in the book on this subject?) What can be the most practical and conventional way of doing what I need? Are others there that achieved good results with this? --~--~-~--~~~---~--~~ 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: Two alphaNumeric validation on model, but I get a preg_match error on line 187, [CORE/cake/libs/validation.php]
I stumbled upon this error once as well. As it turns out, some versions of php - most notably the stock centos php package - are compiled without the -enable-unicode-properties. Since the alphaNumeric rule uses preg_match with the /u you get this error. You have two options, either recompile php and its dependencies from source, or write your own regex without the u switch. See http://bugs.centos.org/view.php?id=3252 Gwoo wrote: try a different key name. 'alpha_numeric'=array( 'rule'='alphaNumeric', --~--~-~--~~~---~--~~ 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: Accessing a directory
Have you tried to put the livehelp folder inside your webroot folder? The stock .htaccess rules for the webroot folder are as follows: IfModule mod_rewrite.c RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] /IfModule That means it tries to find the file/script inside the webroot folder before rewriting the url to cake's index script. Unite wrote: I have tried IfModule mod_rewrite.c RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/livehelp/(.*)$ RewriteRule ^.*$ - [L] /IfModule IfModule mod_rewrite.c RewriteEngine on RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] /IfModule but this didnt work either. any suggestions? On Jan 12, 4:07 pm, Unite wavors...@gmail.com wrote: IfModule mod_rewrite.c RewriteEngine on RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] /IfModule thats my .htaccess. so how would I do it? Dont know much about .htaccess. Thanks On Jan 12, 4:00 pm, Kappa andrea.cappalu...@gmail.com wrote: Why not configuring properly the .htaccess ? put a rule before the cake routing, in that way it will not be remapped in /app/webroot Bye, Andrea On Jan 12, 2:33 pm, Unite wavors...@gmail.com wrote: On my servers WWW directory I have cakephp installed and it works. My problem is I want to now add a comercial product to my site that gets accessed usingwww.mydomain.com/livehelp(livehelpisthe commercial package). How or where would I put the livehelp folder so it has the affect ofwww.mydomain.com/livehelp. As far as cakephp goes i know its trying to interpret /livehelp as a controller. So where do i put live help so I can have the desired effect. thanks. --~--~-~--~~~---~--~~ 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: Simple String Manipulations?
Best place to handle this is in your model's beforeSave() callback: http://book.cakephp.org/view/683/beforeSave ingenious paradox wrote: I'm very new to cake and I was hoping someone could demonstrate the code necessary to take a form field input value and convert it to uppercase. I know this is simple with the ucwords() function, but for some reason I just can't get it to work properly. I read that you have to perform your own methods before cakes execution of built in functions so I tried the beforeFilter() and no luck. Some where in referencing the correct variable, converting it, and then passing it back to the array that cake creates I'm screwing things up. I simply want to take a word and capitalize it before it gets stored in my database. this-($confused); --~--~-~--~~~---~--~~ 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: Preferred Modal Library?
I've been using livepipe controls (http://livepipe.net/control/window) for prototype since I've haven't taken the leap into jQuery or Mootools yet (shame on me). It works pretty well for modals, inline popups, hoverboxes, lightboxes etc. WebbedIT wrote: Just after a general opinion of what is the best Modal js library to use with Cake? I have been looking at LightWindow but it seems to have a lack of support and doesn't work when passing URLs to it without a file extension. I am now investigating ModalBox but just wondered what you guys were using? Or do you create your own Modals? --~--~-~--~~~---~--~~ 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: Any built in way to do lazy deletes?
Try the delatable behavior. Not built in, but close. http://bakery.cakephp.org/articles/view/soft-delete-behavior Arthur Pemberton wrote: Lazy deletes being setting a field appropriately so that the row is 'deleted' but still in the database. --~--~-~--~~~---~--~~ 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: id as primary db key
You can set Model::primaryKey to whatever field you need ;) steveh wrote: Folks, I'm a bit new to CakePHP (Java guy from the way back time)and all was going well and I have been very happy with the framework until I am trying to simply html-link a column record in a table to a view. Pretty basic stuff and I have done it a dozen times, with test dbs that have always had an index key of id. The problem is, my new db has a primary key index called refindKey not id. In the Cake PHP docs and a books I have looked at it appears that Cake is enamored with id as an index. I don't exactly control the db (it's generated by a Kapow robot). All works correctly until the sql fires and it wants to append .id to the query string. Here is an extract from the tail of the query error dump. Nowhere in the code do I mention id for anything so Cake id auto-assuming something. .WHERE `Zldinput`.`id` = '035c2e44642d08032236ec49460b5bc556d19c8' All of this is pretty standard stuff exept refindKey has replaced id zldinputsController.php ... function view($refindkey = null) { $this-Zldinput-refindkey = $refindkey; $this-set('zldinput', $this-Zldinput-read()); } and a index.ctp with the html-link . ?php echo $html-link($zldinput['Zldinput']['refindKey'],/zldinputs/ view/.$zldinput['Zldinput']['refindKey']); ? /td .. The view action provides the correct URL whe the table element is selected so the correct parameter is passed. http://localhost/zipleads/zldinputs/view/01d30e978211a2564f85a9615adb8f018d34847 where the big hairy integer is the refindKey Am I missing something very basic here. How do I get around the id db key issue. I can't believe that Cake would have a mandatory requirement of a index named id per what I have read. Any help and pointers to the deeper inner workings would be greatly appreciated. Cheers, Steve --~--~-~--~~~---~--~~ 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: List users who are logged in
AFAIK you'd need to create custom login and logout actions in your users controller to keep a list of logged in users. jmmg77 wrote: Hi, I'm using Cake 1.2 RC3 and the Auth component. Is there a way to simply list the user accounts that are logged in. Or, is there a way to check if a particular userid is logged in? I know I can use $session-check('Auth.User.id') or $this-Auth-User ('id') to check if the current user is logged in, but this is not what I need here. Thanks. --~--~-~--~~~---~--~~ 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: How to change default mailer Email component link
It's not advisable to change code directly in cake's core files. Cake is designed in a way that pretty much everything is customizable on a per application basis. Furthermore the xMailer property is not actually visible in the email body, it only appears in the email's headers which are normally tucked away in most email clients so you shouldn't have to worry about that. To adjust your email layouts you should edit app/views/layouts/email/html/default.ctp and app/views/layouts/email/text/default.ctp. xeroxss wrote: Hi!, I'm new to Cake PHP and i'm trying to change the link in the email being sent by the cake php framework. I change the definition in the following line of the email.php in the /cake/libs/controller/components/email.php but I'm still seeing the same message even if I deleted my cache. Is there additional files where I need to change it. Thanks! EmailComponent::$xMailer = 'CakePHP Email Component' Definition at line 192 of file email.php. --~--~-~--~~~---~--~~ 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: New Install Does Not Show Graphics
The actual path to .so files varies in the various linux distros. Scan through your httpd.conf and look for the extensions/modules path and see if mod_rewrite.so exists in that path (from the directory listing you provided I'm guessing /usr/local/apache2/modules). reidster wrote: Thanks for the reply. My httpd.conf does not have mod_rewrite enabled. I checked the doc in the aforementioned url, but could not locate the .so file. This does not exist in my apache install. Do I need to re-configure apache? libexec/httpd/mod_rewrite.so [r...@localhost apache2]# ls bin build cgi-bin conf error htdocs icons include lib logs man manual modules [r...@localhost apache2]# pwd /usr/local/apache2 On Jan 4, 5:29 pm, Steven Wright rhythmicde...@gmail.com wrote: Do you have mod_rewrite enabled on your apache server? http://book.cakephp.org/view/333/A-Note-on-mod_rewrite -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of reidster Sent: Sunday, January 04, 2009 4:24 PM To: CakePHP Subject: New Install Does Not Show Graphics I am new to CakePHP. I have downloaded version 1.2.0.7962, renamed the cake directory and moved it to the root of the apache directory (htdocs). When I navigate to the cake php website for this directory. I receive a listing of all the files in this directory. I do not see the expected cake graphics. Any ideas as to what is wrong? Configuration: PHP Version 5.2.8 Apache/2.2.11 Linux 2.6.18-92.1.22.el5 #1 (CentOS 5.2) Apache and PHP are working. I can get to webpages on this host. Thanks for your input. -Reid --~--~-~--~~~---~--~~ 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: Using the named parameters
Slightly (but not by a big margin) shorter version: $var = ife($this-params['named']['var'],$this-params['named']['var']); gearvOsh wrote: Is this the only way to access named parameters without throwing a notice? $var = (isset($this-params['named']['var'])) ? $this-params['named'] ['var'] : ''; Is there some sort of function to get named params that im overlooking? --~--~-~--~~~---~--~~ 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: How to change default mailer Email component link
xeroxss, That is coming from the email layout, which can be found at app/views/layouts/email/(html|text)/default.ctp. Here's what the stock html/default.ctp looks like: !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01//EN html head title?php echo $title_for_layout;?/title /head body ?php echo $content_for_layout;? pThis email was sent using the a href=http://cakephp.org;CakePHP Framework/a/p /body /html Remove or replace the link and you're good to go. The xmailer property on the other hand will show up in the header: To: u...@example.com From: ser...@example.com Reply-To: ser...@example.com Subject: The subject X-Mailer: CakePHP Email Component Content-Type: multipart/alternative; boundary=alt- Message-Id: 20081222063357.470f52150...@server.example.com Date: Mon, 22 Dec 2008 02:03:57 -0430 (VET) Content-Transfer-Encoding: 7bit xeroxss wrote: Hi Bernardo, thanks for the reply maybe in other versions the xmailer property is tucked away. but this time it's showing on the email body. and not on the header. Below is what I get from the mailer. I'm using the latest version of cake. Hi xeroxss, Thank you for signing up in our service. To complete the sign up process please click on the link below: Confirm your account This email was sent using the CakePHP Framework This is what is inside my confirmation.ctp under the /app/views/ elements/email/html/ Hi ?php e($name); ?,br / Thank you for signing up in our service. To complete the sign up process please click on the link below:br / a href=http://?php e($server_name) ??php e($html-url(array ('controller' = 'users', 'action' = 'confirm'))) ?/?php e($id) ?/ ?php e($code) ?Confirm your account/a Any other ideas? On Jan 5, 11:34 pm, Bernardo Vieira bvieira.li...@gmail.com wrote: It's not advisable to change code directly in cake's core files. Cake is designed in a way that pretty much everything is customizable on a per application basis. Furthermore the xMailer property is not actually visible in the email body, it only appears in the email's headers which are normally tucked away in most email clients so you shouldn't have to worry about that. To adjust your email layouts you should edit app/views/layouts/email/html/default.ctp and app/views/layouts/email/text/default.ctp. xeroxss wrote: Hi!, I'm new to Cake PHP and i'm trying to change the link in the email being sent by the cake php framework. I change the definition in the following line of the email.php in the /cake/libs/controller/components/email.php but I'm still seeing the same message even if I deleted my cache. Is there additional files where I need to change it. Thanks! EmailComponent::$xMailer = 'CakePHP Email Component' Definition at line 192 of file email.php. --~--~-~--~~~---~--~~ 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: How to change default mailer Email component link
xeroxss, That is coming from the email layout, which can be found at app/views/layouts/email/(html|text)/default.ctp. Here's what the stock html/default.ctp looks like: !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01//EN html head title?php echo $title_for_layout;?/title /head body ?php echo $content_for_layout;? pThis email was sent using the a href=http://cakephp.org;CakePHP Framework/a/p /body /html Remove or replace the link and you're good to go. The xmailer property on the other hand will show up in the header: To: u...@example.com From: ser...@example.com Reply-To: ser...@example.com Subject: The subject X-Mailer: CakePHP Email Component Content-Type: multipart/alternative; boundary=alt- Message-Id: 20081222063357.470f52150...@server.example.com Date: Mon, 22 Dec 2008 02:03:57 -0430 (VET) Content-Transfer-Encoding: 7bit xeroxss wrote: Hi Bernardo, thanks for the reply maybe in other versions the xmailer property is tucked away. but this time it's showing on the email body. and not on the header. Below is what I get from the mailer. I'm using the latest version of cake. Hi xeroxss, Thank you for signing up in our service. To complete the sign up process please click on the link below: Confirm your account This email was sent using the CakePHP Framework This is what is inside my confirmation.ctp under the /app/views/ elements/email/html/ Hi ?php e($name); ?,br / Thank you for signing up in our service. To complete the sign up process please click on the link below:br / a href=http://?php e($server_name) ??php e($html-url(array ('controller' = 'users', 'action' = 'confirm'))) ?/?php e($id) ?/ ?php e($code) ?Confirm your account/a Any other ideas? On Jan 5, 11:34 pm, Bernardo Vieira bvieira.li...@gmail.com wrote: It's not advisable to change code directly in cake's core files. Cake is designed in a way that pretty much everything is customizable on a per application basis. Furthermore the xMailer property is not actually visible in the email body, it only appears in the email's headers which are normally tucked away in most email clients so you shouldn't have to worry about that. To adjust your email layouts you should edit app/views/layouts/email/html/default.ctp and app/views/layouts/email/text/default.ctp. xeroxss wrote: Hi!, I'm new to Cake PHP and i'm trying to change the link in the email being sent by the cake php framework. I change the definition in the following line of the email.php in the /cake/libs/controller/components/email.php but I'm still seeing the same message even if I deleted my cache. Is there additional files where I need to change it. Thanks! EmailComponent::$xMailer = 'CakePHP Email Component' Definition at line 192 of file email.php. --~--~-~--~~~---~--~~ 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: ModelBaker ... umm... yummy
Maybe cakeapp? http://cakeapp.com Drinkspiller wrote: There was a web based thing floating around I saw posted on this group WebBaker? http://nio.infor96.com/webbaker/ --~--~-~--~~~---~--~~ 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: HABTM retrieving help
If I understood correctly you're trying to paginate realated HABTM data based on some condition on the join table? Have a look at http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-relationship/ and http://www.cricava.com/blogs/index.php?blog=6title=modelizing_habtm_join_tables_in_cakephp_more=1c=1tb=1pb=1 Just a side note: if you want to follow cake's conventions, the join table should actually be named players_teams. gearvOsh wrote: I know how to pagination, but. I would like to do the pagination from the Team model, but the data I need to access is in the TeamsPlayer model. Understand? On Jan 4, 8:01 am, Smelly_Eddie ollit...@gmail.com wrote: You would read the Cake Manual section on pagination which answers all your questions.http://book.cakephp.org/view/164/pagination On Jan 3, 10:30 pm, gearvOsh mileswjohn...@gmail.com wrote: Heres my tables and relations: Team Team-belongsTo: Country, State Team-hasAndBelongsToMany: User (the players on a team, table = teams_players) Team: CREATE TABLE IF NOT EXISTS `teams` ( `id` int(10) NOT NULL auto_increment, `status` enum('approved','pending') NOT NULL default 'pending', `name` varchar(50) NOT NULL, `tag` varchar(10) NOT NULL, `urlName` varchar(30) NOT NULL, `website` varchar(50) NOT NULL, `irc` varchar(20) NOT NULL, `about` varchar(255) NOT NULL, `servers` varchar(100) NOT NULL, `logo` varchar(100) NOT NULL, `createDate` int(10) unsigned NOT NULL default '0', `state_id` int(10) unsigned NOT NULL default '0', `country_id` int(10) unsigned NOT NULL default '0', `created` datetime default NULL, `modified` datetime default NULL, PRIMARY KEY (`id`), KEY `state_id` (`state_id`), KEY `country_id` (`country_id`) ) TeamsPlayer CREATE TABLE IF NOT EXISTS `teams_players` ( `id` int(11) NOT NULL auto_increment, `team_id` int(10) unsigned NOT NULL, `user_id` int(10) unsigned NOT NULL, `role` enum('leader','captain','member') NOT NULL default 'member', `status` enum('approved','pending') NOT NULL default 'pending', `joinDate` int(10) NOT NULL, PRIMARY KEY (`id`), KEY `team_id` (`team_id`), KEY `user_id` (`user_id`) ) Ok if I do a basic Team-find() all the data is returned correctly. Now the problem im running into is how do I grab all teams that I am part of, and paginate it at the same time? Since the user_id values is in TeamsPlayer, im getting confused on this. Any help would be appreciated. --~--~-~--~~~---~--~~ 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: putting 2 modules on the same page
There are a few ways you can achieve this, depending of course what sort of data your're handling. Normally a login box doesn't require any model data so you can just make it into an element and have $this-element(...) [1] wherever you need your login box to appear. If you need to access model data on all your modules you can either use [2] the all required models in your controller and pass the data to your view or use requestAction [3] to fetch data for another controller. [1] http://book.cakephp.org/view/97/Elements [2] http://book.cakephp.org/view/51/Controller-Attributes#components-helpers-and-uses-53 [3] http://book.cakephp.org/view/434/requestAction bmaorlo wrote: Hi , I wonder if this is possible , lets say i have 2 modules 1. login box = i made it on folder http://localhost/cake/login/log 2. news box = i made it on folder http://localhost/cake/news/show Now i want to make 1 page that will conteins both of the modules , let say that ths url of this page will be http://localhost/cake/index.php i want to design the index.php and place there both of the modules , every one of them should act like he act on his own adress but working toghether on the same page . is that possible ? Thanks ahead. Maor. --~--~-~--~~~---~--~~ 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: ModelBaker ... umm... yummy
Wrap a gtk ui around bake and you're half way there ;) DM wrote: Holy Cow, this thing looks freakin awesome! Does any other framework have anything close to ModelBaker? www.widgetpress.com IMHO, if this thing takes off, this could add a ton of new people into the community. I'll definitely be downloading this thing on Monday. Mike --~--~-~--~~~---~--~~ 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: Reverse relations?
User belongsTo Country? gearvOsh wrote: I know how to do relations for foreign keys, but I cannot figure out how to do this. In my users table, I have a column called state_id and country_id. I tried a hasOne country but that does not work. It looks for a user_id on the Country table that matches the user id, I need it the other way around. I need the country_id on the user table to match the id on the country table. How would I go about this? --~--~-~--~~~---~--~~ 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: Controller members
It's not matter of inheritance, the problem is that helpers aren't meant to be used in controllers. The $helpers array only tells the dispatcher which helpers to load when rendering the view. Try this: controllers/ajaxtests_controller function test() { $this-set('myvar',$arr); } views/ajaxtests/test.ctp echo $javascript-object($myvar); rhythmicde...@gmail.com wrote: Confused about inheritance here. Here is the helpers var from Cake's controller file. var $helpers = array('Html', 'Form', 'Javascript', 'Ajax'); AppController extends this so I think that the helpers should be available there. My controller AjaxtestsController extends Appcontroller and so they should also be available there However when I do the following: $this-set('myvar', $this-javascript-object($arr)); or $this-set('myvar', $javascript-object($arr)); I get the following error: Notice (8): Undefined property: AjaxtestsController::$javascript [APP \controllers\ajaxtests_controller.php, line 26] Code | Context $arr = array( item 1, item 2 ) //debug($this); $this-set('myvar', $this-javascript-object($arr)); AjaxtestsController::edit() - APP\controllers \ajaxtests_controller.php, line 26 Object::dispatchMethod() - CORE\cake\libs\object.php, line 115 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 245 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 211 [main] - APP\webroot\index.php, line 88 Fatal error: Call to a member function object() on a non-object in C: \htdocs\caketest\app\controllers\ajaxtests_controller.php on line 26 CODE POSTED BELOW ?php class AjaxtestsController extends AppController { var $helpers = array('Javascript'); function index() { $this-pageTitle = 'Index Page'; } function view() { $this-pageTitle = 'View Page'; } function edit() { $this-pageTitle = 'Edit Page'; $arr = array('item 1', 'item 2'); //debug($this); $this-set('myvar', $this-javascript-object($arr)); } } ? --~--~-~--~~~---~--~~ 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: How to remove execution duration output !-- 1.6278s --
One thing you could do is include the request handler component in you app_controller and then in you app_controller's beforeFilter have something like: function beforeFilter() { parent::beforeFilter(); if ($this-RequestHander-isAjax()) { Configure::write('debug',0); } } That way you can suppress debug messages for ajax calls and retain them for everything else. Jon Bennett wrote: Is this not simply a case of turning down your debug level? This should stop that data being produced, but I haven't gotten around to using ajax calls so I'm yet to cross this bridge. That will do it - but, it's a html comment, so it won't be visible even via ajax, so what's the issue, when you go to production mode, it vanishes anyway. cheers, Jon --~--~-~--~~~---~--~~ 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: Small problem passing variables
getLastInsertID() and getInsertID() are both equivalent model functions (please note the capitalized d in both of them). You can pass this to the view using set() in the controller as you would pass any other variable, however it doesn't feel quite right to do this. What I would do in your position is use the session component to store the user's id and then before calling save on subsequent models I wound fill the data array with the value from the session. Steppio wrote: Thanks to everyone for the responses its been a big help, i am still stumped however, are getInsertID and getLastInsertID model functions? If so how would i pass these to the views? On Dec 29, 4:22 pm, Webweave webwe...@gmail.com wrote: I think you meant $this-User-getLastInsertId(); On Dec 28, 9:59 am, Troy Schmidt schmidt.t...@gmail.com wrote: $this-User-getInsertID(); I don't know about the Auth component as i haven't used it alot. But that would get the last inserted ID. I would just set that variable and include it in the view for the future steps. Otherwise it looks like 'user_id' isn't set yet for user On Dec 28, 11:11 am, Steppio stepisgr...@hotmail.com wrote: Hello everybody, i am totally new to Cake and am finding it quite difficult to understand all the different parts of it. At the moment i'm trying to make a three part user registration process, firstly with the username and password fields, then onto details about the user, then on to duties they wish to undertake on the site. The only problem i am having is once the username and password are created it creates an ID in the users tables, referenced to my other tables as 'user_id'. What i cannot quite figure out is how, once a user is created, would i get that user_id into the duties view? What i am doing at the moment is shown below: function add() { if (!empty($this-data)) { $this-User-create(); if ($this-User-saveAll($this-data)) { $this-Session-setFlash(__('Your Username and Password have been saved', true)); $cookie = array(); $cookie['user_id'] = $this-Auth-user('user_id'); $this-Session-write('Auth.User', $cookie); $this-redirect(array('controller'='details','action'='add')); } else { $this-Session-setFlash(__('Your Username and Password could not be saved. Please, try again.', true)); } } } ^users_ controller^ I then call this in the 'duties/add' view with: $user_id = $session-read('User_id'); echo $form-input('user_id',array('value' = $user_id )); The only problem with this is Cake returns a select box populated with all of the id's in the user tables. All i want is the ID that has just been created. This is probably a very simple problem but i've been reading alot on the internet and just cannot understand how to do it. Any help and advice would be greatly appreciated!! Yours hopefully, Steppio --~--~-~--~~~---~--~~ 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: How to give label when we take input type is file and how to give titles to your pages in cakephp
Find answers to all your questions in one place, no emailing required: http://book.cakephp.org mona wrote: How to give titles to your pages in your layout where to give that title and i m taking input type file and i want to give name as attachment on my view how to give this in label --~--~-~--~~~---~--~~ 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: Model data in all views
I think your best bet is to use requestaction on the categories controller and include an element on your default layout, have a look at http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestaction Daniel wrote: Hi there, sorry to bother you with what is probally a very simple question, but I'm new to cake and having some trouble getting to grips with it. I'm working on a simple e-commerce site for an assignment at university, I have a Category model set-up, which is going to be used to group products together. I've set-up a default.ctp file for my layout, and I wanted to be able to have the list of categories, from the model, display within the default.ctp file, so it's shown on every page of the site. It's going to be an unordered list, which links to the relevent page to display the products within that category. Thank you. --~--~-~--~~~---~--~~ 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: Newby: Basic file structure for website CMS
Have a look at prefix routing: http://book.cakephp.org/view/544/Prefix-Routing What you'll end up with is, for example: config/core.php // enable admin routing Configure::write('Routing.admin','admin'); controllers/news_controller.php NewsController { function index() { // this is public } function view() { // also public } function admin_add() { // private } function admin_edit() { // also private } } And your views/news directory would have: views/news/index.ctp views/news/view.ctp views/news/admin_add.ctp views/news/admin_edit.ctp The resulting urls for these actions are: http://example.com/myapp/news/ (index action maps to / by default) http://example.com/myapp/news/view/some_id http://example.com/myapp/admin/news/add http://example.com/myapp/admin/news/edit/some_id All you need now is some sort of authentication and authorization mechanism to protect your admin actions. danwednesday wrote: Hi, I'm brand new to php and the MVC style of development. I've read some of the cakephp documentation and it makes sense in theory, so I'm keen to push on. However, the first task I've set myself is to build a simple website and CMS for displaying and administering news articles. I have built the back-end (CMS) based on the same blog application in the cakephp documentation, but my problem is I don't know how to deal with the file structure to make the CMS files distinct from the website files. What I want to do is have my website files so they're accessible in the domain root. e.g. http://www.example.com/latest_news_articles and http://www.example.com/articles/my_first_article. I want the CMS files though to appear within an 'admin' folder, e.g.http:// www.example.com/admin/add_news_article and http://www.example.com/admin/edit_news_article. Do I put all models/views/controllers in the same files in the app folder, or do I create directories in the app folder and have lots of different model/view/controller files? Thanks folks! --~--~-~--~~~---~--~~ 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: Where to place new layout page
app/views/layouts mona wrote: Can anybody tell me where to place my new layout page in cakephp so that i call in my login function to use that layout --~--~-~--~~~---~--~~ 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: HTML 4 specific CakePHP?
gearvOsh wrote: In CakePHP you can choose the Doctypes of XHTML or HTML but the taglist is all XHTML, which then causes markup errors. gearvOsh, It shouldn't be too much of hassle to create a html4 helper based on the existing html helper. If you create your helper extending the existing html helper, basically all you'd have to do is copy/paste the tags array (lines 45-98 in 1.2 final) into your newly created class and change as necessary. --~--~-~--~~~---~--~~ 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: count no of rows.
You can also optmize it a bit further and use countercache http://book.cakephp.org/view/490/counterCache-Cache-your-count Alexandru Ciobanu wrote: majna wrote: tipo :( $count = $this-Project-Message-findCount(array ('Message.project_id'=$MyProjectId)); findCount() is deprecated. Use find('count') instead. http://book.cakephp.org/view/73/Retrieving-Your-Data --~--~-~--~~~---~--~~ 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: % in url params
You shoul urlencode('90%') I suppose. Anyway, wouldn't it be better to use named parameters? That way you get cake's pretty urls and the html helper does the urlencoding as necessary for you. fito wrote: Hi friends. I've been using cake for some months, but it was today the first time I tried to invoke a controller method with a % character in the url. Something like this: $html-link('Example', '/controller/method?width=90%') The link was well-formed but response from the server was something like Not Acceptable. The page you've requested doesn't exists... does anyone know why? --~--~-~--~~~---~--~~ 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: A way to lost your session in Cake 1.2RC3 :-)
At some point in time it was the intention that session ids would not be renewed for ajax requests. From changeset 5982: Sessions id are not longer renewed if a request is from Ajax, or from requestAction(); When Security.level (1.2) or CAKE_SECURITY (1.1) is set the 'high' renewing of Session id only happens if request is 2 seconds after the last request. The 2 seconds threshold is still there in 1.2 RC3. On Nov 11, 7:37 am, AD7six [EMAIL PROTECTED] wrote: On Nov 11, 8:15 am, Serge Rodovnichenko [EMAIL PROTECTED] wrote: Thanks, Gwoo. This helps :-) Where to get more information about behavour of security levels? I think in 'high' level Cake performs a Referrer checks. This is why I lose sessions in case described above. It does, but that probably isn't relevant. With high security the session id changes on each request (as mentioned previously in the thread) So normally you would have: GET / sessionid = void sessionid #1 created Response / sessionid = #1 GET /abc sessionid = #1 sessionid changed to #2 Response /abc sessionid = #2 - updated GET /def sessionid = #2 sessionid changed to #3 Response /def sessionid = #3 - updated GET /xyz sessionid = #3 sessionid changed to #4 Response /xyz sessionid = #4 - updated with the sessionid stored in the cookie client side (obviously). On the server the session id changes as soon as the request is received. Irgo if you send two or more concurrent requests without waiting for the response e.g.: GET / sessionid = void sessionid #1 created Response / sessionid = #1 GET /abc sessionid = #1 - session doesn't exist - session id #2 generated, session id #1 deleted GET /def sessionid = #1 - session doesn't exist Response /def or redirect /users/login sessionid = #new It isn't quite so simple, but in principle that's what you're looking at. If you set security to medium, the session id persists for the life of your browser session, hence concurrent requests will not cause you to loose your session. hth, AD --~--~-~--~~~---~--~~ 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: Whats up with prototype and Cake 1.2?
Do you have the Javascript helper on whatever controller you're using? Ed Drain wrote: I get the following error: Line 31 is the one with the javascript-link part. Whats wrong with this? *Notice* (8) javascript:void(0);: Undefined variable: javascript [*CORE\cake\libs\view\layouts\default.ctp*, line *31*] Code javascript:void(0); | Context javascript:void(0); $___viewFn= C:\wamp\www\gradebook\cake\libs\view\layouts\default.ctp $___dataForView = array( page = home, subpage = null, title_for_layout = Home, content_for_layout = h2Release Notes for CakePHP 1.2.0.7296 RC2./h2 a href=https://trac.cakephp.org/wiki/notes/1.2.x.x;Read the release notes and get the latest version /a p span class=notice successYour tmp directory is writable./span/p p span class=notice successThe emFileEngine/em is being used for caching. To change the config edit APP/config/core.php /span/p p span class=notice successYour database configuration file is present./span/p p span class=notice successCake is able to connect to the database./span/p h3Editing this Page/h3 p To change the content of this page, edit: APP/views/pages/home.ctp.br / To change its layout, edit: APP/views/layouts/default.ctp.br / You can also add some CSS styles for your pages at: APP/webroot/css./p h3Getting Started/h3 p a href=http://book.cakephp.org;strongnew/strong CakePHP 1.2 Docs/a a href=http://book.cakephp.org/view/219/the-cakephp-blog-tutorial;The 15 min Blog Tutorial/abr / /p h3More about Cake/h3 p CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC./p p Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility./p br / ul lia href=http://www.cakefoundation.org/;Cake Software Foundation /a ulliPromoting development related to CakePHP/li/ul/li lia href=http://live.cakephp.org;The Show /a ulliThe Show is a weekly live internet radio broadcast where we discuss CakePHP-related topics and answer questions live via IRC, Skype, and telephone./li/ul/li lia href=http://bakery.cakephp.org;The Bakery /a ulliEverything CakePHP/li/ul/li lia href=http://astore.amazon.com/cakesoftwaref-20/;Book Store /a ulliRecommended Software Books/li/ul/li lia href=http://www.cafepress.com/cakefoundation;CakeSchwag /a ulliGet your own CakePHP gear - Doughnate to Cake/li/ul/li lia href=http://www.cakephp.org;CakePHP /a ulliThe Rapid Development Framework/li/ul/li lia href=http://manual.cakephp.org;CakePHP Manual /a ulliYour Rapid Development Cookbook/li/ul/li lia href=http://api.cakephp.org;CakePHP API /a ulliDocblock Your Best Friend/li/ul/li lia href=http://www.cakeforge.org;CakeForge /a ulliOpen Development for CakePHP/li/ul/li lia href=https://trac.cakephp.org/;CakePHP Trac /a ulliFor the Development of CakePHP (Tickets, SVN browser, Roadmap, Changelogs)/li/ul/li lia href=http://groups-beta.google.com/group/cake-php;CakePHP Google Group /a ulliCommunity mailing list/li/ul/li lia href=irc://irc.freenode.net/cakephp http://irc.freenode.net/cakephpirc.freenode.net http://irc.freenode.net #cakephp/a ulliLive chat about CakePHP/li/ul/li /ul, scripts_for_layout = , cakeDebug = , html = HtmlHelper HtmlHelper::$tags = array HtmlHelper::$base = /gradebook HtmlHelper::$here = /gradebook/ HtmlHelper::$params = array HtmlHelper::$action = display HtmlHelper::$data = NULL HtmlHelper::$_crumbs = array HtmlHelper::$__docTypes = array HtmlHelper::$helpers = NULL HtmlHelper::$webroot = /gradebook/ HtmlHelper::$themeWeb = NULL HtmlHelper::$plugin = NULL HtmlHelper::$namedArgs = NULL HtmlHelper::$argSeparator = NULL HtmlHelper::$validationErrors = NULL HtmlHelper::$__tainted = NULL HtmlHelper::$__cleaned = NULL HtmlHelper::$_log = NULL, form = FormHelper FormHelper::$helpers = array FormHelper::$fieldset = array FormHelper::$__options = array FormHelper::$fields = array FormHelper::$requestType = NULL FormHelper::$base = /gradebook FormHelper::$webroot = /gradebook/ FormHelper::$themeWeb = NULL FormHelper::$here = /gradebook/ FormHelper::$params = array FormHelper::$action = display FormHelper::$plugin = NULL FormHelper::$data = NULL FormHelper::$namedArgs = NULL FormHelper::$argSeparator = NULL FormHelper::$validationErrors = NULL FormHelper::$tags = array FormHelper::$__tainted = NULL FormHelper::$__cleaned = NULL FormHelper::$_log = NULL FormHelper::$Html = HtmlHelper object, session = SessionHelper SessionHelper::$helpers = NULL SessionHelper::$__active = true
Re: How do I represent a habtm where the join table has extra information?
This might come in handy when it comes to manipulating the extra data on the join table: http://www.cricava.com/blogs/index.php?blog=6title=modelizing_habtm_join_tables_in_cakephp_more=1c=1tb=1pb=1 Adriano Varoli Piazza wrote: Thanks for both the answers. I'm now dealing with the right way to name the model and controller for that join table. It looks like I'm doing something wrong somewhere... On 4 nov, 11:41, hydra12 [EMAIL PROTECTED] wrote: Take a look here:http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM. Look especially at the 'with' key when you define your HABTM relationship. It says in the docs: with: Defines the name of the model for the join table. By default CakePHP will auto-create a model for you. Using the example above it would be called RecipesTag. By using this key you can override this default name. The join table model can be used just like any regular model to access the join table directly. If you define your with field, you should be able to use your join table just like you would any other table. On Nov 4, 8:10 am, Anupom [EMAIL PROTECTED] wrote: I think having a separate model for your join table is okay in this case. And perhaps it's a must as you have a third foreign key involved in that join table. On Tue, Nov 4, 2008 at 6:00 PM, Adriano Varoli Piazza [EMAIL PROTECTED]wrote: I'm developing an app where I have two tables, let's call them items and people, where the relationship between them is HABTM. Plus, the individual relationships have extra info: this person is related to this item with a 'description' field. E.g.: people: id other fields items: id other fields items_people: id person_id item_id description (varchar) In the 'worst' case, the join table holds another foreign key to a table which holds extra info: items_people_bis: id person_id item_id concept_id --- concepts: id other fields --- Now, I know this is convoluted, but I wanted to know which is the best way / standard practice to represent such a thing in cake? I've tried with a simple habtm association in the model, seen that I could use 'with', also tried using hasmany on both models involved, and making an extra model for the join table, but I'm still not sure about how to go. I'd appreciate any help. Thanks in advance Adriano -- Anupom Syamhttp://syamantics.com/ --~--~-~--~~~---~--~~ 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: Broken image if shown with file_get_contents()
Maybe you forgot whitespace after closing a php tag. Anupom wrote: It works fine here! Did you try exiting at the end of the action? On Sun, Nov 2, 2008 at 7:48 PM, Giaco [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: That doesn't work either. The path is correct, put the output gets scrambled. I think this is an encoding issue but I can't work around it and don't find anything on the web about it. Does this function work as expected with your cake installation? (I'm using UTF8) On Nov 2, 11:10 am, Anupom [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Can you please try with the following code? function view() { Configure::write('debug', 0); header('Content-type: image/jpeg;'); echo file_get_contents(WWW_ROOT . 'img' . DS . 'folder' . DS . 'test.jpg'); exit; } On Sun, Nov 2, 2008 at 4:36 AM, Giaco [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hello, for security reasons and on the fly resizing I route all picture requests to /images/view (images being the controller). But this function outputs only a broken image: /* images controller (for testing purposes no use of view and layout) */ function view() { Configure::write('debug', 0); header('Content-type: image/jpeg;'); echo file_get_contents(img/folder/test.jpg); } When I don't send the header, I see the binary version of the image. What could this possibly be? -- Anupom Syamhttp://syamantics.com/ http://syamantics.com/ -- Anupom Syam http://syamantics.com/ --~--~-~--~~~---~--~~ 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: Problem on Error Handling with CAKEPHP
when debug = 0, AppError::missing*() methods don't get called, instead you should override ErrorHandler::error404() [EMAIL PROTECTED] wrote: Is It someone that can help me? On 29 Ott, 15:25, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi I would use the Error HAndling of CAKEPHP. I create a my function in app_error.php Now if I set the debug to 0 if I use this function I get always another page (I think the error404 ) If I set debug to 1 I get the right error's page but I get a performance's worsening. What can I do ? Many Thanks --~--~-~--~~~---~--~~ 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: cakephp asterisk agi
How about symlinking /var/lib/asterisk/agi-bin into your vendors path? samba wrote: hi does someone tried to mix akephp and asterisk? i want to use phpagi class working with cakephp. but asterisk phpagi sould remain in the /var/lib/astersik/agi-bin directory and cake php is in the /www directory. i want to develop some function in cakephp that require asterisk phpagi. how can i take cakephp to /agi-bin directory or phpagi in vendors but still making it working with /agi-bin. thank for your help --~--~-~--~~~---~--~~ 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: need your help - project model
[EMAIL PROTECTED] wrote: I really dislike my work when I have cheated and built views after the models... The gui never turns out nice... feels like scaffolding :) Hehehe, interesting... The thing is this kind of approach would never work for me. I'm a terrible designer, cake's scaffolding is wy better than what I would come up with. That's why I focus on modeling and programming and leave the views to the end, then I hand it over to the design guys and let them make it pretty ;). Naturally this is not a one way street. As you said tinkering the views often shapes up the controllers, requires some javascript of ajax integration, etc. --~--~-~--~~~---~--~~ 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: set_time_limit in Cake?
set_time_limit, when called from a script has effect only on the execution of that script/portion of code. You could call it anywhere in your app though IMHO set_time_limit(0) reeks bad design. Liebermann, Anja Carolin wrote: Hi everybody! Is there a possibility to set the time limit for a script in CakePHP? With a normal PHP script which has a big execution time I set it to set_time_limit(0); to avoid error messages. Can I do the same with Cake without changing the seetings for the whole server? If yes where and how? Thank you in advance! Anja --~--~-~--~~~---~--~~ 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: set_time_limit in Cake?
Very true, I was thinking about a page rendering script. As far as cli code goes, the ShellDispatcher construct method takes care of set_time_limit(0) for you. cake/console/cake.php ShellDispatcher::__construct( line 127 on 1.2 RC3): function __construct($args = array()) { set_time_limit(0); [EMAIL PROTECTED] wrote: When I run something with php cli I have not noticed any normal time limit. I have had cron jobs run for 20 minutes without setting a limit. Sure, set_time_limit is bad design for a page rendering script. But something that is supposed to crawl through 6-7 months of transactions for a web shop and create statistics is something else. There is no design in the world that will get you down under 30 sec. :) /Martin On Oct 24, 4:27 pm, Liebermann, Anja Carolin [EMAIL PROTECTED] wrote: Hi everybody! Is there a possibility to set the time limit for a script in CakePHP? With a normal PHP script which has a big execution time I set it to set_time_limit(0); to avoid error messages. Can I do the same with Cake without changing the seetings for the whole server? If yes where and how? Thank you in advance! Anja --~--~-~--~~~---~--~~ 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: checkbox state
echo $form-input('MyModel.my_tinyint_field',array('value' = 1); That should do the trick. RyOnLife wrote: Pardon me for asking I simple question, that I really feel I should have been able to find an answer to, but... Using the form helper, how can I create a checkbox which always defaults to a checked state? --~--~-~--~~~---~--~~ 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: need your help - project model
Matthieu wrote: Hi everybody, I'm planning to make a web application, it's a kind of a social network. Would you know some guidelines to make this app from A to Z. I want to build a space rocket, it's kind of a projectile... Just kidding. My point is you'll won't get much help by tossing a vague project idea on the list and expecting a how-to guide to just come out of the blue. Shall I start with the design, the data base or the php classes? Would you know a well-known model about it because I don't know where to start actually? I take it you're not very familiar with CakePHP, I suggest you read through http://book.cakephp.org/ and try the tutorials in the example application section. That should get you up and running with CakePHP. Once you're ready to go on to your project, the natural way to get things done is: 1) Gather requirements / broad use cases. You'll end up with an idea of which pages you'll have and what they will do as well as an idea of what data you'll be handling. Don't try to be too thorough at this point or you'll be stuck here forever. 2) Sketch your database, use a graphical tool for this such as MySql Workbench. Pay attention to CakePHP conventions! 3) Pick a use case, bake the models you think you'll need for this use case 4) Scaffold your controller / views 5) Validate your model (i.e. make sure you're gathering all the required data for this particular use case and that the data is well related), repeat 2-4 until you're satisfied. 6) bake views and controllers, customize tem as necessary to fulfill this particular use case, don't be too rigorous on layout/design at this point, just make sure your views are well structured and functional 7) reevaluate your use cases, you'll probably find that you missed something, go back to 1 refine your use cases 8) repeat 1-7 until you run out of use cases finally, once you're requirements are met, brush up your design and deploy your application. --~--~-~--~~~---~--~~ 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: Updating a list with AJAX - picking from one list box and updating another
You could write a oncomplete callback that deletes the entry from the source list with a second ajax call to update the database. Not very elegant though. Perhaps its just simpler to wrap both lists in a div and update the whole thing with just one ajax call. tarapage wrote: Hi, I'm new to AJAX and to cake PHP, but am an experienced software developer. I'm having trouble doing something that seems very simple. I have two list boxes, both generated from a database. I want to pick items from one list box and have them add to the other list box. This is simple enough, I'm doing it with an link and using ajax to update the destination list once it is added to the database. I also need to remove that item from the source list when the person hits add. I look at the documentation and it says that the update uses one DOM id to update, and I need to update 2 DOM ids off of this one action. Here is an example. Source List Destination List [ADD] Entry 1 [ADD] Entry 2 [ADD] Entry 3 When I click ADD On an entry, I want it to move to the destination list and be removed from the source listing. So let's choose Entry 1. Source ListDestination List [Add] Entry 2 [Delete] Entry 1 [Add] Entry 3 I need this to happen with AJAX. I can get the Add to work to go to the destination but I cannot do the Source change as well. Any ideas? Do I have to add another ajax call besides the ajax-link? Also, when I delete from Destination List I need it to go back to Source list. So If I hit Delete on Entry 1 I need it to look like the original listing above... Source List Destination List [ADD] Entry 1 [ADD] Entry 2 [ADD] Entry 3 All my entries in the source list are being read from the database tables (and I wouldn't want to actually delete them from the tables when the person adds them to the Destination List. All of my Destination List items are stored in a table and can be physically deleted when I hit Delete button. Any ideas would be appreciated. --~--~-~--~~~---~--~~ 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: Saving self-referential-HABTM relationships...
I imagine it should work if you use different join tables for each HABTM relationship. Regardless of cakephp this is what I imagine you'd need in this situation (imagine what would happen if a user is both a friend and an admirer of another user). var $hasAndBelongsToMany = array( 'Friend' = array('className' = 'User', 'joinTable' = 'friends_users', 'foreignKey' = 'friend_id', 'associationForeignKey' = 'user_id' ), 'Admirer' = array('className' = 'User', 'joinTable' = 'admirers_users', 'foreignKey' = 'admirer_id', 'associationForeignKey' = 'user_id' ) ); wallerdm wrote: Dear All, Forgive me if this is covered elsewhere. I'm playing with cakePHP as an alternative to Rails and am getting to grips with it by creating a really simple social network app. I've got some nice authentication and user profiles sorted and that's all displaying great but now I've come to add the add as a friend functionality and I'm struggling. Every user in the users table has an id and I also have a table set up, users_users, to hold the self referential join. This table has a an id, a user_id and a friend_id. My user model contains the following... ?php class User extends AppModel { var $name = 'User'; var $hasOne = 'Profile'; var $hasMany = array('Status' = array('order' = 'Status.created DESC' )); var $hasAndBelongsToMany = array( 'Friend' = array('className' = 'User', 'joinTable' = 'users_users', 'foreignKey' = 'user_id', 'associationForeignKey' = 'friend_id' ), 'Admirer' = array('className' = 'User', 'joinTable' = 'users_users', 'foreignKey' = 'friend_id', 'associationForeignKey' = 'user_id' ) ); } ? And my users_controller contains... ?php class UsersController extends AppController { . function addfriend($friend_id = null) { $user_id = $this-Session-read('User'); $this-data['User']['id'] = $user_id['id']; $this-data['Friend']['id'] = $friend_id; print_r($this-data); if($this-User-saveAll($this-data)){ echo 'saved'; }else{ echo 'failed'; } } . } ? Now I know that I've got the data element wrong for the database save because it isn't working and the SQL that's generated when you add a friend is incorrect. If you're logged in as a user with id 1 and want to become friends with the user with id 4 (http://localhost/network/users/addfriend/4), you get... data = Array ( [User] = Array ( [id] = 1) [Friend] = Array ( [id] = 4 ) ) ...and the SQL from the CakePHP debug panel is... UPDATE `users` SET `id` = 1 WHERE `users`.`id` = 1 Is anyone able to help me get this whole self-referential-HABTM relationship thing sorted? Thanks in advance. Dave. --~--~-~--~~~---~--~~ 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: How to handle multiple image-upload in the same model / form?
burzum wrote: My problem is that i have a multipage-report, or better to say one big report (table) with ~500 fields devided into some pages with a list of pages to make it less confusing. Some of the pages contain 1 to 12 images. Now my question or problem: How do i handle them in a good way? Should i use an extra table to store them? How do i handle all the photos in the same form? They have to appear on certain positions in the report. So i must be able to identify them to set them in the right position. Where do i put the handling in? Model? Any suggestions for helpers, components, behaviors? Usually I store images in the file system. I is generally faster and allows you to link directly to the image. To that end, does the trick very well: http://cakeforge.org/snippet/detail.php?type=snippetid=36 It's required that the files are converted to jpg if they are no jpg, saved in their original size for documentation purpose and that thumbnails are created for the pages. I have to create another resized version of the image for direct printing out of the browser (a view for the photo filling a DINA4 page) and i have to include them in a pdf of the report. Assuming you have PHP with GD extensions, that shouldn't be a problem, you could add some methods to que component above, or derive your own component from it. To covert all images to jpg you'd hava a switch statement on the mime type and use the appropriate gd imagefrom --~--~-~--~~~---~--~~ 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: How to do mod_rewrite????
Hi, Make sure all .htaccess files are in place, also, in some cases you have to set RewriteBase to get mod_rewrite to work. schneimi wrote: Hi, not sure what version of Cake you use, but when I installed the latest stable version of cakePHP, I was also very confused, mod_rewriting was obviously working on my apache (tested it seperatly), but no matter what I tried, I didn't come to see any css effects on the cake site. Well I could'nt solve the problem, but all looked nice after installing Cake 1.2, so maybe thats an option for you too. Michael SIXS schrieb: How do you actually set the mod rewrite. I set it in sthe system httpd.conf, but I don't see the color in the cakephp page. Is there another issue. I have installed it several times and hve installed it in another system, both XP OS. I am going to install it on a Ubuntu system. Jim --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Pagination component misbehaving in php4
Hi all! I have a project that uses the Pagination component. It works perfectly in my development environment, however when I uploaded the project to the production server things went sour. The component seems to do it's job, i.e. results get ordered, controlling the parameters via the url works and elements/pagination.thtml gets rendered properly. The problem is that the header links have mysteriously disappeared. I placed some debug calls around the code and found that all calls to the pagination component and helper methods get exactly the same data in both servers. When I placed calls to debug inside PaginationHelper's sortBy() method I found that in my development server the field _pageDetails is always set, while in my production server it gets wiped out somehow, hence the lack of header links. The puzzle is, why is this happening? The project is exactly the same on both servers, the database is the same, the only thing I could think of is some weirdness related to php versions, my development server runs php 5.2.1 and the productions server runs 4.3.11. Can anyone give me any clues? Thanks! Bernardo PHP Version 5.2.1 elements/result_table.thml $th[] = $this-Pagination-sortBy(...) PaginationHelper-_pageDetails = Array ( [importParams] = [Defaults] = Array ( [page] = 1 [show] = 10 [sortBy] = id [sortByClass] = Clube [direction] = ASC ) [show] = 10 [page] = 1 [sortBy] = id [sortByClass] = Clube [direction] = ASC [ajaxDivUpdate] = content [ajaxFormId] = [maxPages] = 9 [showLimits] = 1 [style] = ajax [paramStyle] = get [paramSeperator] = / [url] = /clubes [total] = 3237 [resultsPerPage] = Array ( [0] = 10 [1] = 25 [2] = 50 [3] = 100 ) [pageCount] = 324 [previousPage] = [nextPage] = 2 ) PHP Version 4.3.11 elements/result_table.thml $th[] = $this-Pagination-sortBy(...) PaginationHelper-_pageDetails = Array ( ) --~--~-~--~~~---~--~~ 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: How controller method, called by $ajax-dropRemote, can get ID of a dropped element.
Try: ?= $ajax-dropRemote('droppable_id', array('accept'='title'), array('url'='/mycontroller/ myaction/', 'with'='{draggedid:element.id}') 'update'='droppable_id')); ? Then you can use $this-params['form']['draggedid'] in your controller. On Apr 12, 8:08 am, Derim [EMAIL PROTECTED] wrote: Hi I want to use drag and drop feature in my new CakePHP project. I spent most the day today trying to figure out how controller action, called by $ajax-dropRemote can get id of the draggable element. Searching on google and manual didn't helped. Here is simplified version of code I use for dropRemote. ?= $ajax-dropRemote('droppable_id', array('accept'='title'), array('url'='/mycontroller/myaction/', 'update'='droppable_id')); ? 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 -~--~~~~--~~--~--~---
Re: Problem using the prototype function $F()
Maybe php is interpreting $F as a variable, so try using single quotes for the code block, like echo $javascript-codeBlock(' ... $F(sectionName) ... On May 7, 10:06 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi I have this view: ?php echo $javascript-codeBlock( function createNewArticle(id) { var name = $F('sectionName'); alert(name); } ); ? input type=text id=sectionName size=25 When I try this view with my browser I get this error: Notice: Undefined variable: F in .. How I can resolve this ? Many Thanks Marco --~--~-~--~~~---~--~~ 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: About the cakephp ajax's problem, work well at firefox, but not at IE7
Check the ajax response, there are some warning messages. Note that everything that is returned is pased to the element to be updated. Just to see if that is the problem, set the debugging level to 0. On May 4, 5:59 pm, seedme [EMAIL PROTECTED] wrote: Can you help me? I want to using AJAX to populate the data based on the selected value. but the following codes work well at FireFox, but not display the populated data IE7.0 . Some can help me to find the solutions? My test website's link ishttp://dev.fuzgo.com I need the help ASAP. Thanks. For member register Action Country - State - City. At register.ctp file: I used the following code. - ?php echo $form-input('Member/country', array('class' = 'required','label'='Country','onChange'='javascrip:getStateList(this.value)','type'='select','style'='width: 250px;', 'selected'='0', 'options'= $this-requestAction('/ Countries/ select') )); echo $form-input('Member/state', array('class' = 'required', 'type'='select','id'='MemberState', 'style'='width:250px;', 'onChange'='javascrip:getCityList(this.value)', 'options'=array( '0' = 'Select one state/province')));? script function getStateList(sel){ new Ajax.Updater('MemberState','/States/select/'+sel, {asynchronous:true, evalScripts:true});} /script At states_controller.php: -- function select($id = null){ $this - RequestHandler - setAjax($this); $id = $this-params['data']['form']['country']; if(!is_numeric($id))$id = 2 ; $statelists = $this-State-generateList( country_id = $id , 'State.name ASC', null, '{n}.State.id', '{n}.State.name'); $this-set('statelists',$statelists); $this-render('select','ajax'); } - At select.ctp: - ?php if (isset($statelists) count($statelists)){ foreach($statelists as $key=$name) { $results .= 'option value='.$key.''.$name.'/ option'; } }else{ $results = 'optionRe-select a Country! /option'; } echo $results; ? --- --~--~-~--~~~---~--~~ 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: Prototype Ajax IE
Try using a div instead of p for view. On Apr 9, 3:52 am, Siasia [EMAIL PROTECTED] wrote: Here are the sources:http://bin.cakephp.org/view/1929596573 Badly need help. I already lost nearly 5 hours banging by head against the wall trying to get this code work in IE. In FF and Opera everything looks great With server everything is ok: IE trying to get contents of Ajax response, responce returns valid result, but div view is not populated. This is not IE Ajax caching. I`m tottaly sure. Tryed different urls with timestamp and so on. It must return 'No results found' if call is cached. JS works OK also. Spinner turning during call and view div is fading in as expected. But data isn`t updated with contents of Ajax call responce. This all happens only in IE. Have I missed something? I have latest stable Cake, and latest prototype and scriptaculous. --~--~-~--~~~---~--~~ 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: How to stop Ajax triggered by onLoad event?
You probably need to pass the callback functions to Event.observe in a variable, so you can use that variable when calling Event.stopObserving(). It's all explained in the prototype documentation: http://prototypejs.org/api/event/stopObserving Also read about Event.stop() which is used for a different thing. On Apr 8, 12:12 am, skyblueink [EMAIL PROTECTED] wrote: The code below, using prototype and Ajax, populates 3 divs. But, once the page is loaded and Event.observing is acting, can I stop the populating with a click button? I thought Event.stop() and Event.stopObserving() should come, and did some tries but failed. div id=red/divscript type=text/ javascriptEvent.observe(window, 'load',function(event) {Ajax.Updater('red','/test/content.php?id=red',...)/script div id=blue/divscript type=text/ javascriptEvent.observe(window, 'load',function(event) {Ajax.Updater('red','/test/content.php?id=blue',...)/script div id=orange/divscript type=text/ javascriptEvent.observe(window, 'load',function(event) {Ajax.Updater('red','/test/content.php?id=orange',...)/script --~--~-~--~~~---~--~~ 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: IE7 Not Updating Ajax Divs
Glad to help! Be careful if you plan to upgrade to cakephp 1.2 because ajax- observeField changed and its behavior is now different if frequency is not set or is less than 1 second. See: https://trac.cakephp.org/ticket/1194 Also I think your code uncovered a bug in 1.2 when frequency is 0. I reported it here: https://trac.cakephp.org/ticket/2339 On Apr 3, 12:37 pm, Christopher E. Franklin, Sr. [EMAIL PROTECTED] wrote: Bah, found someone else's code that states if you put frequency to 0.xx, it works in IE and it updates like a keypress. On Apr 3, 8:21 am, Christopher E. Franklin, Sr. [EMAIL PROTECTED] wrote: Awesome, that worked. Thanks a ton, bernardo! I wanted it to update on each keypress so, I think I will have it check if it is FF or IE and set the value based on what browser the user is viewing the page in. Unless anyone else knows of a way to make IE update faster. On Apr 2, 7:19 pm, bernardo [EMAIL PROTECTED] wrote: Have you tried with frequency 0 Just a guess... On Apr 2, 7:59 pm, Christopher E. Franklin, Sr. [EMAIL PROTECTED] wrote: Well, after searching, I have found a script that you can bookmark to debug XHtmlRequests for IE(7). It shows that there are no requests going through. Wierd. Further more, I have downgraded to prototype 1.5 (the one that's supposed to work for everything) and nothing. I have gone to other sites that update ajax fine so there has to be an error in the code on my side somewhere. Or possibly in Cake's code. Didn't find anything on Trac yet either. Here is the script in case you're wondering. http://blog.monstuff.com/archives/000291.html On Apr 2, 2:45 pm, Christopher E. Franklin, Sr. [EMAIL PROTECTED] wrote: Hello. I am having a small problem where the divs that need to be updated via ajax are not being updated in IE7. It works fine in FF. I have searched this group and have found only one other question like this but, no answers. The wierd thing is, when I type something in a field, go to another page and then hit my browser's back button, you can see what is supposed to be in the div. It's like it is only updating on a page load. Anyways, I am using cake 1.1.14.4306, PHP5, Prototype 1.15 and Script.aculo.us 1.7.1 Here is the code I am using. Remember, this works fine in FireFox // /user/view/register.thtml !--snip-- echo div class=\required\span class=\userRegisterLabel\label for=\UserUsername\User Name:/label/spanspan class= \userRegisterField\ . $html-input('User/username', array ( 'size' = 30 ))./spandiv id=\userRegisterUsername\/div/div; echo ; echo $html-tagErrorMsg('User/username', 'Username can only contain Letters, Numbers, Underscores(_) and/or Dashes(-). The username must also between 3-25 characters long.'); echo $ajax-observeField('UserUsername', array ( 'url' = 'check_registration_form/username/', 'update' = 'userRegisterUsername', 'frequency' = 0, 'loading' = document.getElementById('userRegisterUsername').style.display = 'block', 'loaded' = document.getElementById('userRegisterUsername').style.display = 'block' )); !--snip-- If you would like to see more code, just post here please. I will keep searching in the mean-time. If I find an answer I will post here again for anyone who has this problem in the future. --~--~-~--~~~---~--~~ 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: IE7 Not Updating Ajax Divs
Have you tried with frequency 0 Just a guess... On Apr 2, 7:59 pm, Christopher E. Franklin, Sr. [EMAIL PROTECTED] wrote: Well, after searching, I have found a script that you can bookmark to debug XHtmlRequests for IE(7). It shows that there are no requests going through. Wierd. Further more, I have downgraded to prototype 1.5 (the one that's supposed to work for everything) and nothing. I have gone to other sites that update ajax fine so there has to be an error in the code on my side somewhere. Or possibly in Cake's code. Didn't find anything on Trac yet either. Here is the script in case you're wondering. http://blog.monstuff.com/archives/000291.html On Apr 2, 2:45 pm, Christopher E. Franklin, Sr. [EMAIL PROTECTED] wrote: Hello. I am having a small problem where the divs that need to be updated via ajax are not being updated in IE7. It works fine in FF. I have searched this group and have found only one other question like this but, no answers. The wierd thing is, when I type something in a field, go to another page and then hit my browser's back button, you can see what is supposed to be in the div. It's like it is only updating on a page load. Anyways, I am using cake 1.1.14.4306, PHP5, Prototype 1.15 and Script.aculo.us 1.7.1 Here is the code I am using. Remember, this works fine in FireFox // /user/view/register.thtml !--snip-- echo div class=\required\span class=\userRegisterLabel\label for=\UserUsername\User Name:/label/spanspan class= \userRegisterField\ . $html-input('User/username', array ( 'size' = 30 ))./spandiv id=\userRegisterUsername\/div/div; echo ; echo $html-tagErrorMsg('User/username', 'Username can only contain Letters, Numbers, Underscores(_) and/or Dashes(-). The username must also between 3-25 characters long.'); echo $ajax-observeField('UserUsername', array ( 'url' = 'check_registration_form/username/', 'update' = 'userRegisterUsername', 'frequency' = 0, 'loading' = document.getElementById('userRegisterUsername').style.display = 'block', 'loaded' = document.getElementById('userRegisterUsername').style.display = 'block' )); !--snip-- If you would like to see more code, just post here please. I will keep searching in the mean-time. If I find an answer I will post here again for anyone who has this problem in the future. --~--~-~--~~~---~--~~ 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: session handling set to database
On Apr 1, 7:11 am, jyrgen [EMAIL PROTECTED] wrote: is there any _gc probability / whatever php setting that is not overwritten by the cake session class, and has to be adjusted manually ? thx, jyrgen session cleaning depends on these php settings: session.gc_probability, session.gc_divisor and session.gc_maxlifetime. As far as I can tell, cakephp only sets session.gc_probability. --~--~-~--~~~---~--~~ 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: session handling set to database
I'm sorry, forget gc_maxlifetime, it think it's ignored when using the database. The other two determine when __gc is called by php. If you add this: ini_set('session.gc_divisor', 1); __gc will be called in every request (not recommended for production, obviously). Try adding some logging to __gc to see what's happening. On Apr 1, 4:20 pm, jyrgen [EMAIL PROTECTED] wrote: ...but wait, these settings are only relevant for the PHP internal session management, while cake brings its own gc routines. or does it behave similar to PHP sessions by taking these values into account ?? sorry but i just don't get it. looking at the sources doesn't bring me any further here.. thanks again, jyrgen ps. can somebody of the developer guys (nate?) make it clearer ? --~--~-~--~~~---~--~~ 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: Ajax Sortable List Confusion
Try setting the id of the li to something like faq_1 faq_2 ... that is they should end in an underscore and a number. On Mar 29, 11:41 am, Dustin [EMAIL PROTECTED] wrote: I did my very best to search everywhere I could to solve this problem related to the $ajax-sortable helper. Most of the posts are dated, so I apologize if I missed the answer somewhere else. Here's what I have: Controller snippets (related to this question): --- var $helpers = array('html', 'time', 'javascript', 'ajax'); function saveOrder() { echo made it!; //just to check and see that it made it for now //normally we would do some DB updating here instead } *all my other actions work properly in this controller Order View: ?php if (isset($javascript)): echo $javascript-link('scriptaculous/lib/prototype.js'); echo $javascript-link('scriptaculous/src/scriptaculous.js'); endif; ? ul id=questions ?php foreach ($faqs as $faq): ? ?php echo li id=\ . $faq['Faq']['id'] . \ style=\margin: 5px; padding: 5px 5px; border: 1px solid #000; width: 500px; cursor: pointer;\ . $faq['Faq']['question'] . /li; ? ?php endforeach; ? /ul ?php echo $ajax-sortable('questions', array('url' = 'saveOrder')); ? p input type=button value=Cancel onClick=window.location='../faqs'; / /p Using just those two simple snippets, I get the sortable list graphically working in the view. In simple terms, I can drag the boxes around with no problem. However, the sortable helper isn't doing anything. The controller action saveOrder never get's called by the helper. Am I missing something obvious here? As I understand it, this is the only code I need in the view to get it working properly, am I wrong? Firebug shows no errors and I don't see anything that looks out of place or wrong in the generated source (when the page is built). Thanks for your help in advance, Dustin Weberhttp://www.dustinweber.com --~--~-~--~~~---~--~~ 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: Ajax Sortable List Confusion
Your code looks ok to me now. Have you checked with firebug that the ajax request isn't made? On Mar 29, 1:13 pm, Dustin [EMAIL PROTECTED] wrote: Bernardo, That made no difference. The drag n' drop stuff graphically works, but it isn't contacting my saveOrder action in my controller. I feel like I'm missing a bit of code somewhere that is the proverbial missing link. Do I need something in my controller action saveOrder for it to know to expect Ajax calls? The view now looks like this: Order View: ?php if (isset($javascript)): echo $javascript-link('scriptaculous/lib/prototype.js'); echo $javascript-link('scriptaculous/src/scriptaculous.js'); endif; ? ul id=questions ?php foreach ($faqs as $faq): ? ?php echo li id=\question_ . $faq['Faq']['id'] . \ . $faq['Faq']['question'] . /li; ? ?php endforeach; ? /ul ?php echo $ajax-sortable('questions', array('url' = 'saveOrder')); ? p input type=button value=Cancel onClick=window.location='../faqs'; / /p Dustin Weberhttp://www.dustinweber.com On Mar 29, 10:43 am, bernardo [EMAIL PROTECTED] wrote: Try setting the id of the li to something like faq_1 faq_2 ... that is they should end in an underscore and a number. On Mar 29, 11:41 am, Dustin [EMAIL PROTECTED] wrote: I did my very best to search everywhere I could to solve this problem related to the $ajax-sortable helper. Most of the posts are dated, so I apologize if I missed the answer somewhere else. Here's what I have: Controller snippets (related to this question): --- var $helpers = array('html', 'time', 'javascript', 'ajax'); function saveOrder() { echo made it!; //just to check and see that it made it for now //normally we would do some DB updating here instead } *all my other actions work properly in this controller Order View: ?php if (isset($javascript)): echo $javascript-link('scriptaculous/lib/prototype.js'); echo $javascript-link('scriptaculous/src/scriptaculous.js'); endif; ? ul id=questions ?php foreach ($faqs as $faq): ? ?php echo li id=\ . $faq['Faq']['id'] . \ style=\margin: 5px; padding: 5px 5px; border: 1px solid #000; width: 500px; cursor: pointer;\ . $faq['Faq']['question'] . /li; ? ?php endforeach; ? /ul ?php echo $ajax-sortable('questions', array('url' = 'saveOrder')); ? p input type=button value=Cancel onClick=window.location='../faqs'; / /p Using just those two simple snippets, I get the sortable list graphically working in the view. In simple terms, I can drag the boxes around with no problem. However, the sortable helper isn't doing anything. The controller action saveOrder never get's called by the helper. Am I missing something obvious here? As I understand it, this is the only code I need in the view to get it working properly, am I wrong? Firebug shows no errors and I don't see anything that looks out of place or wrong in the generated source (when the page is built). Thanks for your help in advance, Dustin Weberhttp://www.dustinweber.com --~--~-~--~~~---~--~~ 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: Ajax Sortable List Confusion
I'm sorry if this sounds too obvious, but there has to be some response (maybe it is an error or not); in your controller you have: echo made it!, where do you expect to see this? use firebug to see the ajax request and the response and also the posted data. Also, if you just want to update the database and not to render a view add: $this-autoRender=false to saveOrder. On Mar 29, 5:43 pm, Dustin [EMAIL PROTECTED] wrote: According the Live HTTP Headers (application to check headers), the ajax request is being made, but there doesn't seem to be a response from the saveOrder action. Is there some sort of code to hand the ajax request that needs to be in the saveOrder action? Thanks, Dustin Weber On Mar 29, 11:44 am, bernardo [EMAIL PROTECTED] wrote: Your code looks ok to me now. Have you checked with firebug that the ajax request isn't made? On Mar 29, 1:13 pm, Dustin [EMAIL PROTECTED] wrote: Bernardo, That made no difference. The drag n' drop stuff graphically works, but it isn't contacting my saveOrder action in my controller. I feel like I'm missing a bit of code somewhere that is the proverbial missing link. Do I need something in my controller action saveOrder for it to know to expect Ajax calls? The view now looks like this: Order View: ?php if (isset($javascript)): echo $javascript-link('scriptaculous/lib/prototype.js'); echo $javascript-link('scriptaculous/src/scriptaculous.js'); endif; ? ul id=questions ?php foreach ($faqs as $faq): ? ?php echo li id=\question_ . $faq['Faq']['id'] . \ . $faq['Faq']['question'] . /li; ? ?php endforeach; ? /ul ?php echo $ajax-sortable('questions', array('url' = 'saveOrder')); ? p input type=button value=Cancel onClick=window.location='../faqs'; / /p Dustin Weberhttp://www.dustinweber.com On Mar 29, 10:43 am, bernardo [EMAIL PROTECTED] wrote: Try setting the id of the li to something like faq_1 faq_2 ... that is they should end in an underscore and a number. On Mar 29, 11:41 am, Dustin [EMAIL PROTECTED] wrote: I did my very best to search everywhere I could to solve this problem related to the $ajax-sortable helper. Most of the posts are dated, so I apologize if I missed the answer somewhere else. Here's what I have: Controller snippets (related to this question): --- var $helpers = array('html', 'time', 'javascript', 'ajax'); function saveOrder() { echo made it!; //just to check and see that it made it for now //normally we would do some DB updating here instead } *all my other actions work properly in this controller Order View: ?php if (isset($javascript)): echo $javascript-link('scriptaculous/lib/prototype.js'); echo $javascript-link('scriptaculous/src/scriptaculous.js'); endif; ? ul id=questions ?php foreach ($faqs as $faq): ? ?php echo li id=\ . $faq['Faq']['id'] . \ style=\margin: 5px; padding: 5px 5px; border: 1px solid #000; width: 500px; cursor: pointer;\ . $faq['Faq']['question'] . /li; ? ?php endforeach; ? /ul ?php echo $ajax-sortable('questions', array('url' = 'saveOrder')); ? p input type=button value=Cancel onClick=window.location='../faqs'; / /p Using just those two simple snippets, I get the sortable list graphically working in the view. In simple terms, I can drag the boxes around with no problem. However, the sortable helper isn't doing anything. The controller action saveOrder never get's called by the helper. Am I missing something obvious here? As I understand it, this is the only code I need in the view to get it working properly, am I wrong? Firebug shows no errors and I don't see anything that looks out of place or wrong in the generated source (when the page is built). Thanks for your help in advance, Dustin Weberhttp://www.dustinweber.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group
Re: addslashes or mysql_real_escape_string --both not working with double quotes
If you are using version 1.1 be aware that addslashes in sanitize-sql is inside a conditional: if (!ini_get('magic_quotes_gpc')) { ... It seems that sanitize-sql is deprecated in 1.2 anyway. But if you are sure that fckeditor is converting the quotes to quot; why would they need to be escaped? databases have no problem dealing with any of the characters in quot; On Mar 28, 8:38 am, bingo [EMAIL PROTECTED] wrote: Hi bakers, I have one problem and a comment to make on sanitize-sql method.. Problem: I am using fckeditor for users to add comments to a post. However, if the comment contain double quotes, MySQL saves only the part that appeared before the first double quote..For instance if my string is this is a test hello world --- mysql will save only -- this is a test I am using sanitize-sql method but that is also not working... It seems the problem is the problem is with the fckeditor converts to quot; and mysql is not able to handle it. Comment: I was looking on PHP forum and found that it is better to use mysql_real_escape_string if the intented use is to put the data in mysql. http://us3.php.net/manual/en/function.mysql-real-escape-string.php regards, Ritesh --~--~-~--~~~---~--~~ 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: AJAX - Possible to update DB with textarea content from the textarea onblur()??
I think that's because using the prototype Form namespace directly works on the form element. You can try: Form.Element.serialize('test123') or $('test123').serialize() On Mar 21, 8:02 am, quincy [EMAIL PROTECTED] wrote: Right, i have been trying various things with mixed success. I am trying this: - echo $javascript-event(test123, blur, new Ajax.Request('/cms/ function/test123', {parameters: Form.serialize('test123')} );, false); but i then get an error: - $(form).getElements is not a functionhttp://www.mr-philp.co.uk/cms/js/prototype.js Line 1690 Now from this error it would beeasy to assume that my prototype library is in some way icorrectly installed, but all my other Ajax code is working (and there's lots of it) so i don't believe this is the case. Has anyone else had this error? Cheers On 16 Mar, 16:00, bernardo [EMAIL PROTECTED] wrote: It would be helpful if you can give more details of where exactly are you having problems: can you capture the event? can you make the ajax request and send the data to the controller? can you save the data? A straightforward way could be adding this to your view: ?= $javascript-codeBlock(EOD $('ControllerTextareaid').observe('blur',function() { new Ajax.Request('/controller/savetextarea', { parameters: Form.serializeElements([$('ControllerId'),$ ('ControllerTextareaid')]) }); }); EOD ); ? Note that this sends only the id and the textareafields. --~--~-~--~~~---~--~~ 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: CakePHP Session expiring problems...
Then note what Grant Cox said. What you want is the server side session to last for a long period, then it would seem that session lasts until the browser is closed, but that is just because the browser forgets the cookie. Try using this: ini_set(session.gc_maxlifetime,14400); and set CAKE_SESSION_SECURITY to high. and setting the On Mar 20, 8:55 am, Andre [EMAIL PROTECTED] wrote: That's right. By the way, the other framework I'm using is Code Igniter, and the custom PHP session library is this one:http://www.codeigniter.com/wiki/PHPSession/. The way I see it, it would be great to be able to port a Class like that in CakePHP. For some reasons, I don't like my session to last for more time than I need (oh well, one could always log out when he's done). On 20 Mar, 00:43, bernardo [EMAIL PROTECTED] wrote: I think that he refers to the default php behaviour when session.cookie_lifetime is set to 0, that means until the browser is closedhttp://php.net/manual/en/ref.session.php --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using Helpers in default layout
Hi all! I've been trying to use helpers in the default layout, so I copied pages_controller.php to my app's controllers dir, added the javascript helper to the uses array, and added a call to the javascript helper in /app/views/layouts/default.thml : ?php echo $javascript-link('myjs');? but I get 'Fatal error: Call to a member function on a non-object' on that line. Am I missing something or is it not possible to use other helpers on the default layout? --~--~-~--~~~---~--~~ 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: SQL logic
Have you tried: /app/models/category.php ?php class Category extends AppModel { var $name = 'Category'; var $hasMany = array('Story' = array('className' = 'Story', 'limit' = '3') ); } ? /app/models/story.php ?php class Story extends AppModel { var $name = 'Story'; var $displayField = 'story'; var $belongsTo = array('Category' = array('className' = 'Category'); } ? You might want to add more logic to you join in the Category model to be more specific about which 3 stories you want to fetch, maybe add 'order' and 'conditions' clauses miggs escreveu: I was hoping someone here could give me a hand. This seems like it should be simple, and I'm just over complicating things. Basically, I've got 2 tables: stories and categories. I want to query 3 stories from each category. My structure is as follows: stories - id - category_id - story categories - id - category_name now, I can get it to work by first querying categories and getting all the unique ids and then running a seperate query for each of those ids with a limit of 3. It just seems to me that there is probably a much better way to do this and I'm just not seeing it. Any help would be most appreciated. --~--~-~--~~~---~--~~ 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: CakePHP Session expiring problems...
I think that what you want to achieve is clear. But I think you have to set the timeout to more than 20 minutes if you want someone to be able to send a post more than 20 minutes after loging in, just for trying set it to something really high, and also set the session.gc_maxlifetime. No matter how long the session is kept on the server side, the cookie will be lost in the client side when the browser is closed (if session.cookie_lifetime is 0). ps: english isn't my mother language either. On Mar 20, 11:15 am, Andre [EMAIL PROTECTED] wrote: On 20 Mar, 14:34, bernardo [EMAIL PROTECTED] wrote: Try using this: ini_set(session.gc_maxlifetime,14400); and set CAKE_SESSION_SECURITY to high. That ini_set thing should be placed in cake/libs/session.php, right? If it's so, I've done it, but the problem persists. Maybe I'm dumb and I don't understand, or maybe I did not explain the problem correctly (english isn't my mother language). Say I've logged in and I start to write a post for my blog, and it takes 25 minutes. If I've set my session to timeout after 20 minutes (high security level), as soon as I press the submit button, I get redirected to the login screen, because the add method of my posts controller has a call to the following function at the first line: function checkSession() { // If the session info hasn't been set... if (!$this-Session-check('User')) { // Force the user to login $this-redirect('/users/login'); exit(); } } $this-Session-check('User') returns false, thus making me lose my post. Thanks for your help, by the way, much appreciated ;-) But I'm starting to think that I'll be forced to make my sessions last for more time than I actually need, to solve my problem. --~--~-~--~~~---~--~~ 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: Using Helpers in default layout
gwoo, sorry for hijacking the thread, won't happen again ;), and thanks for the info, I'll give it a try. --~--~-~--~~~---~--~~ 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: A bug in View constructor ?
This seems to be the official word: http://groups.google.com/group/cake-php/msg/0747a1a1eda5f143 On Mar 19, 3:17 pm, djiize [EMAIL PROTECTED] wrote: Not sure, but I read somewhere that this will not be possible anymore to access controller in view, cause it breaks MVC rules. Any expert to confirm or not? On 19 mar, 18:35, Gilles Dubois [EMAIL PROTECTED] wrote: Version : CakePHP version 1.2.0.4451alpha The class constructor is waiting for an argument name $controller. The class has an attribute $controller. In previous versions, I was used to reach the controller from the view (eg in a .thtml file) using $this-controller. It doesn't work anymore with out-of-the-box CakePHP version 1.2.0.4451alpha. So I modified the View constructor to add : $this-controller = $controller; as shown below (third line) : function __construct($controller) { if(is_object($controller)) { $this-controller = $controller; $count = count($this-__passedVars); for ($j = 0; $j $count; $j++) { $var = $this-__passedVars[$j]; $this-{$var} = $controller-{$var}; } } parent::__construct(); ClassRegistry::addObject('view', $this); } Is it a bug ? --~--~-~--~~~---~--~~ 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: CakePHP Session expiring problems...
On Mar 19, 7:39 pm, Grant Cox [EMAIL PROTECTED] wrote: Do you mind expanding on which framework / language allows you to have sessions automatically expire when the browser is closed? Do you just mean that the session has a very long server side timeout, and by closing the browser your own client just forgets its cookie (which really hasn't closed the session), or is there something more advanced going on? I think that he refers to the default php behaviour when session.cookie_lifetime is set to 0, that means until the browser is closed http://php.net/manual/en/ref.session.php --~--~-~--~~~---~--~~ 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: cakephp and developer rates
Walker's analysis makes sense. In economic terms: If by using a framework you are able to produce the same simple web app in less time, you may say that you have increased your productivity and as a consequence you are able to reduce your costs and increase your profit. It has nothing to do with the final price of the product you are selling. On Mar 18, 10:09 am, sixlaneve [EMAIL PROTECTED] wrote: might sounds like a stupid questions but... if cakephp is a rapid development framework (and it looks like), does it mean that developing a simple web app will cost less money? --~--~-~--~~~---~--~~ 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: AJAX - Possible to update DB with textarea content from the textarea onblur()??
It would be helpful if you can give more details of where exactly are you having problems: can you capture the event? can you make the ajax request and send the data to the controller? can you save the data? A straightforward way could be adding this to your view: ?= $javascript-codeBlock(EOD $('ControllerTextareaid').observe('blur',function() { new Ajax.Request('/controller/savetextarea', { parameters: Form.serializeElements([$('ControllerId'),$ ('ControllerTextareaid')]) }); }); EOD ); ? Note that this sends only the id and the textareafields. --~--~-~--~~~---~--~~ 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: Sanitize and hyphens
But why do hyphens need to be escaped in the first place? I looked at the function cleanValue (that is called by cleanArray) and it makes several replacements, some of them look weird, for example: $val = str_replace(!, !, $val); $val = str_replace(', ', $val); I guess the intention was to write something like $val = str_replace(', #39;, $val); but were copied from some web page and the entities got lost. I prefer to stick to the regular php function htmlspecialchars; writing your own wrapper for this function to operate on arrays is very easy. On Mar 7, 8:32 pm, squidliberty [EMAIL PROTECTED] wrote: I have several areas of my site where it is necessary to sanitize large amounts of user form data. cleanArray() makes this process a breeze - however, I have found that it replaces hyphens ('-') with the htmlentity equivalent ('#45;'). This is a big problem for email addresses, which may contain hyphens. How should I be handling this? My best solution was to create a fixSafeChar() function to convert the hyphens back. But this seems pretty crude. Any suggestions? Is cleanArray() not the right function for the task? 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 -~--~~~~--~~--~--~---
Re: Please help me understand URL and Routes in Cake
For sort and filter you can certainly use query string parameters. Have you tried that? I don't think you will any problem there. For the problem of passing multiple units you don't need to use a special separator, cakephp will pass anything matched by * as additional arguments to your controller function. For example if you have $Route-connect('/units/*', array('controller' = 'units', 'action' ='view')); you can use function view() { $sort = $_GET['sort']; $units = func_get_args(); ... On Mar 4, 4:27 pm, barduck [EMAIL PROTECTED] wrote: No one? Surely someone can offer some additional insights on this. Thanks. On Mar 1, 10:44 am, barduck wrote: Thanks for the reply. I think I have better understanding of the Route functionality now. I am still not sure I understand the full potential of regular expressions in Route. I mean, I see how I can specify a regex in the matching part of the Route-connect() but in mod rewrite, I can use regular expression both in the matching and the substitutions part of the URL (the groups from the match can be used in the rewritten URL, using (...) in the pattern and $N in the substitution), can something like this be done in Route? I assume the colon is one way to do this, but does colon-param pattern always needs to come surrounded by slashes (/)? What about the asterisk I used in my route, how come it isn't being confused with the meaning of asterisk in regex? I am also not sure what is the best way to achieve what I described in my original post. One possible solution is to define one big parameter and parse it myself in my code using a delimiter I set. So I set unit1+unit2+unit3... as one big parameter and separate it in code myself by the plus signs. Then I set a Route rule to detect plus signs before the normal unit view match. I think this will work also for the parameters to the index view but I wonder if this is the right way to do this and whether cake can do it automatically for me? Thanks. - barduck On Feb 28, 5:54 pm, Chris Lamb [EMAIL PROTECTED] wrote: I understand that Cake does [routing] this in two phases, one using apache mod rewrite to pass the rest of the path to cake and the second one by Routes to further route the URL in cake internally. Is this correct? Yes. I assume that the major purpose of the Routes is to map URLs to controllers, functions and parameters. Correct. 1. I've seen a colon (:) used in the manual in routes config (like / blog/:action/* ). What is the special meaning of the colon? It isn't mentioned anywhere. They are to control the parameters that are passed to the Controller. I think the syntax is a Ruby-ism. First, the general case. If your route is: /blog/:spam/* then if the browser requested /blog/eggs/ then $this-params['spam'] would contain the value 'eggs'. You can have more than one in the route. For example: /blog/:year/:month/:day/:slug/* gets you something like the default WordPress blog link structure. There are two 'magic' parameters, controller and action which, when set, decide which controller or action to call respectively. For example, the route: /blog/:action/:spam when called with: /blog/view/eggs/ will call the view action with $this-params['spam'] set to eggs. 2. Can I use regular expressions in Routes like on mod rewrite? How? The manual doesn't mention it. Just use regular Perl-compatible regexs. 3. Can I still use URL query string parameters using ? ? Or does cake only use the /controller/action/param/param... convention? Cake has a different method of handling query string parameters. My advice is to construct a controller action to display $this-params and see how they are handled. Hope I am making myself clear. Sorry for the long message. Hopefully someone else can help with the rest if the above does not help you solve the problem yourself. Note that the CakePHP source is very readable for a PHP program, so examining the dispatcher code may make sense than any of this. Best wishes, -- Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20 signature.asc 1KDownload --~--~-~--~~~---~--~~ 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: ajax editor and view
On Mar 3, 8:45 am, sanjeevdivekar [EMAIL PROTECTED] wrote: Hey, I am also in same trobule when i edit 2nd time i see test message!-- 0.0992s -- in text box. what u do with control.js? What you are seeing is the debug timing information that cake php adds when the debug level is set to 1. Remember that any output generated will be added to the ajax response. Simply define debug to 0 and you'll stop seeing it. --~--~-~--~~~---~--~~ 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: So confused
You are right. There is a bug in the code used in the screencast. I think the problem is that edit.thtml is copied from add.thtml but forget to include the line ?php echo $html-hidden('Post/id'); ? so the id is not posted and the controller ends adding a new post. The code in the manual is correct though. I wonder how nobody noticed this before... On Mar 1, 1:41 pm, skatona [EMAIL PROTECTED] wrote: I must be losing it. I'm a veteran php web developer and a friend said cakephp was awesome so I've checked it out and gone through a couple screencasts. Am I crazy, or is the Blog Tutorial screencast wrong? More specifically, the Edit functionality does NOT edit a post. It merely Adds one. Watch the screencast again. You click Edit, it brings up the Title and Body textboxes with the information from that post, but when you edit it and save - it just creates a new post! I thought Edit meant change, not give me the info so I can use it in another NEW post. Someone please help me out here. -Shaun --~--~-~--~~~---~--~~ 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: findCount SQL errors
On Feb 28, 6:15 am, Christopher E. Franklin, Sr. [EMAIL PROTECTED] wrote: I will try that as well. I thought that's what the sanitize-sql() did If you look at the definitio of sanitize-sql(): function sql($string) { if (!ini_get('magic_quotes_gpc')) { $string = addslashes($string); } return $string; } So my guess is that you have magic_quotes_gpc enabled and addslashes is not being called. Note that in cake 1.2 sanitize-sql has been deprecated and has sanitize-escape instead, which in the case of mysql calls mysql_real_escape_string. --~--~-~--~~~---~--~~ 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: findCount SQL errors
On Feb 28, 7:50 am, AD7six [EMAIL PROTECTED] wrote: On Feb 28, 10:15 am, Christopher E. Franklin, Sr.[EMAIL PROTECTED] wrote: I will try that as well. I thought that's what the sanitize-sql() did . Maybe I am mistaken. If you use a string constraint, you are basically on your own from cake's perspective. If you use an array constraint, cake should take care of it for you. I bet this works, or at the very least does not generate errors: $this-matchResult = $this-Classified-findCount(array( Classified.text = $ad-text, Classified.editions = $ad-editions) ); I don't think this works because it cuts the string at the first newline. HTH, AD --~--~-~--~~~---~--~~ 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: ajax editor and view
Make sure the spaces are not in your source files (before or after the php tags) as these spaces will be added to the ajax response. On Feb 28, 10:13 am, dhalsim [EMAIL PROTECTED] wrote: Hi, I've put an ajax editor in my view and the problem I have is when I edit my field for the second or more time, the value in the text field is prefixed with sereval tabulation (I don't see directly the value in the input). I don't understand where they come from. this is a piece of my view : td class='info' p id=ajax_edit_nom?php echo $user['nom']; ?/p /td ?php echo $ajax-editor('ajax_edit_nom','/utilisateurs/ajax_update/'. $user['utilisateurid'].'/nom')); ? and my UtilisateursController with the ajax_update() method : function ajax_update($id,$sub) { $value = $this-params['form']['value']; //new value to save $this-Utilisateur-id = $id; if (!$this-Utilisateur-saveField($sub, $value, true)) { $this-set('error', true); } $user = $this-Utilisateur-read(array($sub), $id); $this-set('value',$user['Utilisateur'][$sub]); $this-layout = 'ajax'; } and finally th ajax_update.thtml ?php e($value);? If anybody has an idea... --~--~-~--~~~---~--~~ 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: Form validation + Ajax ?
google cache? http://www.google.com/search?q=cache:wiki.cakephp.org/faq:how_do_i_validate_a_form_with_ajax?s=ajax%2Bupdate On Feb 27, 8:55 am, Mech7 [EMAIL PROTECTED] wrote: Does anybody know how i can reach the wiki? I found this link thru google but i can't acces it :( http://cakebaker.42dh.com/2005/12/31/form-validation-with-ajax/ --~--~-~--~~~---~--~~ 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: findCount SQL errors
You don't need to escape html characters. In fact doing that will give you incorrect results because the escaped string will never match. Html escaping will convert html special chars(') into entities, but what you want is adding backslashes to the characters that are illegal in the query. So, I think you just need to use addslashes: $this-Classified-findCount(Classified.text = ' . addslashes($ad- text) . ' AND Classified.editions = '$ad-editions'); On Feb 27, 10:03 pm, Christopher E. Franklin, Sr. [EMAIL PROTECTED] wrote: Hrmm, I seem to have fixed it. The first time I tried this code, before I posted, it didn't work but, now it does. Maybe I had a typo. /shrug Here is what I changed: [...] $this-xmlID = $this-Classified-getNumRows(); ++$this-xmlID; [...] $this-matchResult = $this-Classified-findCount(text = '.$this-MrClean-sql($this-MrClean-html($ad-text)).' AND editions = '. $ad-editions.'); [...] $this-data['Classified']['text'] = $this-MrClean-sql($this-MrClean-html($ad-text)); [...] My conclusion is that the sanitize-sql() really doesn't help if you have any html characters in your text. So, I convert the special characters using html() and the escape with sql(). I do the same thing on insert so, when I match the text, it should compare exactly. There a few snags. Some ads get by but, I can live with it. I will just use strip slashes and html_special_chars functions to convert the text back to my original HTML formatted. Sorry for the bother and long posts --~--~-~--~~~---~--~~ 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: Sending forms in an html email
Robin, Yahoo may include scanners to strip out those action references in their email servers in an effort to protect theis less than intelligent users, so I don't really see a way around that. Another problem is that, even if you do get the form past with the action tag intact you'll need to use absolute urls, otherwise (assuming the user is viewing the email from a webmail client) the /cake/goalsite/main/index/ url will resolve to www.userswebailsite/cake/goalsite/main/index/. Bernardo Bootstrapper escreveu: What's the best way to send forms in an HTML email? I've seen it done before, but in my current attempt, Yahoo Mail is stripping out my action tag: action=/cake/goalsite/main/index/ so form action=/cake/goalsite/main/index/ method=post becomes form method=post Other email clients may do other nasty things. Any tricks here? Anyone know a great tutorial? I know that including forms in email should be avoided, but my users are expecting it. It is a critical piece of my application. Thanks in advance! Robin --~--~-~--~~~---~--~~ 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: Ajax tutorials
Check the group's history, there was a post earlier today with links to just that.. :P Junal Rahman escreveu: I want to use Ajax in Cakephp. Can anybody give me a link of example where i can see how to use Ajax in cake. --~--~-~--~~~---~--~~ 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: How did cake get the id of saved data
On Feb 13, 9:40 pm, admin_AT_loveyourdress.com [EMAIL PROTECTED] wrote: Before cake, whenever i save data into a row without specifying the id(auto incremental primary key). I cant get the id number back from mysql withouth doing a search. However, using cake's model-save, i get the model-id magically. Anyone actually knows how cake retrived the id key? But you had the last_insert_id() mysql function for that purpose. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---